Stop Countdown timer if the player dies during that time.

So I am trying to stop the countdown timer if the players health reaches 0 during that time.
I am using a set timer by event, but something is not working somewhere and I am not sure where it could be.
Help would be much appreciated

Any reason why we cannot do just that :point_up_2: instead?

player loses heathis player.health 0?stop timer

Not sure how the script you posted is supposed to work but it seems over-engineered, at least for what you described.


Let’s say this in the player:

And this:

Is hooked up here:

image

I tried to mimic some of the nodes you already have to make it more visual.

Thank you for the reply!

The current script is the blueprint exit point in which the player will enter when they wish to leave the level and end the game.

So on the box collision it will start the count down timer

And I am wanting to find a way that if the players health at any point reaches 0 in that time, it will stop. Just not sure how to do that, I thought having a timer by event to check if the players health has reached 0 every 0.5 seconds would do it. but not quite.

See above. There seem to be no reason to run a timer event and then periodically check for player health via an interface. Do it only once. Player health drops → stop the timeline.

1 Like

Gave it a try, couldn’t find where the timeline variable to get its stop function is, so plugged it straight into the stop on the timeline. Unfortunately didn’t stop the timeline

It’s where all other variables are. But the above is absolutely fine, too.

  • does the cast fail?
  • how do you trigger the event dispatcher?

Cast does not fail,
and the event dispatcher is triggered on the death event of the character here, then called in the exit point blueprint

Are you sure the Event Dispatcher fires? Also, since the player is already dead:

Why check for health?

True if its firing there I don’t need to check for the health.

What is the best way to check if the event dispatcher is firing? Breakpoint?

That’d be the pro way! I use a print string. :innocent: Also, does the Death event Destroy the player?

I am trying to be more professional, and it does indeed fire!
The death event does not destroy the player

Sooo… it stops the timer Countdown timeline and yet it does not stop it?

1 Like

yes, I think I found the issue, so it does stop it actually.
I actually have the timer and the widget timer using different timers as I dont know how to link them.

So now it does stop the timer in the exit point but not the timer in the widget, which is fine, as I just remove it from parent like so

1 Like

Appreciate the help as always!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.