Jump to content
Sign in to follow this  
RN Malboeuf

Displayed Timer

Recommended Posts

I am currently making a mission and am trying to have a countdown of when the mission is over.

Background:

Spec Ops team of 4 has 10min to destroy 3 enemy vehicles. They have 12 rounds to share and cannot be detected. So I want this timer to display in the HINT box that everyone loves.

I have checked on these forums and OFPEC, OFPEC had one post about this and it made no sence b/c a guy was talking about a script that he never made public.

So, If there are any scripters out there that would like to make a timer that displays in the hint box and when it is done ends the mission I will be very grateful. I am assuming this wouldn't take more than 5min to type out for some guru.

Battles are won by slaughter and I am the Butcher,

Ironman *S*

Share this post


Link to post
Share on other sites

add this to your init.sqf:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">zf_countdown={

while{_this-round(time)>0}do{

hint format ["time left: %1 seconds",_this-round(time)];

sleep 1;

};

hint "timeout...";

};

600 spawn zf_countdown;

the loop inside the function runs until mission time reaches the given value (600 seconds in this case)...

Regards,

zap

Share this post


Link to post
Share on other sites
add this to your init.sqf:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">zf_countdown={

while{_this-round(time)>0}do{

hint format ["time left: %1 seconds",_this-round(time)];

sleep 1;

};

hint "timeout...";

};

600 spawn zf_countdown;

the loop inside the function runs until mission time reaches the given value (600 seconds in this case)...

Regards,

zap

Is there any way of adding some random time when the countdown finishes? I will be great if someone can tell me how using Zaphod's script.

What I need is the counter to add random time with a maximum of 20% increase. so in 100 sec can be MAXIMUM 20 sec but it can only be 1 or none.

Thank you

Share this post


Link to post
Share on other sites

untermensch:

imo it should be possible by creating a random number between the min and max value you want, attach that number to a variable and let the variable call the script... i'll mess a bit around with it when i've got time and maybe i can come up with something (maybe too late if someone else get's it going before me *nudge* *nudge*)

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

zf_countdown={

private ["_t"];

while{_this-round(time)>0}do{

hint format ["time left: %1 seconds",_this-round(time)];

sleep 1;

};

hint "timeout 1...";

_t=_this+random(_this*0.2);

while{_t-round(time)>0}do{

hint format ["additional time left: %1 seconds",_t-round(time)];

sleep 1;

};

hint "timeout 2...";

};

600 spawn zf_countdown;

Share this post


Link to post
Share on other sites

is that tested on a dedicated server? cause random creates different numbers on different clients so if you happen to run this script on the client it doesnt show one number for all players

plus you should use _t=_this+ceil(random(_this*0.2)); cause random creates a random number, not neccesarily a whole number

Share this post


Link to post
Share on other sites

Thank you all for your help

I actually find a way of going round it with a trigger but this way looks much better

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  

×