EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   GetRandomClient (https://www.eqemulator.org/forums/showthread.php?t=38421)

Esildor 06-26-2014 05:26 AM

GetRandomClient
 
Does this function not work?

I'm trying this with no luck:

Code:

        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'

Code:

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

Kayen 06-26-2014 05:38 AM

Pretty sure, CastSpell requires Target ID

Code:

        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:

Code:

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");
                }
        }



All times are GMT -4. The time now is 07:41 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.