Hello,
I would like to time some parts of the game, for example when a player enters the trigger he'll have a minute to do a short QTE and pick up two objects in different places, or he'll lose. I'm doing this with a variable that adds 1 to itself every second, and while it works, I weren't able to find a way to show the remaining time. It wold be perfect to have a slider connected to the variable to display the changes. Can this be done without any custom scripts? Or perhaps there is a better way to do this?
Thanks!
Comments
If the Variable's type is Float, you can have its value displayed in a Slider Menu. This works for Unity UI-based Sliders, too, for a bit more visual control over it.
2. Is your UI Slider correctly linked to the Slider Menu Element? You must ensure that the Slider component shares the same Constant ID number that is listed in the AC Slider properties. Please post images showing what you've done so that we can examine the issue.
Hello. I'm looking for a method of putting a timer on the screen so that when the time runs out it's the end of the game, and that time can be added or decreased as an item is picked up. Using AC. I don't understand variables well.
How do I do it?
Since this thread was posted, AC has a dedicated Timer feature. You can create a Timer from the top toolbar, under Adventure Creator -> Editors -> Timers Editor.
Create a new Timer, and check Link to Global Variable?. Create a Global Integer variable, setting its Default value to the default length of time (in seconds) and link it to the Timer.
Set the Timer's Value increases per tic property to -1, and set the Max value to the highest amount of time you want the timer to be.
At runtime, you can then use the Variable: Set timer Action to begin the Timer, which will reduce the Integer variable's value by 1 every second.
To have the game end when it reaches zero, assign an ActionList asset in the Timer's ActionList on update property. Set this list's When running property to Run In Background, and have it run a Variable: Check Action to check if the Integer variable's value is zero. If it is, have it run the Engine: End game Action to end or restart the game.
The Timer is not working, I created a menu to show the time on the screen.
You need to call the Variable: Timer Action separately - it shouldn't be part of the "On Update" ActionList, but run when the scene / game begins.
You can also remove the "On Update" ActionList - and instead use the "ActionList on complete" field to run your Engine: End game Action.
It worked out. Thanks