how to get backpack owner?

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Ispa
New User
Posts: 16
Joined: Sun Sep 20, 2009 12:30 pm

how to get backpack owner?

Post by Ispa »

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);)
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Re: how to get backpack owner?

Post by CWO »

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.
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am

Re: how to get backpack owner?

Post by xeon »

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.
Ispa
New User
Posts: 16
Joined: Sun Sep 20, 2009 12:30 pm

Re: how to get backpack owner?

Post by Ispa »

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 :) thank you alll
Post Reply