I’m trying to switch between two infinite loops (states) using an enumeration and a switch statement.
My goal is to spawn numerous pawns and have them follow the main character, which is working fine. When I try to switch to another state (moving to a target location based on where the mouse is) by pressing the “f” key, only one pawn tries to move to that position instead of all the pawns. Also the one pawn seems to be glitching between moving to the new target position and following the main character.
How do I run each of these states infinitely until another button is pressed and change the state of ALL pawns, not just one?
Ok, I went ahead and learned about State Trees and I have it mostly figured out except for the state transition portion. I am not able to detect a key press when in the evaluation blueprint so I created 2 booleans in my AI Controller and set them as outputs. I then used a get function in the Evaluation Blueprint so I can use the variable to transition into the next state. The problem is, while the output variable is changing in the AI Controller blueprint, it’s not updating in the Evaluation Blueprint, so it never transitions to the next state.
Update, looks like I AM getting a true value in the evaluation blueprint. So my question is, why is it not transitioning to the “Move” state shown in the State Tree in the previous post?
I would separate the two things. Create something that says the button has been pressed (e.g. a Boolean in the Player Controller) and then use the “State Tree Evaluator” functionality to check the state of that variable and instruct the state tree to change state.