• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

How would i get a random victim

Status
Not open for further replies.

Crow

Enthusiast
yeah, you'd load all the players in the group or raid into a container, and go off that. I myself like using a List (called via std::list) Then later when you do the spell, use a random number to pick one out and target them.


One I used to do based on distance from the creature is:

std::list<Unit*> targets;

SelectTargetList(targets, 5, SELECT_TARGET_RANDOM, 25.0f, true);

for (std::list<Unit*>::const_iterator i = targets.begin(); i != targets.end(); ++i)
DoCast(*i, SPELL);
break;

 
Last edited:

Lightning Blade

BETA Tester
Alright Thanks.

- - - Updated - - -

i can use the *i in any function right ?.

- - - Updated - - -

getting a error. Syntax error near '::'
 

Rochet2

Moderator / Eluna Dev
Use one of these
:GetAITarget(type[, playeronly, position, distance, aura]) - Get an unit in threat list
:GetAITargets() - Get units in threat list
:GetNearestTargetInAttackDistance([radius]) - Returns nearest target in attack distance and within given radius, if set
:GetNearestTarget([radius]) - Returns nearest target in sight or given radius
:GetNearestHostileTargetInAggroRange([checkLOS]) - Returns closest hostile target in aggro range of the creature


http://nomsoftware.com/wiki/doku.php?id=eluna_unit_class_getaitarget

I suggest clicking the link or using the second method.
 
Last edited:

Rochet2

Moderator / Eluna Dev
The link i posted contains the needed info ;p its THE link

Why weren't those moved and why is it still there ; /?
 

Tommy

Founder
This week I'll be updating the wiki on Eluna documentation. Also, every time I try to get someone to actually update EmuDevs wiki, they disappear. I'm just now getting to it. :p
 
Status
Not open for further replies.
Top