scottdog62 9 Posted May 19, 2016 Hey guy.I need a countdown timer for my mission, i'v had a search but it confuses me.What a simple way for once this trigger is activated you have 7 minutes to get to this trigger? Share this post Link to post Share on other sites
serena 150 Posted May 19, 2016 Fn_CountDownTimerTest = { [10, 1, {systemChat format ["%1 seconds to atomic armageddon", _this]; if (_this == 0) then {NUCLEARCHARGESACTIVATE = true}}] call Fn_CountDownTimerStart; }; /* Function starts countdown algorithm which calls specified function with rest counts number as argument Arguments: [counts number, delay between counts, count handler function] Usage: [10, 1, {DoSomethingWithThisArgumentContainingRemainCounts}] call Fn_CountDownTimerStart */ Fn_CountDownTimerStart = { _this spawn { _this params ["_cts", "_ctd", "_fnc"]; while {_cts = _cts - 1; sleep _ctd; _cts >= 0} do { _cts call _fnc} } }; Share this post Link to post Share on other sites
scottdog62 9 Posted May 19, 2016 OkSimpler way?Or could you explain more? Share this post Link to post Share on other sites
serena 150 Posted May 19, 2016 More about scripting? This way Scripting introduction for new scripters Share this post Link to post Share on other sites
scottdog62 9 Posted May 19, 2016 Sorry, i know i'm still learning with this stuff.I'm just unsure where i put the time i want, tried putting it at every "_this" didn't work. Share this post Link to post Share on other sites
serena 150 Posted May 19, 2016 Just add to your mission folder file "init.sqf" with contents: /* Function starts countdown algorithm which calls specified function with rest counts number as argument Arguments: [counts number, delay between counts, count handler function] Usage: [10, 1, {DoSomethingWithThisArgumentContainingRemainCounts}] call Fn_CountDownTimerStart */ Fn_CountDownTimerStart = { _this spawn { _this params ["_cts", "_ctd", "_fnc"]; while {_cts = _cts - 1; sleep _ctd; _cts >= 0} do { _cts call _fnc} } }; player addAction ["Start Countdown", { [10, 1, {systemChat format ["%1 seconds to atomic armageddon", _this]; if (_this == 0) then {NUCLEARCHARGESACTIVATE = true}}] call Fn_CountDownTimerStart}]; Launch mission and select "Start Countdown" in action menu Share this post Link to post Share on other sites
snakeplissken 96 Posted May 19, 2016 creating file, countdown.sqf //countdown.sqs originally by Palyamerc //nul = execvm "countdown.sqf" sleep 0.01; timer = 5; // Time in seconds ex: 3min = 180, 7min = 420 , 10min = 600 , 1hr = 3600. publicvariable "timer"; waitUntil {!isnil "timer"}; while {(timer >= 0)} do { hintSilent parsetext format ["<t size=1.5' align='center'>%1</t>",(timer / 3600) call compile loadfile "time.sqf]; timer = timer - 1; publicvariable "timer"; sleep 1; }; timer = 0; newvariable = true; publicvariable "newvariable"; Here you can put any command to be fired after the zero count, ex: NameTank SetDamage 1; _________________________________________________________________________________ creating file, Time.sqf _playtime = _this; _h = (_playtime-(_playtime % 1)); _m = ((_playtime % 1)*60)-((_playtime % 1)*60) % 1; _s = (((_playtime % 1)*3600)-((_playtime % 1)*3600) % 1) - (_m*60); _hh = ""; if (_h < 10) then {_hh = "0"}; _mm = ""; if (_m < 10) then {_mm = "0"}; _ss = ""; if (_s < 10) then {_ss = "0"}; _playtimeHMS = format ["%1%2:%3%4:%5%6",_hh,_h,_mm,_m,_ss,_s]; _playtimeHMS; _________________________________________________________________________________ Place the two files Time.sqf and countdown.sqf within the root folder of the mission. Create a trigger, in place within in ON ACTV, select the radio for activation. null = [] execVM "countdown.sqf"; Actuates the trigger by radio to see the clock. Share this post Link to post Share on other sites
bull_a 44 Posted May 19, 2016 Simplest way is to use the BIS module Countdown. You define the countdown time and synchronize the module to a trigger. When the trigger activates, the module will initialize and start the countdown. You can also define an end of scenario screen using CfgDebriefings or pick from one of the predefined ones Share this post Link to post Share on other sites
scottdog62 9 Posted May 20, 2016 Thanks snakeplissken,got the timer working, one thing i'm not sure is how to get another trigger to activate once the count down is finished. Share this post Link to post Share on other sites
scottdog62 9 Posted May 20, 2016 Got it working, now all i need is the command for the unit to skip waypoint, and should be done Share this post Link to post Share on other sites
sarogahtyp 1105 Posted May 20, 2016 u r not very specific but u could do something like this: _grp = group this; _grp setCurrentWaypoint [_grp, ((currentWaypoint _grp) + 1)]; Share this post Link to post Share on other sites
scottdog62 9 Posted May 20, 2016 u r not very specific but u could do something like this: _grp = group this; _grp setCurrentWaypoint [_grp, ((currentWaypoint _grp) + 1)]; Sorry, ok heres what I want. I have one trigger, that once the player gets in the helicopter it flys off. I have made a waypoint activation with the trigger, so that once the player is in the helicopter it flys off. Now what I want now is that the helicopter will fly off once the countdown has reached 0, without the player in it. So i was thinking of making a skip waypoint command that was in the trigger. I just need the script. Share this post Link to post Share on other sites
sarogahtyp 1105 Posted May 20, 2016 (edited) the above code should do it but u could modify it for the heli named yourFreakingHeli: _grp = group driver yourFreakingHeli; _grp setCurrentWaypoint [_grp, ((currentWaypoint _grp) + 1)]; EDIT:u said: I have made a waypoint activation with the trigger, so that once the player is in the helicopter it flys off. you could just modify ur triggers condition but u should post it and we can look how to modify it. Edited May 20, 2016 by sarogahtyp Share this post Link to post Share on other sites
scottdog62 9 Posted May 20, 2016 Exactly what i wanted thanks sarogahtyp and everyone Share this post Link to post Share on other sites