I can't figure out how to get the new proc working to spawn a mob again once it's killed. So, say someone kills a mob. 60 seconds later it spawns again.
Any help?
Thanks in advance.
ID:157316
![]() Apr 1 2010, 11:06 pm
|
|
![]() Apr 2 2010, 12:32 am
|
|
This wouldn't really involve New() at all. When you kill a mob, call a proc that does not belong to the mob (as if the proc belonged to the mob, it'd stop when the mob is deleted) to create a new mob.
|
No reason to call a proc to do so, or make a new mob. Reset the mob's health to the max health (I'm assuming you have those variables), and locate it to null somewhere. Then after a while, locate it to initial(loc) (initial() is a proc that gets the value of the initial variable when the atom came to be)
|
Emasym wrote:
orig(loc) (orig() is a proc that gets the value of the original variable when the atom came to be) Actually, it's initial(), not orig(). But yeah, rather than deleting and spawning a new mob, I find it easier to null the loc of the NPC when killed, sleep(600), and then use loc = initial(loc) to respawn it. Edit: Make sure to deactivate his AI when his location is null. |
Well then, save the location on which it was killed, and call a proc to make something new on that location after a while.
And yeah thanks F0lak, got a bit lost there. initial, orig, all the same ;> |
//Making a random new obj Just to give an idea |
Thanks, so,
obj/thing ? |
I actually really like that idea. If a person is making a game that involves quite a few killable mobs, would this system work better than using the default repop? Better as in saving usage and decreasing lag.
|
Not really. Well, I'm still unsure what you exactly want.
In my snippet of code, upon deleting obj One, a new obj Two or Three is created on the loc One used to be. Your piece of code has an object thing, with a location set (which should give a compiler error, I believe?), and you've made a proc that can be simplified to proc/new_thing(loc) |
Yurokei wrote:
I actually really like that idea. If a person is making a game that involves quite a few killable mobs, would this system work better than using the default repop? Better as in saving usage and decreasing lag. Yes, it would. On death, locate it to nowhere, then set it back. As long as you don't let the AI loop run while it's "dead", it'll save some resources. Not much, but everything counts. |
This is exactly what I'm trying to do:
They destroy an object. Another, object appears in its place. How would I go about doing this? |
Yes but how do I do that? This is the question I was trying to get the answer to at the start. How do I make a new thing in the same location?
|