Stopping damage from a trigger volume
Hey, I'm trying to cause damage to the third person character. I have managed to get the trigger volume to cause damage infinitely whilst I am in it, I just need it to stop once I am out. Please help and thanks in advance.
asked Jan 20 '18 at 11:17 AM in Using UE4
Your problem is that you have a loop continuously applying the damage and, once started, there is no way to stop it. You need to change your approach.
For example, create a bApplyDamage boolean variable. Set its initial value to False.
From Event ActorBeginOverlap call a DoOnce, from it set the bApplyDamage variable to True, then call a WhileLoop that applies the damage and has a Delay at the end (like you did in yours). The WhileLoop must be controlled by the bApplyDamage variable, so as long as that variable is True it will continue to loop and to apply the damage.
Now create also an Event ActorEndOverlap. This event should set the bApplyDamage variable to False, then connect to the Reset Pin of the DoOnce.
In this way, when you exit the Trigger volume, you stop applying the damage and reset the DoOnce in case the player would enter the same trigger volume again.
Give it a try and ask again here should you encounter any issue.
answered Jan 20 '18 at 12:26 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here