Jump to content
Sign in to follow this  
Beerkan

Display a countdown time limit for an objective

Recommended Posts

I'm trying to create a situation where you have a time limit to complete an objective. For example, I have a trigger set that when you activate it, it displays how many minutes and seconds you have left to complete the objective in a constant update using hintSilent comand.

This is how I have the trigger set up with this as the init.

_objective=["Destroy the Radar",300] execVM "scripts\Countdown.sqf";

Note I am parsing 2 items to the Countdown script, i.e. the Objective "Destroy the Radar" and the time limit. 300 (5 minutes)

And here is my Countdown.sqf script

// Countdown.sqf
// Put this in the init of the triger
// objective = ["Destroy the Radar",300] execVM "Countdown.sqf";

_objective = _this select 0;
_timeleft = _this select 1;

while {true} do {

// This works ok, but instead of puting  "Destroy the Small Radar" I want to use the the _objective parsed to the script 
hintsilent format ["** OBJECTIVE **\nDestroy the Small Radar\nTime left %1", [((_timeleft)/60)+.01,"HH:MM"] call bis_fnc_timetostring];

if (_timeleft < 1) exitWith{};
 _timeleft = _timeleft -1;
sleep 1;
};

My script works ok, and while I do know how to parse the Objective name to the script, I don't know how to dispay it in the hint.

I want this so I can use it as a reusable CountDown.sqf script where I don't have to keep customising it to suit.

Suggestions and improvements warmly welcomed.

Edited by Beerkan

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  

×