Problem with refactoring

Hi
So i’m busy with making a basic RPG game in UE5 with C++ where the enemy should start patrolling first then when it detects the main character it shuld chase it and then attack and if the main character gets too far then it should stop chasing it and get back to patrolling. I’ve done refactoring to my code to have less code and make it easier to read and then i’ve started having some problems. So after the enemy detects the main character it chases it but instead of attacking only once(i’ve setup an attack montage with 3 different attack animations) it attacks 3 times and after which it either freezes or if i move the main character out of chasing range instead of patrolling it keeps sliding to the patrol targets!
Here’s the link to my github repository where you can find all the code:

and here’s a video of the problem:

I’ve tried debugging myself but since i’m a beginner programmer i could only figure out that i needed to remove ClearAttackTimer(); from my code but still i have some problems with it! Any help would be appreciated.

Privacy & Terms