I am working on a project and having trouble with the AI. Because the person who was doing the coding left a while ago, the other people and I who are working on this project are going through and recoding everything, as we are not coders and he had his own way of coding in C++. So we are trying to remake the code in Blueprints, but we have been running into some issues.
The game has an enemy spotting system where, when the enemy fully spots a player, it chases after them. But the problem is that it isn’t chasing the player. I have been following tutorials and videos to create the code. But despite copying the code from the videos, the AI doesn’t chase the player and doesn’t go into the state tree like it is supposed to. But if the AI takes damage, it works properly. Does anyone have any ideas about what could be the problem? I am at my wits’ end trying to fix this.
If it chases on damage, it sounds like it might not be seeing player, or the perception update isn’t telling state tree when it sees player. First thing I’d test is to find the section of blueprint in the ai controller where sight and damage senses are processed, and throw in a print string just after where it would see player, and hit play then see if it prints.If it’s not seeing player, doublecheck the player char blueprint to see if it’s setup to be seen. If using perception system, make sure player has a perception stimuli source comp, and that it’s registered for sight, damage, and hearing if you plan any noise mechanics.
If it is seeing player, check the logic sending the info to state tree. If sending an event to tree, doublecheck the tag. I’ve broken many ai controllers in the past with a simple typo in event tags. If seeing player just sets a bool on the AIC, check the binding to it in the relevant enter/leave condtions in the state tree.