ID:139536
 
Code:
obj
Bandit_Corpse
name = "Corpse"
icon = 'Mob_Bandit.dmi'
icon_state = "corpse"
density = 1
Click()
set src in oview(1)
set category = null
if(owner == usr.key)
var/Gems = rand(1,2)
if(Gems == 1)
usr.gold += 2
usr << "<b><font color = green><font size = -2>You looted 2 gal gems!"
if(Gems == 2)
usr.gold += 4
usr << "<b><font color = green><font size = -2>You looted 4 gal gems!"
var/Loot = rand(1,40)
if(Loot == 4)
usr.contents += new /obj/Clothes/Bandit_Suit
usr << "<b><font color = green><font size = -2><u>You looted a Bandit Robe!"
usr.UpdateInv()
del(src)
else
usr << "<b><font color = red><font size = -2>You did not kill this!"


Problem description:

Okay, currently the code posted above works fine...it's just that I've started to think that if the corpse were to never be looted the map may become littered with dead NPCs. How would I go about making a corpse system function to where if someone killed that NPC it was only there corpse to loot for a set period of time, and eventually over a set time be lootable by anyone?

Thank you for your time, and I would greatly appreciate it assistance with this.

Edit: Also, would there be a way to set a time limit to where the corpse would just delete itself?
obj
Bandit_Corpse
Click()
if(!owner) // -ALSO- allow the players to loot if the corpse foens't have an owner! We'll be using that to our advantage
New()
spawn(300)
owner = null
..()


Make it so that players can also loot dead bodies without owners.

Then, make it so that dead bodies lose their owner after a set amount of time.

:)