how to get backpack owner?
how to get backpack owner?
if i put an item inside a character backpack is there any way to link character just knowing the item reference? (i.e. something like GetOwner(item.container);)
Re: how to get backpack owner?
I think I've always in that situation used item.container.container.
The container the item is in being the backpack and the container the backpack is in being the character.
The container the item is in being the backpack and the container the backpack is in being the character.
Re: how to get backpack owner?
I've done a simple library function which recursively goes up till .container is Error.
Make sure to handle correctly the various situations anyway...item on the ground, item in backpack, item in a container on the floor.
Make sure to handle correctly the various situations anyway...item on the ground, item in backpack, item in a container on the floor.
Re: how to get backpack owner?
CWO wrote:I think I've always in that situation used item.container.container.
The container the item is in being the backpack and the container the backpack is in being the character.
i tried like this
var who := item.container.container;
but it doesn't work.
edit : ok now it works i made a loop while item exist each 5 sec it recalculates var who := item.container.container; so it work only when is contained in a backpack