Creating a custom variable type to store a 'state'

NOTE: I’ve posted this question in the blueprint scripting and C++ programming as I’m not sure which would give me the solution.

Hi,

I’m want to create variable that I can easily use to check what ‘mode’ an AI is in. I.e is it jumping, moving, hiding, attacking etc. Right now the way I’d do it is have a bool for each of these individually which would get messy. Was wondering if there’s a way to create a custom variable with custom values that I could set and unset.

So a variable I could get and set to the value: jumping. Then in another function, for example, the check would be ‘does state/mode = jumping’ etc

Thanks,

Jack

You are looking for what is known as an ENUM (aka Enumerator), take a look at this:

https://wiki.unrealengine.com/Enums_For_Both_C%2B%2B_and_BP

Thanks, that’s great.