EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Passing a random player on bosses hate list to another npc? (https://www.eqemulator.org/forums/showthread.php?t=33570)

trevius 05-17-2011 01:37 AM

If they are all the same ID, then you will need to do an NPC List search to find each NPC that matches that ID. Then, you can perform whatever within that same part of the loop.

If you need it to happen multiple times, then the best way is to do it on a timer, as EVENT_ATTACK is not for each round.

Astal 05-19-2011 04:08 PM

still having some problems everything triggers but they dont cast the spell.

Is it because im getting them by an entitylist?

They are getting my guys ID, i checked that in the one shout (not in this script the one in my editor)

so only thing i can think of is
my $AddNPC1 = $entity_list->GetMobByNpcTypeID(2700253);

since its an entitylist and there is no $entity_list->CastSpell function, or am i reading it wrong?

$AddNPC1->CastSpell(21480, $HateTargetID);

Code:


sub EVENT_SAY {       

                if($text=~/Hail/i) {
                $client->Message(315, "Script Working");
                }       
}


sub EVENT_SPAWN {
       
}


sub EVENT_HP {

}

sub EVENT_AGGRO {

        quest::settimer("Random_Hate", 25); #set timer to get random hate mob
        quest::shout("Timer Set");
}

sub EVENT_TIMER {

if ($timer eq "Random_Hate" ) {

        quest::shout("Timer Triggered");
       
        my $range = 120; #maximum number
        my $minimum = 60; #minimum number

        my $random_number = int(rand($range)) + $minimum; #generate a number between $minimum and $range
       
        quest::settimer("Random_Hate", $random_number); #set timer to a random number between 60 and 120

        # Get each of the NPC casters:
        my $AddNPC1 = $entity_list->GetMobByNpcTypeID(2700253);
        my $AddNPC2 = $entity_list->GetMobByNpcTypeID(2700259);
        my $AddNPC3 = $entity_list->GetMobByNpcTypeID(2700260);
        my $AddNPC4 = $entity_list->GetMobByNpcTypeID(2700266);
       
        # Get a random entry on Laibach's hate list
        my $HateTarget = $npc->GetHateRandom();
        # Get the ID of that hate entry for use with CastSpell
        my $HateTargetID = $HateTarget->GetID();
       
        # Make sure you got him before using $laibach as a pointer
        if($AddNPC1)
        {
                # Cast a spell on the random hate target (Courage in this example)
                $AddNPC1->CastSpell(21480, $HateTargetID);
                quest::shout("You cannot defeat our mother!!!");
        }
        if($AddNPC2)
        {
                # Cast a spell on the random hate target (Courage in this example)
                $AddNPC2->CastSpell(21480, $HateTargetID);
                quest::shout("You cannot defeat our mother!!!");
        }
        if($AddNPC3)
        {
                #Cast a spell on the random hate target (Courage in this example)
                $AddNPC3->CastSpell(21480, $HateTargetID);
                quest::shout("You cannot defeat our mother!!!");
        }
        if($AddNPC4)
        {
                #Cast a spell on the random hate target (Courage in this example)
                $AddNPC3->CastSpell(21480, $HateTargetID);
                quest::shout("You cannot defeat our mother!!!");
       
        }
       
}

}


joligario 05-19-2011 09:00 PM

You are looking at that part wrong. $entity_list->GetMobByNpcTypeID() passes a type Mob. Therefore, you when you call $AddNPC->CastSpell() is actually Mob::CastSpell(spellid,targetid)

Astal 05-19-2011 09:43 PM

Quote:

Originally Posted by joligario (Post 200169)
You are looking at that part wrong. $entity_list->GetMobByNpcTypeID() passes a type Mob. Therefore, you when you call $AddNPC->CastSpell() is actually Mob::CastSpell(spellid,targetid)

so is that correct usage then?

joligario 05-19-2011 10:15 PM

Yes, at a quick glance it looks right.

Astal 05-19-2011 10:16 PM

Quote:

Originally Posted by joligario (Post 200172)
Yes, at a quick glance it looks right.

hey i think i hit the max spell limit at 21473 can you confirm this and do you know how to change it?

Im using SoD

joligario 05-20-2011 05:51 AM

It doesn't seem like an integer problem... not that number. I think that may be a client thing. Are you sure SoD handles that spell? It looks pretty new according to Lucy.

Astal 05-20-2011 04:22 PM

Quote:

Originally Posted by joligario (Post 200177)
It doesn't seem like an integer problem... not that number. I think that may be a client thing. Are you sure SoD handles that spell? It looks pretty new according to Lucy.

its a custom spell, i found out the problem spell editor changed the database on me. so it was writing to a non existant one


All times are GMT -4. The time now is 03:00 PM.

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