Jump to content

Recommended Posts

I have found several frequently used methods for indicating the owner of an equipment or entities that can be placed in characters' inventory.

These methods seem identical for entities in the inventory, so I would like to find out their use cases and if there are any differences.

inst.owner
inst.entity:GetParent()
inst.components.inventoryitem.owner
inst.components.inventoryitem:GetGrandOwner()

 

Edited by yanecc

inventoryitem.owner's the 1st owner of the item, so if the item's in a back pack that you got equipped, it'll return the back pack, but inventoryitem:GetGrandOwner()'ll return you, no idea about the other 2 though, never seen them get used for getting an inventory item owner

Edited by grm9
  • Thanks 1

I learn that inst.entity:GetParent() is mainly used on the client side, while inst.owner typically appears in official prefabs like:

function(inst, owner, ...)
     inst.owner = owner
end

However, it's puzzling that directly using inst.owner in a mod's prefab without assignment also seems to work.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...