yanecc Posted August 3, 2024 Share Posted August 3, 2024 (edited) 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 August 3, 2024 by yanecc Link to comment https://forums.kleientertainment.com/forums/topic/158834-methods-to-get-the-owner-of-an-item-what-are-their-differences/ Share on other sites More sharing options...
grm9 Posted August 3, 2024 Share Posted August 3, 2024 (edited) 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 August 3, 2024 by grm9 1 Link to comment https://forums.kleientertainment.com/forums/topic/158834-methods-to-get-the-owner-of-an-item-what-are-their-differences/#findComment-1738920 Share on other sites More sharing options...
yanecc Posted August 3, 2024 Author Share Posted August 3, 2024 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. Link to comment https://forums.kleientertainment.com/forums/topic/158834-methods-to-get-the-owner-of-an-item-what-are-their-differences/#findComment-1738922 Share on other sites More sharing options...
_zwb Posted August 4, 2024 Share Posted August 4, 2024 entity:SetParent()是用来跟随实体的 与物品栏交互无关 1 Link to comment https://forums.kleientertainment.com/forums/topic/158834-methods-to-get-the-owner-of-an-item-what-are-their-differences/#findComment-1739107 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now