ID:164678
 
    CrownsB
icon='Items.dmi'
icon_state="Crowns"
name="Crowns"
amount=0
New()
amount+=round(rand(2,10))
name="[amount] Crowns"




I've tried using sleep(1200) and it works, but I'm not sure how to use the del() function to make it delete itself. Any help is appreciated!
del src
In response to Jp
Eh, it works, yet when I start killing rats, I get massive amounts of messages saying I killed it before it's teleported like the code tells it to be. Should I post all the relevant code of the rats?
In response to Michael3131
obj/blah/blah...
spawn(TIME)
ACTIONS
In response to Michael3131
What do you mean, rats being teleported?
I thought we were deleting an obj 1200 ticks after it is created.
In response to Keeth
We are! This is my death_check proc:

    proc/death_check(mob/M as mob)//handles death
if(src.hp <= 0)
M <<"You killed [src]!"
if(src.client)
src <<"[M] killed you!"
src.loc = locate(49,266,1)
src.hp = src.maxhp
src.canbuild = 0
else
// var/YIN=rand(1,10)
var/BYIN=rand(25,100)
if(src.GOOGLEPLEX==0)
new /Items/CrownsB(src.loc)
src.loc=locate(0,0,0)
if(ismob(M))
if(src.GOOGLEPLEX==1)
M.crowns+=BYIN
M.contents+=new/Items/Frog_Head
M<<"Congratulations! You got the Frog Head from the Evil Frog!!"
world<<"<b>[M] has killed the Evil Frog!</b>"
usr << "You feel quesy as you are teleported to the spawn area."
M.loc = locate(49,266,1)
usr.hp=usr.maxhp
// else
// new /Items/CrownsB(src.loc)
sleep(1200)
src.loc=locate(src.sx,src.sy,src.sz)
src.hp=src.maxhp


As you can see, when the mob is 'killed' it spawns a CrownsB. I believe the sleep(12) then del(src) is interferring with the timing in which the mob teleports.