Behavior tree how to trigger hit animation?

Hi, i’m trying to code my basic AI behavior tree, i found a good epic youtube tutorial for behavior tree and so far i got my enemy to patrol, investigate follow player, attack player and die from the behavior tree.

Now i want to add hit animations for my enemies, i tried to use a selector checking if the blackboard key GetHit is Set it will run the hit animation and if it is not ser runs the normal sequences, i think the problem is that when the Get hit is changed to false the Behavior tree is taking the false as the variable was set and the animation is played when the enemy is not getting hit.

How can i validate this?, because i was thinking the blackboard condition ‘Is Set’ was for true and ‘Is not Set’ and for the action in game this is not right.

can somebody help me with this ? or point to me to a behavior tree tutorial that covers this topic ?

thanks in advance for all the help.

Hey enzoravo!

Can we see the inside of that custom task? SkeletonHit_BTT?

Also your Selector with GetHit=false is still going to trigger the Sequence with SkeletonHit_BTT after the Selector that has no variables on it because it runs left to right. You need to attach that Sequence to the spot above the picture, and give it a decorator that checks if GetHit is Set. :smiley:

Sure, here it is my SkeletonHit_BTT

i’m setting the get hit variable in the SkeletonController, like this

also this is the begin of the behavior tree, can you help me pointing me where do i need to put the decorator to make this working ?

thanks in advance for all the help.

1 Like

Sure enzo! Here you go!

Give that a try and let us know how it goes!

You will want to do the same to the death anim so it can’t accidentally go off :slight_smile:

2 Likes

thanks for the help, i will try it today and get back here with the feedback.

thank you again @Mind-Brain

Thank you very much @Mind-Brain worked like a charm!

Absolutely @enzoravo! If you have any more issues with your game, you know where to find us! Good luck!

1 Like