Pause or Stop the Clock Timer

Greetings to all, I have a question that I have not been able to solve by reading the manual. Is there a way to pause or stop the Clock Timer before it reaches zero? I need this for a bonus level to destroy a car.
I added a video where you can see the problem: when I finish destroying the car, time keeps running and the character dies.
Hope someone can help me. Thanks :)


 
Hello @Kalcetin Studio

You can stop the clock timer by using this function:
changeopenborvariant("game_time", 39800);

I suggest using a script inside the "timetick.c" file, which works at every change on the clock timer.

This file needs to be created and placed inside the scripts folder. The value 39800 is the same as the 99 seconds on the game timer in centiseconds (99,5 to be more exact, I added a little more because this way the clock will never decrease to 98 seconds). You can use any other value if you want.

As a suggestion, you can get the current "game_timer" at the exact moment the car is destroyed, save in a variable and repeat it forever inside the "timetick.c" only in this level.
 
Hello @Kalcetin Studio

You can stop the clock timer by using this function:


I suggest using a script inside the "timetick.c" file, which works at every change on the clock timer.

This file needs to be created and placed inside the scripts folder. The value 39800 is the same as the 99 seconds on the game timer in centiseconds (99,5 to be more exact, I added a little more because this way the clock will never decrease to 98 seconds). You can use any other value if you want.

As a suggestion, you can get the current "game_timer" at the exact moment the car is destroyed, save in a variable and repeat it forever inside the "timetick.c" only in this level.
Thanks a lot for the suggestion. I'm going to study it carefully because I'm a beginner with scripts. I know how to implement them by reading tutorials, but I don't know how to create them.
I'll try to find out what is the code that should go inside timetick.c, in order to use something like this in the DEATH animation of the car?
@script
if (frame == 0){
changeopenborvariant("game_time", 39800);
@end_script
Thanks :D
 
@script
if (frame == 0){
changeopenborvariant("game_time", 39800);
@end_script
@Kalcetin Studio

It's a good idea, you can add this code in the death animation of the car, no need to use the "timetick.c" in this case.
This way the game timer will "reset" to 99 again as soon as the car is destroyed and give enough time to finish the level properly.
 
Solution
@Kalcetin Studio

It's a good idea, you can add this code in the death animation of the car, no need to use the "timetick.c" in this case.
This way the game timer will "reset" to 99 again as soon as the car is destroyed and give enough time to finish the level properly.
Thank you very much @Kratus this solves the problem perfectly.
I used this code in the DEATH animation, because the previous one that I put crashed.
@script
if (frame == 0){
changeopenborvariant("game_time", 39800);
}
if (frame == 2){
changeopenborvariant("game_time", 39800);
}
@end_script
And with this I came up with an idea for a little bonus-game. Thank you so much.
 
Back
Top Bottom