I am wondering, for the end of the game once the objective of my game, in which case when everything is herded and the complete widget appears, I would like to know how to stop my timer/show the time the player took to complete the objective. I am using a widget to display the timer.
Also, when the complete widget appears, I would like to remove control over the third person character in this case would be a dog. That way when selecting one of the buttons with the mouse, the camera does not move like when in control of the character.
If someone can help me (with images) that would be great, thanks!
create the widget when the activity starts and add it to the viewport
the widget is hidden but its internal timer keeps accumulating
use MaxTime to show it automagically after X seconds (perhaps there’s a time limit in your game!)
or set MaxTime to a huge value to run it indefinitely
call Activity Complete event to show the time elapsed and Unpossess to remove Character control
alternatively, have another actor in the level with a camera and Set View Target with Blend to switch cameras - perhaps you want a nice aerial shot of the level once the player is done playing
I created the code like displayed
above although I couldn’t find the
same set timer handle
The Timer Handle is a variable. You can create one by disconnecting Return Value of the Set Timer node, right clicking that pin and Promote to Variable - this will automagically create a var of the correct type.
when I start the game the timer is not
being displayed
How are you adding this widget to the screen? Besides that, the timer starts Hidden and only shows when the time has elapsed or you call Activity Complete.
Either set MaxTime to a non-zero value (in seconds) or do not hide the timer when the widget gets Constructed.
Ah! Sorry, wasn’t working in the event graph. That’s why it wasn’t allowing custom events to be made.
Anyways, I created the code like displayed above although I couldn’t find the same set timer handle and now when I start the game the timer is not being displayed(???)
The timer is displayed in the third person game mode and I now I have the code implemented but I do not see the timer stop when another widget is displayed as the end of my game
Added a small delay before invalidating the timer as the timing is weird without it. It seems that the invalidation can happen before you read the timer. This is most likely a bug. Apart from that,it seems to work fine:
The problem is, I want the time that is displayed through out the game to stop and not just be displayed at the end. Like in racing games or something where you can keep track of the time while the player goes.
The script is taken from a working example demonstrated above and works as is. Not sure what else you’ve got going on elsewhere.
Apart from that, yours is not wired the same as mine, you invalidate the timer handle as soon as you start it - the node in upper right corner executes immediately.
I am wondering, for the end of the
game once the objective of my game, in
which case when everything is herded
and the complete widget appears
You start the timer at the beginning of the game. When you finish the herding thing, you access the widget that has the timer and tell it (call the event) Activity Complete - it will then execute whatever it is connected to - the event will start stepping through the white wire execution chain.
It’s one thing to have an event and another to actually activate / evoke it - call it. How would your game know when to stop the timer? You need to send the message to the widget and tell it what and when to do.
This functionality is encapsulated in the Activity Complete custom event you created.
Think of a trigger that tells your game the Herding task has been completed; at this point you should access the reference to the widget and call the appropriate event which will then execute the nodes it is connected to.