EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Quests (https://www.eqemulator.org/forums/forumdisplay.php?f=624)
-   -   Spawning an NPC from inside a timer.... (https://www.eqemulator.org/forums/showthread.php?t=12401)

Saethan 03-12-2004 01:38 AM

Spawning an NPC from inside a timer....
 
I tried to spawn NPC's inside a timer(with the perl quest system), and it crashed the zone.exe file when attempting to do so... this is the perl script I was using that crashed zone.exe:

Code:

sub EVENT_DEATH
{
quest::echo("TimerEnds");
quest::say("Impossible!  How... aarrgh.");
quest::stoptimer(1);
}

sub EVENT_ATTACK
{
quest::echo("TimerStarts");
quest::settimer(1,15);
}

sub EVENT_TIMER
{
quest::echo("TimerGoesOff");
quest::spawn(170454,0,0,-793,-883,67);
}

zone.exe would tell me 'TimerGoesOff' and then crash with a message about some kind of error with CastToClient()... soo I made this code change in zone.cpp:

Around line 708 is the code
Code:

parse->Event(EVENT_TIMER,p->mob->GetNPCTypeID(),p->name.c_str(),p->mob,0);
And I changed it to

Code:

parse->Event(EVENT_TIMER,p->mob->GetNPCTypeID(),p->name.c_str(),p->mob,p->mob->CastToMob());
And suddenly I'm able to spawn NPC's from inside a timer, now enstead of crashing zone.exe my script spawns an npc every 15 seconds until the trigger mob dies.

Now, I'm a novice coder(in C++ anyways), and I have no idea if I screwed something else up by doing this. Does this look like a decent fix? :-)

[edit] Hmm already ran into a couple problems. It's only spawning one mob, first of all, no matter how many I put in there... and quest::me still isn't working inside the timer(didn't work before the fix either, though).

Shadow-Wolf 04-02-2004 04:08 PM

hmm did you ever get it fixed?


All times are GMT -4. The time now is 12:18 AM.

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