ID:148852
 
i'm having an error making a proc,that happens upon death,which drops all objects (and destroys undroppable ones) (okay okay,2 errors!)

here's the code:
mob/proc/dropdeath()
var/obj/O
for(O in usr)
if(O.Move(usr.loc))
usr.weight-=O.weight
usr.addedweight-=O.weight
else
usr << "Upon death,[O] got destroyed!"
del(O)

and here are the problems:
Combat.dm:92:error:O.weight:undefined var
Combat.dm:93:error:O.weight:undefined var

edit:forgot to write a topic ^_^;
weight needs to be defined under both object and mob.
Since this is a mob proc, and probably belongs to whatever's dying, you should be using src instead of usr. Rule of thumb: Don't use usr in procs.

Lummox JR
In response to Skysaw
Yeah, that, or have it /obj/O instead of just O. A mob can be in another mob's contents.
In response to Garthor
Garthor wrote:
Yeah, that, or have it /obj/O instead of just O. A mob can be in another mob's contents.

It already was /obj/O

Another thing I noticed is that weight was not being subtracted from the user for items that got deleted. Eventually the players won't be able to carry anything at all.

Of course since every object is either dropped or deleted, it would be a lot simpler to just set the mob's current carried weight to zero after death.
In response to Skysaw
Oh, didn't notice the var/obj/O...