5.4 smart objects: How to check if another handle is claimed?

Greetings,
I want to have two NPC interact very basically. I want a shopkeeper to stay at the cash register unless the player grab its attention. While it’s at the cash register, other NPC clients can come and interact with the cashier to buy their product then leave.
To that extent, I made a smart object with two handles: The shopkeeper and the client. Having the shopkeeper working the register is not an issue. I can find and use the handle without too much troubles. My trouble is that I don’t know how to know if the other handle is occupied. I don’t know how to find the right handle (there are multiple cash registers for multiple shops so I am not sure how to select the right one, find the right handle and check if it’s taken) How can I do that?


I think there isn’t a way to know if it is occupied in Blueprint. Unless you would edit engine code yourself. But the system behind it knows if it is occupied or not.

What you can do is first add user tags to the slot, so when you are calling “FindSmartObjects” you can filter them out based on both User Tags and Activity tags.

Then you need to call “MarkSmartObjectSlotAsClaimed”, check if the returned ClaimHandle is valid, and right after that call “MarkSmartObjectSlotAsOccupied”. This I believe locks the slot to the NPC that claimed it. Then you can use the slot as you see fit.

When the NPC is no longer using it, call “MarkSmartObjectSlotAsFree”, so other NPCs can claim and occupy it again.

This worked for me in a project I’m making.

Hope this helps.