Create a Countdown timer to start a paused game?

Hi all!

I’ve been able to create a timer that will count up during my game, but have come to a cross-road in how to create a timer that will count down (at the very start of the game) to unpause my game which would be paused from the moment the player enters the levels, so something like this:

Player presses new game → enters the game world → the game world is to be paused → a count down appears going from 5 and ending on 0 → on 0 the game unpauses and the player and play.

I’ve tried a few methods like adding a delay to the Pause Game node then adding a time variable, but I can’t get things to work. I do not know what ‘logic’ needs to be applied to get it to work… I am presuming it’s pretty simple stuff, but I am blind to know what it is.

Any help will be greatly appreciated! :smiley:

Use timer:

https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UseTimers/Blueprints/index.html

Hello again ! The timer isn’t the issue, it’s having it unpause a paused game.

I’ve tried doing event-beginplay → set game pause (ticked) then delay then set game pause (unticked) within the level bp but it doesnt work.

I’ve also tried doing character movement freeze in a similar way but that didn’t work. I’ve tried doing this bp that someone got to work, but I couldnt get it past the delay (even with the bp set within the character).

So, as I said, my problem isn’t* the timer itself, I can make that, the problem I am struggling with is setting the game to be paused on start, have a countdown that when reaches 0 unpauses the game.

Anyone have any idea how to do this? I cannot figure it out. I’ve made a ‘fake’ timer that changes from ‘ready’ to 3 to 2 to 1 to ‘go’ that disappears, but can’t even link that up to pause/disable input. Please help!

I think Delay might be a problem, use Retriggable Delay

Also don’t use level blueprint for something like this, it seems you doing something that it’s meant to work on every level, such code should be in GameMode insted

I got it working, it was something completely off the wall and unrelated to timers that got it working, I feel so stupid… Ahh well, atleast I know more about UE4 now ahahahahah, thanks for the help !

close your question then please.

Using Global Time Dialation It Will Be Easy

void UPlayerUI::BackToPlayScreen()
{
	UGameplayStatics::SetGamePaused((), false);
	UGameplayStatics::SetGlobalTimeDilation((), 0.0001f);
	()->GetTimerManager().SetTimer(Handle_ResumeGame, this, &UPlayerUI::ResumeTheGame, 0.0001f, true);
}

void UPlayerUI::ResumeTheGame()
{
	--TimerLimit;
	if (TimerLimit <= 0)
	{
        TimerLimit = 3;
		()->GetTimerManager().ClearTimer(Handle_ResumeGame);
		UGameplayStatics::SetGlobalTimeDilation((), 1.f);
	}
}