ID:178682
 
shootp()
set name = "Shoot - Pistol"
if(usr.Pistol == 1)
set src in view(5)
del(src)
usr << "You shoot the thug. He clutches his chest and falls to the ground"
new /obj/thug1corpse(src.loc)
return ..()

The obj is deleted but the corpse isnt created.


help plz, thx.
Akarat wrote:
shootp()
set name = "Shoot - Pistol"
if(usr.Pistol == 1)
set src in view(5)
del(src)
usr << "You shoot the thug. He clutches his chest and falls to the ground"
new /obj/thug1corpse(src.loc)
return ..()


del(src) halts the proc, move the del(src) part to after where you create the corpse.
When you delete an object(not an obj, mind you) all procedures currently running are terminated. Solution: Delete the object at the very end.

Alathon
In response to Nadrew
still doesnt work and it looks like this now
shootp()
set name = "Shoot - Pistol"
if(usr.Pistol == 1)
set src in view(5)
del(src)
usr << "The thug falls to the ground in a bloody heap. You killed a member of the Mob D gang - boy your in for it now!"
new /obj/thug1corpse(src.loc)
del(src)
return ..()

In response to Akarat
oh i forgot to remove the 1st del(src) i get it now
thx for your help.
One other thing you may find helpful: Create a corpse based on the icon of the thing you kill, so you only need a single corpse class instead of thug1corpse, thug2corpse, etc.:
obj/corpse
New(atom/newloc,atom/body)
icon=body.icon
icon_state="corpse" // have a "corpse" icon state in your icon file
name="[body.name]'s corpse"
src.contents+=body.contents // what's in its pockets?
// don't forget to copy over money and other important vars
..() // move to newloc
spawn(600) Decay()

Decay()
for(var/mob/M in oview(10,src))
if(M.client)
spawn(100) Decay()
return // don't decay in sight of a player
// drop everything; add in lines to drop money and such if you use vars for it
loc.contents+=src.contents
del(src)

verb/Search()
set src in oview(1)
if(!contents.len)
// if the corpse carries money, include that in the if()
// like: if(!contents.len && !money)
usr << "You find nothing."
return
// I'd put in code to list what you find, but you can
// do that yourself
usr.contents+=src.contents
// don't forget to add to money and other vars if they exist
usr << "You raid [src]."

Now when you create a corpse for the src object, all you have to do is this:
new /obj/corpse(src.loc,src)

Lummox JR