Hi! I’ve tried adding a “WhileLoop” after the rotation, with the condition basically being that I attack until AI health is <=0, but it just results in an infinite loop error or engine crash.
Any help or guidance is appreciated
Hi! I’ve tried adding a “WhileLoop” after the rotation, with the condition basically being that I attack until AI health is <=0, but it just results in an infinite loop error or engine crash.
Any help or guidance is appreciated
Have you tried calling the event directly from tick (this would not be performant) just to test if it works?
If it is working correctly, then try adding a collision sphere around your character to reach out to the range you want player to attack. Then, play your anim montage and deal damage when an object overlaps it (you could set up a custom collision channel just for this if you wish)
I’ve set it up with the tick and collision and it looks like it could/will work. But because of the tick, it’s only playing the first frame of my animation, so I can’t move or do anything else. Without the tick, it only plays the animation once, then I have to move away, come back, to retrigger the collision event.
Ty for your help so far.
Auto attack meaning, moving within range of the enemy and the montage looping until the enemy is dead. At the moment, with the event tick plugged it, it just plays the first frame of the montage constantly, with it out, it only plays the montage once.
I’ve attached a new screenshot. The event tick goes into the “Enter” on the gate.
Thanks.
I am not familiar with montages, BUT if you are running that on tick I am pretty sure it is trying to “Play” the montage from the start each frame hence even though it may be doing the rest of it underneath, it is constantly being asked to start a new montage each frame, so each frame it plays from the beginning. Maybe instead of “tick” use a timeline, that has a loop function built in, so you can set an event graph in the timeline and it will execute once every “X” seconds that you tell it to, so, determine the length of the montage and set that to the internal timeline length and tell it to loop.
Thank you! This is perfect and versatile for use with other interactions. Also, thank you to the others who replied, I took points from all 3 and now I have a better idea on how to improve a lot of my blueprints.
Hi. Instead of WhileLoop I will create Attack_Function that will hold all animation calling(you can call montage again once it finished playback) then use SetTimerByFunctionName (Attack_Function) in Character_BP to activate this function when conditions necessary for attack are true. Deactivate Timer if conditions are not true. Does this sound fit?
this is fine, this means that your setup is working. on event “begin overlap” of that collision sphere, play the animation with “looping” set in properties. then on event end overlap, stop playing the animation. if you want to check if the player that youre attacking is dead, add a branch before playing the animation checking a boolean if the enemy is alive or not (cast to enemy, get boolean (isalive) or something like that
Glad to hear you got it sorted, cheers