ID:166996
 
well, I'm trying to do this, but don't know how to.

Well, there is an object, which is a punching bag. I want to make it so, after a certain amount of hits, say 200, the bag will disappear, and be removed until someone repops world, something like that. But I don't know how to do it, any help will be appreciated. Thank you.
obj/Punhing_Bag
icon = 'PB.dmi'
icon_state = "PB"
density=1
verb/Punch()
var/Health=200
usr.PBcombat()


mob/proc/PBcombat(mob/M as mob in oview(1))
M.Health-=1
if(M.Health=1)
del(M)
else
..()
In response to Dragon_Fire6564
Ummm... What the? I have no idea what you think that'll do, but it won't work.

Basically, you just give the punching bag a 'number of uses' variable that tracks how many times it has been punched, and after a certain number, delete it and spawn() off a call to a procedure that makes a new bag in that location.
In response to Jp
I know this sounds dumb, but what would I put after del?

more like, how do I delete it, the object I mean.

this should help a bit:

obj
Log
icon = 'Objects.dmi'
icon_state = "log"
density = 1
verb
Hit()
set name = "Hit"
set category = "Training"
set src in oview(1)
if(usr.resting == 1)
usr<<"Not while resting."
if(usr.resting == 0)
if(usr.loghits >= 5)
usr.stamina -= rand(1,5)
usr.exp += rand(5,15)
usr.loghits = 0
usr << "The log has been hit too many times, and has cracked."
usr.Levelup()
else
if(usr.loghits <=200)
if(usr.stamina >= 0)
usr.stamina -= rand(1,5)
usr.exp += rand(5,15)
usr.loghits += 1
usr.Levelup()
else
if(usr.stamina <= 0)
usr << "You are out of stamina."
return


that's my coding so far.
In response to Chue
Chue the DM tags are there for a reason.