ID:261308
 
I have a problem with repopulating the world after something has been destroyed or deleted or whatever you wanna say, here's what I have;

world
New()
spawn
while(1)
sleep(10)
Repop()
return ..()
This way, everything is put back on the mop, even objs! And I only want mobs to be put back So I tried this;


world
New()
spawn
while(mob in world)
sleep(10)
Repop()
return ..()
This doesnt repop ANYTHING at all. Can somone help me please?
Repop is very indescriminant. If you want to repop only mobs, you'll have to design your own code to do it and not rely on the built in Repop().

Here is something that should do the trick:

mob
var
beginning_location

New(Loc)
..()
if(Loc) beginning_location = Loc

Del()
RepopMob(type,beginning_location) // calls a global proc so it will run after the mob is deleted
..()

proc
RepopMob(mobtype,location)
spawn(10)
new mobtype(location)