ID:172154
 
Ok im trying to get this obj to respawn and it doesnt why?
obj/Gettable/RespawnCreate
icon='Getables.dmi'
icon_state="Crate"
Get(mob/M)
var/Objloc=loc
if(M.Sup >= M.MaxSup)
return
else
M.Sup +=30
M.SupRefresh()
if(M.Sup >= M.MaxSup)
M.Sup=M.MaxSup
M.SupRefresh()
else
M.SupRefresh()
spawn(50)new/obj/Gettable/RespawnCreate(Objloc)
del(src)
del(src)

That stops all of src's procedures, including anything you've spawn()ed off.
1) You didnt define "get" as a proc.
2) Shouldn't var/objloc=loc be var/objloc = src.loc or something?
3) You don't even NEED the respawn because the item itself never gets deleted until after the new one is made.
4) Your coding confuses me in general. What does the crate do?
In response to FireEmblem
FireEmblem wrote:
1) You didnt define "get" as a proc.


2) Shouldn't var/objloc=loc be var/objloc = src.loc or something?

even if i put src.loc it doesnt work

3) You don't even NEED the respawn because the item itself never gets deleted until after the new one is made.

this isnt true cause spawning doesnt halt the proc it will be deleted before the recreate would happen but like Garthor said as soon as del(src) is called it kills the spawn

4) Your coding confuses me in general. What does the crate do?
refills your supplies



<edit>
In response to Brokenleg
You only answered 2 of them,
In response to FireEmblem
FireEmblem wrote:
1) You didnt define "get" as a proc.

You're right. He did, however, define "Get" as a proc.

2) Shouldn't var/objloc=loc be var/objloc = src.loc or something?

Nope.

3) You don't even NEED the respawn because the item itself never gets deleted until after the new one is made.

Nope.

4) Your coding confuses me in general. What does the crate do?

It adds to a variable.

<font color=red size=7>F</font>
In response to Garthor
Garthor or anyone else could you send me in the right direction to go about making my obj respawn.Would i need a seperate proc to respawn my obj?
In response to Brokenleg
The best solution would be never to actually delete it, and simply move it to null (loc = null), then move it back. Then do if(loc) at the start of the verbs, just in case someone manages to queue up some verbs.
In response to Garthor
Thank you thats a great idea Garthor much appreciated