Jump to content
Sign in to follow this  
YoMma

Time Limits in Deathmatch/Score Limit

Recommended Posts

I have established the time and score limit options in the Description.ext but I cannot for the life of me remember how to actually make the mission execute this?

Example, the default time limit is 20 minutes, but the mission doesn't actually end. Presumably I need a trigger that takes how long was specified and then activates but I have no clue on the syntax etc for this trigger so was wondering if someone can help me out so I can actually make my DM map end! :P

Share this post


Link to post
Share on other sites

U can try something like this:

Make a script file timer.sqf in your mission folder with the following content:

_time_to_go = _this;

_time_passed = 0;

_time_to_check = 60; // Number of seconds to wait until the next check (bigger - better, but not too big)

while (TRUE) do {
 if (_time_passed >= _time_to_go) then {
   endmission "END1";
 } else {
   sleep _time_to_check;
   _time_passed = _time_passed + _time_to_check;
 };
};

And then in init.sqf in your mission folder:

_mission_time = 20 * 60; // Your time in seconds
_mission_time execVM "timer.sqf";

Updated due to some mistakes in the code.

---------- Post added at 08:36 PM ---------- Previous post was at 08:21 PM ----------

Additionally if u have ur timelimit (in seconds) set in mission.ext as param1, u can use it in the script, just replace:

_mission_time = 20 * 60; // Your time in seconds

by

_mission_time = param1; // Your time in seconds

or

_mission_time = param1 * 60; // If time in param1 is in minutes

Edited by DiRaven

Share this post


Link to post
Share on other sites

Alternative solution:

init.sqf

estimatedtimeleft param1;

param1 is duration in seconds. You can either set it by yourself or get it from description.ext.

Condition of End1 trigger

serverTime > estimatedEndServerTime

Share this post


Link to post
Share on other sites

Thanks for the help guys, problem solved. It was the whole param1 thing I couldn't remember, had it in my description.ext but couldn't remember the syntax needed for the trigger!

Share this post


Link to post
Share on other sites
Alternative solution:

init.sqf

estimatedtimeleft param1;

param1 is duration in seconds. You can either set it by yourself or get it from description.ext.

Condition of End1 trigger

serverTime > estimatedEndServerTime

I got this working, but i want to have some triggers set up to let players know when there is x amount of time left til the game ends. At the moment i am testing in seconds.

estimatedendservertime is set for 30seconds.

Ive tried having a trig/ cond field: servertime==20

act: hint "you have 10 seconds left to game ends"

But it doesnt do anything and once 30secs is up the game ends as it should.

*Update* I changed cond line to servertime>20

I get the hint straight away as mission starts.

Update again.

I came across a thread mentioning using eg. time > 1800

That solves that problem, however what about Jip players wouldn't their game time be different to others who started from the beginning? I know the server time wont be altered, but time is how long since the mission started right? is that relative to the client or to the time the server started the mission?

Thanks

Daza

Edited by Daza
update again

Share this post


Link to post
Share on other sites

An alternative would be to use my PVPscriptpack (see sig) which supports both time-limts and maximum scores (and also deals correctly with JIP). It has a variable to allow you to configure the end of game warnings too. There's also a GUI wizard which makes it very easy to create a new deathmatch.

See http://forums.bistudio.com/showpost.php?p=1522034&postcount=514

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×