. . . Posted April 11, 2021 Share Posted April 11, 2021 is there a way to check if the player has a container opened and when the container prefab is? Link to comment https://forums.kleientertainment.com/forums/topic/128868-how-to-check-if-the-player-is-opening-a-container/ Share on other sites More sharing options...
penguin0616 Posted April 12, 2021 Share Posted April 12, 2021 2 hours ago, --- -.- said: is there a way to check if the player has a container opened I assume you're trying to check from the player object and not the container. The inventory component keeps tracks of all open containers in inventory.opencontainers So you could probably just check that. Maybe something like: for inst in pairs(player.components.inventory.opencontainers) do print(player, "has a container of prefab", inst.prefab, "open") end 2 hours ago, --- -.- said: when the container prefab is? Most, if not all components keep track of their instance in a "inst" field. So you can do -- assuming "container" is a container component print(container.inst.prefab) 2 Link to comment https://forums.kleientertainment.com/forums/topic/128868-how-to-check-if-the-player-is-opening-a-container/#findComment-1447694 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