Hello !
I’m learning how to make an AI and I’m struggling to understand how to setup a communication between the State-Tree, Tasks, AI controller and Animation Blueprint…
My current system does the following :
My AI controller detect the player and set some basic informations as variables, such as, Player Location, Player Last Seen location, Player lost and so on…
It uses an ENUM to set the different logic states : Idle, Search, Attack…
My ABP for my NPC uses a state machine and retrieve the variables to enter the correct animation states.
My state tree get the logic states information
and start Tasks to do some actions.
example : If LogicState = Chase, then start Task “go to last seen player location”
The task will have the AI move to location system.
My Issue is for the shooting system :
If i make a task “Shoot” it would be practical to retrieve my NPC variables and do the shoot logic in the task directly, but the issue is that i think its Read only, and i cant set variables of the owner NPC from the task, which makes it annoying to start the proper animation in my “ABP State Machine”.
I would need the task to do a part of the shooting logic, and still have setting variables inside my AI Controller, which splits the logic and make it super confusing to debug.
This makes the State machine useless in this case.
When i use the “State Tree” Tasks to move my character its fine, because the “ai move to” sends info to the NPC to move, and the ABP retrieve the velocity and direction to start the proper animation.
But when i need a shooting animation, i need a “Is Shooting” bool to be set to TRUE in the AI Controller to start the proper animation.
How would you set a proper communication between State Tree Tasks and the ABP ?