ID:149477
 
Been thinking for awhile and drawing bad ideas. =/ I want my creatures to respawn without overpopulating and filling the area up. Can anyone get me started with how I would do this (code not necessary, just need an idea)?
Look up Repop().
In response to Super16
I don't want everything in the world to reappear at once, though.
In response to Gynax
Repop doesn't remake everything. Just obj mapped that have been destroyed so it is controlled.
In response to Super16
Yes, but I'm thinking it would be a bit heavy if everything dead were to respawn at once - pound you flat. Its not as controlled as I'd like it to be, unfortunately.
In response to Gynax
Then try something like this.

mob/Monster
var
startx
starty
startz
New()
..()
src.startx=src.x
src.starty=src.y
src.startz=src.z
proc
DeathCheck()//I make a monster spawn in deathcheck
if(src.health<=0)
new/mob/Monster(locate(src.startx,src.starty,src.startz))
del(src)
In response to Gynax
You might like to look at [link]
In response to Super16
Here's how I would do it:

turf/spawnpad
tickwait = 30
sofar = 0
mob/monster
world
Tick()
..()
for(spawnpad in world)
if(tickwait==sofar)
if(!mob in view())
/var/mob/monster/m = new(src)
sofar = 0
else
sofar += 1

of course, you'd probably set the tickwait to a bit higher, or maybe randomize it for each pad in New().

eg.

turf/spawnpad
New()
..()
tickwait = rand(15,45)
In response to Shadowdarke
I had always assumed that you couldn't do it that way because when you delete something it terminates all of its procs. I had done it using world.Remake(startloc) and used it in the same way you did.

That seems to have been a bad assumption :)

Anyway, I guess this boils down to a misunderstanding of how exactly spawn() works. I understand how to use spawn() but could you give a brief description of what exactly happens when spawn is called? Is it a special world proc so it will still be called even if the object it was called from is deleted?

[Edit]

I just noticed that Remake was a global proc (oops). So does this mean global procs are not terminated when the caller is deleted? Too many assumptions :p
In response to English
Right, all procs that belong to a datum are halted when it is deleted, even if they are spawned. You can prevent that by setting src = null before you call the proc, but I don't like to do that because it tends to confuse things when I look back over it.

Global procs however, are not halted because they belong to the world and not the caller. That's why I made Remake() a global proc. ;)
In response to Shadowdarke
That makes sense, thanks for the clarification :)