ID:148273
 
Ok here is the that makes everything happen. With what I have here so far it deletes the corpse along with the src.mob. I've also had it to where it will call the Dead() proc and sleep(500) with the original src overlaying the corpse. Can someone find a way to make it so the src is deleted right away but getloc is preserved to where it will create a corpse in it's place and then delete itself after a sleep(500)???

Dead(mob/mon/D) // Monster Dead
D.dead = 1
var/getloc = D.loc
switch(D.deathpic)
if("blob_green")
del(D)
new/dead/blobs/green(getloc)
spawn()
..()

-------------------------
// Dead Bodies
dead
parent_type = /obj
icon = 'monster.dmi'
New()
DeathSleep()
return
blobs
name = "Dead Blob"
green
icon_state = "blob_green_death"
proc
DeathSleep()
set background = 1
sleep(500)
del src
return
I'm not sure if I completely understand, but this would probably work;
proc
Death(mob/monster/TheMob)
var/obj/cadavres/TheCorpse = new TheMob.corpse(TheMob.loc)
spawn(500)
del(TheCorpse)
mob/monster
var/corpse
Goblin
corpse = "/obj/cadavres/Dead_Goblin"
obj/cadavres
Dead_Goblin/icon='DeadGoblin.dmi'


By the way -- I'm back from Mississippi. :)

~>Volte
In response to Volte
Dead(mob/mon/D) // Monster Dead
D.dead = 1
var/getloc = D.loc
switch(D.deathpic)
if("blob_green")
var/P = new/dead/blobs/green(getloc)
spawn(500)
del(P)
del(D)

----------------------------------
It seems when this runs.. it works for placing a corpse, but the del(P) never works. Any ideas??? It just stays there...

LJR
In response to LordJR
I believe any running procs that originate from an object are canceled when that object is deleted. That means the spawn is canceled as well. What you should do is modify the New() proc for the corpse to contian the spawn-delete code.

By the way, Volte has a better idea for how to determine which corpse is needed. Instead of storing a massive switch statement containing all the possible corpse types, just use a single variable that holds the object type you want to be created.

<code>mob/goblin var/corpse = /obj/corpse/goblin proc/Die() new corpse(src.loc) del(src) obj/corpse New() spawn(500) del(src)</code>
In response to Foomer
Aye, that makes sense.. I'll have to wait till I can get home tomorrow morning to test the code. Thanks for the suggestion. This mystery just may be solved yet!

LJR P-)