PDA

View Full Version : Issue with quest for a mass of NPCs


Paine
04-30-2006, 03:50 AM
Hiho, I have got some issue with a quest that is supposed to make alot of mobs sit (mobs with the same name)

Since EVENT_SPAWN didnt do the trick for sitting (just froze ne NPCs) I decided to do a timed event for that.

My file looks like this:

sub EVENT_SPAWN
{
quest::starttimer(1,5);
}

sub EVENT_TIMER
{
$npc->SetAppearance(2);
quest::shout("TIMEREVENT TRIGGERED FOR NPC: $mname, $mobid");
}

sub EVENT_SAY
{
$npc->SetAppearance(2);
quest::shout("SAYEVENT TRIGGERED FOR NPC: $mname, $mobid");
}

This works all fine as long as I have a single mob spawned with that name.
However I have a bunch of mobs and for some odd reason it doesnt work in that case. The sayevent gets triggered properly tho.
What I expected (since I am a bit unsure about how EQemu handles these scripts) that only one mob was going to trigger that, but no mob at all triggered the timer event.
I thought it might be an issue with the timerid and changed the ID to $mname and $mobid, however both didnt work either. The only time I had the timerevent fire at all (at least the only time I had a shout) was when I did a random(50) for the timerid. For some odd reason, in some instances after repopping I had a single npc fire the timerevent constantly every 5 seconds.

Any ideas?

mystic414
05-01-2006, 02:39 AM
Are you using the latest server version? There used to be an issue where there could only be one timer with a given id running at a time, but that was fixed somewhat recently.

Do the mobs spawn naturally, or do they spawn as part of a quest? If the latter, you could probably do something like this:

$entid1 = quest::spawn2(npcid, 0, 0, x, y, z, h);
my $mob1 = $entity_list->GetMobID($entid1);
if ($mob1) {
my $mobnpc1 = $mob1->CastToNPC();
$mobnpc1->SetAppearance(2);
}

and do that for each mob that is spawned