ID:155137
 
I was curious how use a verb to summon a item and then after a set amount of time the item would vanish from the players inventory
Wrath69 wrote:
I was curious how use a verb to summon a item and then after a set amount of time the item would vanish from the players inventory

Just use a proc which will be called by summoning an item. Then by using sleep(), you can easily set a time before an item vanishes/gets deleted etc.
In response to Hashir
Something like this:
mob/proc/summondelete()
new/obj/whatever(usr)//probably should take this out
sleep(600)
for(var/obj/whatever/O in usr)
if(O)
del(O)

Probably not the best way to do it but it works
In response to Dj dovis
No usr in procs.
In response to Dj dovis
That would cause errors if you pick up multiples of the same item.
obj/TimedDelete
name = "Time Deleted Item"
New()
spawn(600)
del(src)

mob/verb/CreateItem()
new/obj/TimedDelete(src)
In response to Dj dovis
The if(O) is unnecessary, for() already checks if it exists.
In response to Darker Legends
I figured it out