Log in

View Full Version : The missing spawn?


rlie_0
07-18-2014, 12:33 AM
Hey there guys, Ive been working on this quest and got the insta spawn version to this working as intended. Just a problem with the delay aspect, and id like to ask some help! So here is the code ive worked for this spawn event.

sub EVENT_DEATH_COMPLETE {
quest::settimer("summit",10);
quest::say("I will return!");
}

sub EVENT_TIMER {
if ($timer eq "summit") {
quest::stoptimer("summit");
quest::spawn(1169,0,0,-553,-77,19.63);
}
}


Now my goal is this. Upon mobs death (as you can see) I want to start a timer, then some time later, when timer (next event) is up the mob spawns at a set location within the zone, the instal spawn version works fllawlessly, here is that below

sub EVENT_DEATH_COMPLETE {
quest::shout ("I shall return!");
quest::spawn(1169,0,0,-553,-77,19.63);
}

Anyone know what is missing from the upper quest and why the mob is failing to spawn after the timer is up?

Kingly_Krab
07-18-2014, 12:57 AM
This would likely be easier using signals to an invisible mob.

Mob that dies:
sub EVENT_DEATH_COMPLETE {
quest::signalwith(NPC ID, Signal ID);
}Invisible mob (Race: 127, Body Type: 11, Name: _):

sub EVENT_SIGNAL {
if ($signal == Signal ID) {
quest::settimer("Spawn", 10);
}
}

sub EVENT_TIMER {
if ($timer eq "Spawn") {
quest::spawn(1169, 0, 0, -553, -77, 19.63);
quest::stoptimer("Spawn");
}
}

Zaela_S
07-18-2014, 12:59 AM
Timers are tied to Mobs. Starting a timer for a mob when it is dying is pointless: if the mob no longer exists when the timer is up, there won't be anything to receive the EVENT_TIMER event.

You could:

a) Spawn an invisible, untargetable NPC when the first NPC dies, which exists purely to run your timer and spawn the next NPC (and despawn itself).

b) Attach the timer to the Client that deals the killing blow and hope they don't die/leave before the timer goes off. Not sure how to do this in the Perl system myself (signal?) but I imagine there's a way.

rlie_0
07-18-2014, 11:14 PM
This would likely be easier using signals to an invisible mob.

Mob that dies:
sub EVENT_DEATH_COMPLETE {
quest::signalwith(NPC ID, Signal ID);
}Invisible mob (Race: 127, Body Type: 11, Name: _):

sub EVENT_SIGNAL {
if ($signal == Signal ID) {
quest::settimer("Spawn", 10);
}
}

sub EVENT_TIMER {
if ($timer eq "Spawn") {
quest::spawn(1169, 0, 0, -553, -77, 19.63);
quest::stoptimer("Spawn");
}
}



With these suggestions it worked like a charm. I got it working like it woulda worked back on live, VS Has to be killed in order for VSR to make an appearance. My zones dont stay up perma like P99 or live can do but a delayed spawn can be made.

Thanks for the suggestions, just made an invis un-targetable mob spawn to echo the spawn timer upon VS death. Then when VSR spawns, the un-targetable mob depops. Thanks! It was annoying seeing VSR and VS both up when that never happened even on live.

Kingly_Krab
07-19-2014, 05:05 AM
You're welcome.