Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
velez42
15
Years of Service
User Offline
Joined: 16th Dec 2010
Location:
Posted: 19th Sep 2011 06:18
I have multiple levels in my single player game but I want players to continue playing for 15 mintues. How do I include a game timer that will take players to the game over or game complete screen after 15 mintues of gameplay?
Ched80
15
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 19th Sep 2011 10:43
To do this you will need to create at least two scripts: one that defines a variable called "CountDown" or "TimerTotal" or something like that, and a second script to increment this variable once every second and then kill the player after 15 minutes (or 900 seconds). The first script will be uber simple:



The second script would be a bit more complicated like:



place each of these scripts into a trigger zone somewhere on your map. The first script only needs to be in your first level, the second script needs to be in every level.

I hope this helps.

jeetu
15
Years of Service
User Offline
Joined: 4th Apr 2011
Location:
Posted: 20th Sep 2011 04:48
wow a nice post it will help me too.thanks you both


well i have a question to : Ched80

if i use your script it will show any remaining time on screen ?

if not then How its possible to showing any remaining time

thank you

[ Sorry if found any bad english ]
velez42
15
Years of Service
User Offline
Joined: 16th Dec 2010
Location:
Posted: 22nd Sep 2011 18:53
yea thank for the help for sure! I also have another question and excuse my noobness. I'm assuming I put a trigger zone with the first code snippet somewhere near the very beginning of my first level. However, for the second trigger zone with the second code snippet do I need to place just ONE near the end of the second and subsequent levels? Thanks for the help!
Ched80
15
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 23rd Sep 2011 07:40
@jeetu, the scripts as they stand don't show the time remaining on screen. If you want to do that, you'd need to modify the second script to display a numerical HUD linked to the "CountDown" variable.

@velez42, the position of the trigger zones is not important, you can place the zones anywhere in your level.

velez42
15
Years of Service
User Offline
Joined: 16th Dec 2010
Location:
Posted: 26th Sep 2011 18:23
Thanks for the help, it worked like a charm. Is it also possible to add a script that saves the game int txt format and then kills the player at 15 minutes?
velez42
15
Years of Service
User Offline
Joined: 16th Dec 2010
Location:
Posted: 26th Sep 2011 22:58 Edited at: 26th Sep 2011 22:59
Here is the script I came up with for my question above. However, the resulting save file is unreadable and I want to know their kill count, lives, ammo, etc. when I save the file but I don't know how to do that. Does this code look about right?

:state=0,vargreater=CountDown 900:plrsubhealth=1000000000
:state=0,vargreater=CountDown 899:quicksavegame
:state=0:etimerstart,state=1
:state=1,etimergreater=1000:addvar=CountDown 1,state=0
Ched80
15
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 28th Sep 2011 08:04
@velez42, FPSC has no command to output data to *.txt file. The quicksavegame saves the all the game data in a binary file that cannot be read by noteppad. RPGmod has this feature.

velez42
15
Years of Service
User Offline
Joined: 16th Dec 2010
Location:
Posted: 28th Sep 2011 22:43
Cool Thanks!!
velez42
15
Years of Service
User Offline
Joined: 16th Dec 2010
Location:
Posted: 30th Sep 2011 22:19 Edited at: 30th Sep 2011 22:20
I've run into another problem. Instead of having players killed at the end of the 15 mintues I made it where there is a quicksave, the game is paused, and an image shows up. However, this new script only works if time runs out on the first level. Meaning that if I get to the next level the script doesn't work and nothing happens. Below is the code. All I did was add some new actions to the first line and changed nothing else. Why is this not freaking working?



Oh yeah and I just shortened the time for testing purposes. Would that make a difference? Thanks for all the help everyone
maho76
15
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 1st Oct 2011 10:25 Edited at: 1st Oct 2011 10:26
where you placed your "dimvar=...,setvar=CountDown 0,state=1..."-action?

dimvars dont reset between the levels as far as i know, so there could be the prob when you missed the above marked part of the var-setting script.
velez42
15
Years of Service
User Offline
Joined: 16th Dec 2010
Location:
Posted: 4th Oct 2011 05:00
I placed the below code into one trigger and the code in the message above in a second trigger. I placed the first trigger in the very first level along with the second trigger then placed the second trigger in the remaining levels by itself. You can reference the instructions given to me by ched80 at the top of this page. Here is the code for the first trigger


Another question I have is in regards to the code in the second trigger. What does this line in the code do?
:state=1,etimergreater=1000:addvar=CountDown 1,state=0

I am wondering if I even need it but I'm still noobing it so I'm not sure. Any help is appreciated with this problem.
maho76
15
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 4th Oct 2011 10:50
:state=1,etimergreater=1000:addvar=CountDown 1,state=0
= add 1 to CountDown-var every second

try the following code instead of your first one, place both in every level of your game:



this is to reset the var at the beginning of each level.

hope it helps.

Login to post a reply

Server time is: 2026-07-01 10:47:13
Your offset time is: 2026-07-01 10:47:13