Log in

View Full Version : GetRandomClient


Esildor
06-26-2014, 05:26 AM
Does this function not work?

I'm trying this with no luck:


if ($timer eq "random_stun"){
my $RandClient = $entity_list->GetRandomClient($MyX, $MyY, $MyY, 300, 0);
$npc->CastSpell(5050,$RandClient);


I also tried this, but I added the 0 in the above example because the syntax on the perl reference is: GetRandomClient(x, y, z, range, ClientToExclude) .. thought maybe I needed to 'clienttoexclude'


my $RandClient = $entity_list->GetRandomClient($MyX, $MyY, $MyY, 300);

Kayen
06-26-2014, 05:38 AM
Pretty sure, CastSpell requires Target ID

if ($timer eq "random_stun"){
my $RandClient = $entity_list->GetRandomClient($MyX, $MyY, $MyY, 300, 0);
if ($RandomClient){
$npc->CastSpell(5050,$RandClient->GetID());
}
}

Esildor
06-27-2014, 02:27 PM
Got it working, for future reference if anyone needs it:


sub EVENT_AGGRO {
quest::shout("I was aggroed");
quest::settimer("random_nuke", 8);
quest::settimer("random_dot", 11);
quest::settimer("random_stun", 3);
}



sub EVENT_TIMER {
if ($timer eq "random_stun"){
$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
my $RandClient = $entity_list->GetRandomClient($x, $y, $z, 400, 0);
my $RandName = $RandClient->GetName();
my $RandID = $RandClient->GetID();
$npc->CastSpell(5050,$RandID);
quest::shout("Be stunned $RandName");
}
if ($timer eq "random_nuke"){
$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
my $RandClient = $entity_list->GetRandomClient($x, $y, $z, 400, 0);
my $RandName = $RandClient->GetName();
my $RandID = $RandClient->GetID();
$npc->CastSpell(5075,$RandID);
quest::shout("Be nuked $RandName");
}
if ($timer eq "random_dot"){
$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
my $RandClient = $entity_list->GetRandomClient($x, $y, $z, 400, 0);
my $RandName = $RandClient->GetName();
my $RandID = $RandClient->GetID();
$npc->CastSpell(5049,$RandID);
quest::shout("Be dotted $RandName");
}
}