I can't seem to figure out how to get this quest working properly. It seems pretty simple, since basically all it is supposed to do is spawn some adds and then add hate to the new spawns. The quest works fine accept for the section I highlighted in
RED. The adds spawn, but they never agro. And, when the script runs, it breaks at the point where they are supposed to agro and doesn't even continue to cycle through and repeat the timers as it should. I don't get the "Testing Rat Agro Section!" message that I added to check if it was making that far.
This same section works just fine in another encounter I have, but on that encounter, the adds that come aren't spawned by the quest, they are just normal zone spawns. I suspect that "$entity_list->GetMobByNpcTypeID();" is what causes the problem. I think that since these are spawned adds and not static spawns in the zone, it can't find them in the entity list.
Does anyone know a way to get it working for spawned adds?
Code:
#Nightwhisker Fight
sub EVENT_ATTACK {
quest::stoptimer("rat_adds");
quest::shout("Rats of Dreadsire, I call upon you! Come to my aid!");
quest::settimer("rat_adds",10);
}
sub EVENT_TIMER {
if ($timer eq "rat_adds") {
quest::stoptimer("rat_adds");
quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 17.7, 3209.0, 0.8,12);
quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 33.4, 3208.6, 1.8,6);
quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 29.9, 3223.7, 5.5,7);
quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 41.6, 3238.8, 10.3,253);
quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 24.9, 3245.3, 12.4,5);
quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 55.4, 3450.6, 24.1,61);
quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 67.4, 3440.7, 24.1,64);
quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 80.4, 3456.6, 24.1,61);
quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 101.3, 3439.0, 24.1,64);
quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 107.9, 3454.8, 24.1,66);
quest::say("Come! Come! Rid these halls of the humaniods!");
quest::settimer("rat_agro",2); }
if ($timer eq "rat_agro") {
my $tiny_rats = $entity_list->GetMobByNpcTypeID(2700659);
my $albino_rats = $entity_list->GetMobByNpcTypeID(2700660);
my $black_rats = $entity_list->GetMobByNpcTypeID(2700661);
if ($tiny_rats) {
my $hate_tiny_rats = $tiny_rats->CastToNPC();
$hate_tiny_rats->AddToHateList($client, 1); }
if ($albino_rats) {
my $hate_albino_rats = $albino_rats->CastToNPC();
$hate_albino_rats->AddToHateList($client, 1); }
if ($black_rats) {
my $hate_black_rats = $black_rats->CastToNPC();
$hate_black_rats->AddToHateList($client, 1); }
quest::stoptimer("rat_agro");
quest::say("Testing Rat Agro Section!");
quest::settimer("rat_adds",10); }
}
sub EVENT_COMBAT {
if ($combat_state == 0) {
quest::depopall(2700659);
quest::depopall(2700660);
quest::depopall(2700661);
quest::stoptimer("rat_adds");
quest::stoptimer("rat_agro");
}
}
sub EVENT_DEATH {
$timestamp = localtime(time);
quest::depopall(2700659);
quest::depopall(2700660);
quest::depopall(2700661);
quest::stoptimer("rat_adds");
quest::stoptimer("rat_agro");
quest::shout2("SQUEEEEEEEK!");
quest::write("bossdeaths.txt","[$timestamp]:Nightwhisker was killed by $name the $class.");
}
My Perl knowledge sucks heh.