We just started using the asset and love it so far! However we can’t figure out how best to use FSM subgraphs. Our game will have a lot of enemies that are very similar to each other, especially the AI behavior. For example most of the enemies will have an Idle and Aggro state, the Aggro state usually will consist of a Telegraph, Attack, and Cooldown state, etc. It seemed logical to create sub FSM graphs so these can be easily re-used or swapped out when needed. The problem however is that if I’m not mistaken transitions between subgraphs happen regardless of subgraph state. So for example lets say we have an enemy that’s attack is to ram the player, but if the player dodges the attack the enemy waits for the cooldown and attacks again if the player is still visible or goes to Idle state. In this case we want the enemy to stay inside the Aggro and Cooldown state even if the player is not visible any more and only transition to Idle after finished with the Cooldown state. But if the condition on the Aggro -> Idle transition is that the player is not visible the enemy will immediately stop what it’s doing and go to Idle.
As we are pretty new to this asset our approach can be totally wrong, could you maybe provide an example how these setups should be achieved?
Just to clarify based on your information; is the goal here to limit when parent FSM state transitions can take place, based on the current SubGraph state? Something like a condition (which you will be able to add on the transition), to check the current SubGraph state and status?
Yes, the goal would be to what you described. My first idea was to instead of directly checking player visibility in the transition condition of the parent graph I introduce a BB variable to store player visibility that I only update in the subgraphs at specific points and use that variable as the condition of the parent graphs transition, but I was wondering if there was a better way.
Hello again and sorry for the late reply due to August.
We could make a Condition Task that is checking the current sub-fsm state NAME (thus a name will have to be given), which will evaluate to true only if the current sub-fsm is at the state name given. Would something like this work for you?