Deprecated: Assigning the return value of new by reference is deprecated in /home/forums/public_html/includes/init.php on line 43

Deprecated: Assigning the return value of new by reference is deprecated in /home/forums/public_html/includes/init.php on line 82

Deprecated: Assigning the return value of new by reference is deprecated in /home/forums/public_html/includes/init.php on line 86

Deprecated: Assigning the return value of new by reference is deprecated in /home/forums/public_html/includes/init.php on line 98

Deprecated: Assigning the return value of new by reference is deprecated in /home/forums/public_html/includes/init.php on line 102

Deprecated: Assigning the return value of new by reference is deprecated in /home/forums/public_html/includes/init.php on line 172

Deprecated: Assigning the return value of new by reference is deprecated in /home/forums/public_html/includes/init.php on line 371

Deprecated: Assigning the return value of new by reference is deprecated in /home/forums/public_html/includes/class_core.php on line 2291

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/forums/public_html/includes/class_core.php on line 1489
Ryzom - simple spawner question
Ryzom

Ryzom (http://forums.ryzom.com/index.php)
-   The Ryzom Ring (http://forums.ryzom.com/forumdisplay.php?f=99)
-   -   simple spawner question (http://forums.ryzom.com/showthread.php?t=32979)

olepi October 10th, 2008 03:18 AM

simple spawner question
 
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?

unkala October 10th, 2008 12:30 PM

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.)

sidusar October 10th, 2008 07:30 PM

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. :)

Quote:

Originally Posted by unkala
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 wouldn't do this though. In my experience, timers that get repeatedly started, triggered, stopped, and started again... well, they get messy. :o

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.

unkala October 10th, 2008 10:00 PM

Re: simple spawner question
 
Quote:

Originally Posted by sidusar
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

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.

Quote:

Unkala's method probably works too though.
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.

Quote:

I wouldn't do this though. In my experience, timers that get repeatedly started, triggered, stopped, and started again... well, they get messy. :o
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?

Using a dialogue as a substitute timer instead of an actual timer doesn't sound like a good way to avoid confusion...

sidusar October 10th, 2008 11:38 PM

Re: simple spawner question
 
Quote:

Originally Posted by unkala
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.

True, that's why it's only usuable for an instant-after-corpse-gone respawn, which is what the OP seemed to want here. :)

If you want a longer respawn delay, you'll have to use the dialog delay and let the scenery interaction deactivate the dialog.

Quote:

Originally Posted by unkala
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?

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. :rolleyes:

A dialog, while not as accurate, responds much better to being started again and again.

olepi October 11th, 2008 05:02 AM

Re: simple spawner question
 
Quote:

Originally Posted by sidusar
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.)



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.

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, .......

sidusar October 11th, 2008 12:16 PM

Re: simple spawner question
 
Quote:

Originally Posted by olepi
However, it then respawns later, in a different place, and on a much longer timer.

Did you remember to check the "NoRespawn" box on the NPC?

Quote:

Originally Posted by olepi
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, .......

Everybody who makes Ring scenarios knows exactly what you mean. :p So totally random and non-intuitive when a scripted event works and when it doesn't....


All times are GMT +2. The time now is 04:00 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Ryzom forums are part of the SoR service and subject to the EULA and Code of Conduct.