Okay so i went to the AI Blueprint and made the set up for what i wanted and then called the event after the “AI move to” node but it still doesnt work
I wouldn’t run this on tick, also if you put the attack event after “on success” pin you may get better results, as is, it will fire tumultuous with the move and void out as you’ll likely not be within range of the player. Things like this, in my opinion are better setup using a behavior tree in the AI. That has its issues of its own. But in order to run this all in the BP your going to need a chain of events, that call each other after completion. Like I said running this on tick is somewhat poor optimization and will cause lots of little issues
There are multiple reasons why its not getting called,
- The Destination in “AI Move To” is 0,0,0 which will make AI move to that location, now your function may get called but montage wont play bcuz you are comparing the distance with the controlled pawn.
- You calling this on event tick, and event tick gets called every frame which might bug this out.
- The controlled pawn’s location that you are subtracting with the actor’s location there’s a chance both are same values.
What you can do now is get the location of actual target by doing a trace or overlap check with a sphere, you can set the sphere radius or trace length same as ur attack range and whenever the condition is true i.e player overlapped with collision sphere or the trace detected player you can play your montage.
For your case Behaviour Trees would be best and simple