This is a simple question:
- I want an object that spawns an NPC
- once the NPC is killed, it is respawned
- if the object is interacted with, the NPC does not spawn again, and the object is removed
The object remover is easy, what is the most efficient way of having an object-dependent respawner?
simple spawner question
simple spawner question
2007 -- 30 years on the Net!
Re: simple spawner question
If you want the NPC to respawn instantly, add the "<NPC> deactives" and then the "<NPC> activates" actions, in that order, to the NPC's death event. Add the conditional "<Scenery Object Interaction X> has not triggered" so the respawn only happens if no one has interacted with your object yet.
This is rather abrupt, though, so you'll probably want a short timer. Make the NPC's death start the timer, again making it conditional on the object not being used yet. Put the deactivation/reactivation on the timer trigger event.
(The reason for deactivating the NPC is to get rid of the corpse. A mob is still active while its corpse is on the ground, and trying to activate an active mob does nothing. Corpses take over a minute to vanish naturally. If you're always going to wait longer than that to respawn, you won't need to do an early manual deactivation.)
This is rather abrupt, though, so you'll probably want a short timer. Make the NPC's death start the timer, again making it conditional on the object not being used yet. Put the deactivation/reactivation on the timer trigger event.
(The reason for deactivating the NPC is to get rid of the corpse. A mob is still active while its corpse is on the ground, and trying to activate an active mob does nothing. Corpses take over a minute to vanish naturally. If you're always going to wait longer than that to respawn, you won't need to do an early manual deactivation.)
Re: simple spawner question
I would do this by making a cyclic timer that goes off every second and activates the NPC every time it goes off. That way the NPC respawns right after the corpse disappears. If you need it to respawn right after death, add an "<NPC> deactives" event to it's death as Unkala said.
Then, make the object interaction deactivate the timer, so that it stops triggering the NPC spawn. (And ofcourse, uncheck the NPC's "autorespawn" so that it doesn't spawn on it's own.)
Unkala's method probably works too though. Whatever suits you best.
I'd use an (empty) dialog, make the NPC's death start the dialog, and make the end of the dialog trigger the deactivation/reactivation of the NPC. You can make the dialog last as long as you want the NPC to stay dead, thus basicly using it as a timer.
Then, make the object interaction deactivate the timer, so that it stops triggering the NPC spawn. (And ofcourse, uncheck the NPC's "autorespawn" so that it doesn't spawn on it's own.)
Unkala's method probably works too though. Whatever suits you best.
I wouldn't do this though. In my experience, timers that get repeatedly started, triggered, stopped, and started again... well, they get messy.unkala wrote:This is rather abrupt, though, so you'll probably want a short timer. Make the NPC's death start the timer, again making it conditional on the object not being used yet. Put the deactivation/reactivation on the timer trigger event.
I'd use an (empty) dialog, make the NPC's death start the dialog, and make the end of the dialog trigger the deactivation/reactivation of the NPC. You can make the dialog last as long as you want the NPC to stay dead, thus basicly using it as a timer.
Re: simple spawner question
The issue with that is that the respawn won't always happen one second after the corpse vanishes. It can be anywhere from 0 to 1 seconds, essentially at random, depending on when the NPC dies compared to the timer's beat. And it can be different every time. That's not bad, maybe not even noticeable, at 1 second, but if the OP wants a longer respawn delay, like 5 or 10 seconds, that randomness gets wider.sidusar wrote:I would do this by making a cyclic timer that goes off every second and activates the NPC every time it goes off. That way the NPC respawns right after the corpse disappears. If you need it to respawn right after death, add an "<NPC> deactives" event to it's death
It does. I tried it out first. Specifically, I wasn't sure if multiple actions in one event are guaranteed to happen in the order they're listed.Unkala's method probably works too though.
Messy as in hard for the designer to keep track of what he's using for what, or messy as in the game doesn't reset them properly and they start running for the wrong durations, or running but never firing?I wouldn't do this though. In my experience, timers that get repeatedly started, triggered, stopped, and started again... well, they get messy.
Using a dialogue as a substitute timer instead of an actual timer doesn't sound like a good way to avoid confusion...
Re: simple spawner question
True, that's why it's only usuable for an instant-after-corpse-gone respawn, which is what the OP seemed to want here.unkala wrote:The issue with that is that the respawn won't always happen one second after the corpse vanishes. It can be anywhere from 0 to 1 seconds, essentially at random, depending on when the NPC dies compared to the timer's beat. And it can be different every time. That's not bad, maybe not even noticeable, at 1 second, but if the OP wants a longer respawn delay, like 5 or 10 seconds, that randomness gets wider.
If you want a longer respawn delay, you'll have to use the dialog delay and let the scenery interaction deactivate the dialog.
Messy as in the game doesn't handle them well. A non-cyclic timer is often just impossible to fire again after it's triggered once, while a cyclic timer is impossible to stop anymore once it's started. In the best-case scenario they end up running for the wrong duration.unkala wrote:Messy as in hard for the designer to keep track of what he's using for what, or messy as in the game doesn't reset them properly and they start running for the wrong durations, or running but never firing?
A dialog, while not as accurate, responds much better to being started again and again.
Re: simple spawner question
I did it this way at first, but there seems to be a bug. The NPC does stop spawning when the cyclic timer is deactivated. However, it then respawns later, in a different place, and on a much longer timer.sidusar wrote:I would do this by making a cyclic timer that goes off every second and activates the NPC every time it goes off. That way the NPC respawns right after the corpse disappears. If you need it to respawn right after death, add an "<NPC> deactives" event to it's death as Unkala said.
Then, make the object interaction deactivate the timer, so that it stops triggering the NPC spawn. (And ofcourse, uncheck the NPC's "autorespawn" so that it doesn't spawn on it's own.)
So I'm gonna try some of the other ideas here, thanks!
edit: ok, this method works fine.
I set up a route to take, so the mob is going to attack some other NPC's I have standing around. The first invocation works fine, the mob spawns, and runs the route into the NPC's and gets killed. Then the mob respawns, and then runs the route into the NPC's, but HAS NO AGGRO. I can kill him with no aggro either.
So I tried adding some "can attack NPC's" and "can attack player" but then the mob WON'T RUN THE ROUTE.
This seems very buggy to me (been a programmer for 30 years). I just want a mob to spawn, run the route, attack NPC's and get killed, then spawn, run the route, .......
Last edited by olepi on Sat Oct 11, 2008 3:49 am, edited 1 time in total.
2007 -- 30 years on the Net!
Re: simple spawner question
Did you remember to check the "NoRespawn" box on the NPC?olepi wrote:However, it then respawns later, in a different place, and on a much longer timer.
Everybody who makes Ring scenarios knows exactly what you mean. So totally random and non-intuitive when a scripted event works and when it doesn't....olepi wrote:This seems very buggy to me (been a programmer for 30 years). I just want a mob to spawn, run the route, attack NPC's and get killed, then spawn, run the route, .......