ID:139842
 
Code:
src.loc = usr.contents


usr.contents += src


Problem description: I try to add an obj to a the mob(usr)'s inventory. However, while it does relocate the obj, it does not show up in their inventory, nor does it give the mob its verbs. The two examples above are two ways I have tried to get this to work, but with the same result. This is not a section of a proc, it is a section of a verb.

First of all, you need to code it that the item's location = usr. An example, you went to a shop, you bought that item so:
 item.loc = usr

And then you got to code the statpanel 'Inventory' right ofcourse, which is probably like this:
mob
Stat()
statpanel("Inventory")
stat("",contents)


Tell me if this works, if not, I'll take a look again.
I did this fast because I'm going to the bakery now.
So be right back.
In response to Raimo
I did have the inventory tab specified before, sorry for not mentioning it. But, it still doesn't show up.
In response to Koriami
Try to adjust ur inventory tab to the thing i gave you.
In response to Raimo
Well, I had basically the same thing. I had this
mob/Stat()
statpanel("Inventory")
stat("", contents)
..()
In response to Koriami
Try to use the other code snippet I gave you.
In response to Raimo
Still, the same result
In response to Koriami
Lol, this collaboration of you two is failing...

mob/Stat()
statpanel("Items",contents)

obj/whatever
icon = ''
icon_state = ""

mob/Login()
icon = ''
icon_state = ""
var/obj/whatever/W = new(usr)
..()

You are probably deleting the object after you move it.