ID:158835
 
obj/health
density=1
icon = 'Orbs.dmi'
icon_state="heathorbs2"
Bumped(atom/movable/a)
if(ismob(a))
var/mob/M = a
M.Mhealth+=3*usr.level
if(M.Mhealth>=M.Mmaxhealth)
M.Mhealth=M.Mmaxhealth
del(src)



I want to find a way too make these orbs kill themselves 40 seconds after they are spawned.
On New(), when the obj is created, spawn() a del instruction to delete the obj after the time you want (look up spawn()).
In response to Kaioken
 New()
Spawn(60)
del(src)


would be the code?
In response to KeyWielder000
KeyWielder000 wrote:
>  New()
> Spawn(60)
> del(src)
>
>

would be the code?

wrong sir, wrong. You have to tell the code what to do after 60 ticks (60 ticks = 6 Seconds, in that code of yours).

New()
spawn(60)
del src
world << "6 Seconds from now, this mob will be deleted"
..()


Or, optionally...

the unpreferred Method

New()
..()
world << "6 Seconds from now, this mob will be deleted"
sleep(60)
del src
In response to KeyWielder000
spawn() isn't sleep(), but they both make delays in 1/10th of a second. spawn() however, has its own code block where the code in it is run along with the rest of the proc it's in.
New()
spawn(600)del(src)
//spawn(60) is 6 seconds. 600 is 60 seconds, a minute.
//del(src) can be on the same line because it's a code block. Just like an if(), else, while, etc.