I have a small problem regarding the death of my character.
I have a blueprint (which is a ground trap) with a box collision that inflicts damage on the character. I have a second blueprint (identical to the first) which corresponds to a monster which pursues the character.
If the life points reach 0, the character dies and an animation plays. The problem is that if the character dies in the blueprint of the trap which therefore triggers the animation and if the monster then arrives, the death animation is played a second time.
Okay, so I usually do NOT play an animation. I’ll use a montage, instead. You have greater control over montages than animations.
You’ll create a Boolean that tests for if the animation montage is playing. Then it will IMMEDIATELY set the condition from FALSE to TRUE, preventing any replays of the animation.
You can use a sequence to circumvent the fact that the animation node requires the animation to come to a FULL END before allowing you to proceed to reset a variable. You can add a delay before setting the variable back, depending on your needs.
I tested the first and it works but the problem is that it works in the blueprint of the box collision. In this blueprint, I initialize the number of damage. So I can’t add that to the sequel otherwise the character would die each time without taking into account the damage figure of the box.
I understand custom events well, I have already used them in other blueprints like here to play a sequence when the correct answer is validated for a riddle.
Here in my character it is my damage function which checks the character’s life points and if the points are at 0 the character dies and displays a widget.
Then, my function I used a “Get all actor of class” node to retrieve the 2 events (the montage and the menu) but there it doesn’t work. The montage is not played and the menu is not displayed.
If “Delgats_Lave” and “Mort_Lave” are in the same Blueprint, you don’t need to get actor of class. I think you know this already.
Anyway, I’m going to say this again, place PRINT_STRING nodes at the end of all of the functions. You need to track down what is firing and what is not.
Replace the text with whatever you want.
If all of the text gets printed, then let me know.
If not, then there’s an issue with one of your references.