Deathcheck()
if(attackable==1)
if(mob==1)
if(src.hp <= 0)
view() << "[src] dies!"
src.hp = maxhp
src.Move(locate(5,14,1))
usr.hp += 1
usr.str += 1
usr.def += 1
else
if(src.hp<=0)
view()<<"[src] dies!"
usr.hp+=1
usr.str+=1
usr.def+=1
usr<<"You gain 1 hp!"
usr<<"You gain 1 Strength!"
usr<<"You gain 1 Defence!"
del(src)
src.New(locate(5,14,1))
else
usr<<"You can't attack [src]!"
return
Problem description:</b
the problem is that when i kill the npc, after waiting, he doesnt respawn.. please help.
Searching the forum for "deathcheck" will probaby result in about five to ten thousand very good examples of the proc (and some bad ones, but you can tell those are bad because there will be responses saying "that is bad").
As for your respawning problem, your first issue is that New() is not a proc that you should be calling. To create a new object, you use the new() command, like so:
new /obj/thingy(loc)
If you wish to create something of the same type, then you can use:
new src.type(loc)
Second, the line before it: del(src) will always end the current proc (unless you've played silly buggers with the variable). The object is deleted and so all of its procs end as well (hence, you get no "src does not exist" errors when they attempt to continue). In order to circumvent this, the simplest thing to do is to move del(src) to the last line. Another alternative is to call an external proc like so:
This allows the respawn to not be instant.