ID:157316
 
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.
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.
In response to Garthor
Thanks. Is there a way to do it when something is destroyed, make a new thing appear in it's place?
In response to Blafblabla
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)
In response to Emasym
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.
In response to F0lak
Didn't you read my second post? I want to spawn a different mob when the first one is killed.
In response to Blafblabla
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 ;>
In response to Emasym
Yes, but how do I make the new one?
In response to Blafblabla
//Making a random new obj

obj/One
Del()
loc=null // Technically delete it
sleep(600) // Wait 1 min
var/NewObjPath = pick(text2path("/obj/Two"),text2path("/obj/Three")) // Make either object Two or Three
new NewObjPath(initial(loc)) // Place it on the original loc of Object One
..() // Delete src


Just to give an idea
In response to Emasym
Thanks, so,

obj/thing
loc = null
proc/new_thing()
var/New_Thing = text2path("/obj/thing2")
new/New_thing(initial(loc))


?
In response to F0lak
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.
In response to Blafblabla
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)
new /obj/thing2(loc)
// In your snippet of code, you're using initial(loc), which will also give a compiler error,
because loc is not defined there.

The initial(loc) in my snippet targetted obj One's original location
In response to Yurokei
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.
In response to Emasym
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?
In response to Blafblabla
In response to Emasym
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?
In response to Blafblabla
... It's in the Del() proc of obj One. So I'm considering it's very easy to implement, seeing you've just got to call del() on it.

del(obj)


Whazzam