Timers placed in HUD:
Okay! That makes things easier, this is typically how it’s done in the beginning.
So firstly, on your 3,2,1 counter… You have that <= 0.0?
Should that be changed to >= 0.0 (greater than)?
Then on True, run GoGoGo.
On False, Reset Timer.
We’ll worry about finishing up the level timer in a minute. We need to hone in on one thing at a time. Let’s not talk about any of the other parts AT ALL until we get this 3,2,1 counter running perfectly, okay?
(I have a plan, but we need to do these things in steps, not all at once)
All ears and eyes
Okay, go do this part and screenshot that back!
will do, but GoGoGo… is a custom event in the HUD widget, you mean on True I set the delegate for GoGoGo?
Like this:
However you need to do it. Honestly I’m confused at why you set it up to call “Hide Big Counter” and then use your animations off that. Is there anything else using that? If not, I’d rename that call.
But yes, exactly like that!
Next, add “Set LevelTimer(or whatever)-> True” after “Clear Timer By Function Name: TimerCount”.
Test it, let me know how it goes.
wait, wait, wait LevelTimer is the variable I set up in the GameMode, this is the GameState bp
Do I need a ref to the GM from the GS?
Reason I called it that was that I needed a dispatch when the countdown reaches 0 so that instead of 3,2,1,0 I can replace the 0 with the word “Go” in the widget. Sorry it was the best I could come up with
Do you have the timers in two separate places?
Or is it all in the game state?
If any of it IS in the gamemode, it should be moved to the gameState. I did not realize the timers were in multiple locations.
Edit: actually no. Disregard that. However, you will need to GetGameMode, then Cast to MyGameMode, pull of that to get your leveltimer bool, and set it to True.
Yup, level timer in gamemode, big countdown timer in gamesate. I can move them both in GS
So… leave them as is?
Read the rest
Awesome! Now test it and see what happens!
Let us know what goes wonky!
Nothing’s changed. Same as before, game frozen, counters frozen
Did you remove all of the pauses? There should be NO pauses.
Also did you add
GetGameMode->Cast To MyGameMode->TimerCount
to the playbtn on your menu widget?
And moved the “Remove Widget” to the end, after everything else?
No pauses: GM loads MainMenu
MainMenu: On clicking Play,hides itself, and loads the HUD
The HUD: Never posts that Print String “Event Dispatched”
Game is in a weird state… I have a moving target with a timeline that is sliding back and forth, but player is frozen, timers are frozen
Edit> I Have a Set Input Mode UI Only in the Event Construct of MainMenu… Is that what’s messing things up???
THe problem is, that if I remove that, the user can no longer click on anything…
There’s some incomplete code here.
add
GetGameMode->Cast To MyGameMode->TimerCount
to the playbtn on your menu widget
And lastly, “Remove from Parent”.
The Cast to game mode etc is to ACTIVATE the 3,2,1 countdown, which will activate the other countdown when it finishes.
EDIT: as for your edit:
Use “Set Input Mode Game And UI” instead, and directly after use “Disable Player Input” on PlayerController. We’ll re-enable it after the 3,2,1.
The player not being able to move is on the docket. We gotta focus here, one thing at a time.
But that part is already done in the HUD widget that loads when I click on the Play btn in the MainMenu. It’s the Cast to GameState and called the function StartCounter (for 3,2,1). I added the Remove from Parent. It actually loaded the HUD on top of the MainMenu without it
I get the Print String for both Casts… GM Ref and GS Ref… but the next Print String after calling StartCounter… never gets printed
Okay so I guess I misunderstood the point that the countdown needs to start, but that’s okay. The question is:
So is it doing the 3,2,1 StartCounter or is it not? If it isn’t, can you show me that part of the HUD widget where it should be getting called?
Also I think I may see what was tripping it up. It’s looping because of this:
You’re starting the timer over and over and over. Don’t worry, every step we’re cleaning up a little bit! Code gets messy for all of us.
Edit: If you want to test if that’s indeed the issue, move that printstring one spot back, to where it’s RIGHT after GoGoGo. If it prints after you move it, that’d 100% be the issue.