Check if an actor in an array's class is equal
Hi all, so I have an array of actors which represent the player's inventory.
In this case, I have a key actor in the inventory.
When I get close to a lock blueprint, I want it to check the player's inventory (which I can successfully access using casting) if there are any actors that are part of the key class.
How do I do this last part?
asked Feb 28 '15 at 06:27 PM in Blueprint Scripting
Try iterating through each element in the inventory array (ForEach node) and try casting each element into a Key blueprint. If the Cast node returns IsValid, then the actor is a Key.
If the inventory was large, I'd probably save a reference or an index to the key(s) in a separate array outside the inventory. Much easier to query.
answered Feb 28 '15 at 07:52 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here