How do I get the number of sphere trace / hits?

is there anyway I can get how many numbers of traced hits on my actor?
basically what I want is, after the enemy actor attack the player 3 times (3 times line trace hits player) and output a different animation.


1 Like

sure. you can use an integer variable to count virtually anything in the game.

On the ForEachHit loop, check if it was a blocking hit, and if true, incrememnt an integer variable. This will be the number of hits.

At some point you would want to reset the variable to 0, of course, but when to do that will depend on your game specifics.

To easily incrememnt an integer, drag off the variables pin and type ++. That is a shorthand node which adds 1 to the integer and then sets it.

it works! thank you so much!