scottb613 263 Posted August 29, 2016 Hi Folks, Working on an Air Assault mission for Unsung - I have multiple helicopters launching from an airfield after a single trigger fires... Problem is it looks pretty unrealistic having every helicopter lifting off at precisely the same time... I'd like to add some random amount of delay for each unit before they take off... Is there an easy way to accomplish this ? Thanks... Regards, Scott Sent from my iPad using Tapatalk Share this post Link to post Share on other sites
Sgt.Spunkmeyer 14 Posted August 29, 2016 Could you put your script here?. So we could make ourselves an idea... Share this post Link to post Share on other sites
Sgt.Spunkmeyer 14 Posted August 29, 2016 While we wait for your reply, try this. I don't know if it works because i just wrote it. There are easier ways but my brain thought this thing :P _Spkunits = [heli_1, heli_2, heli_3, heli_4]; // the name of your Helicopters _time = 5; // null _time2 = 5; // null. Wasting bits { _rnd = random 10; sleep 0.1; if (_rnd < 5) then { _time = random 20; // 20 seconds Max _time2 = random 10; // 10 seconds Max } else { _time = random 40; // 40 seconds Max _time2 = random 20; // 20 seconds Max }; SLEEP (_time + _time2); // Randomized Time between 0-30 seconds and 0-60 seconds } forEach _Spkunits; 1 Share this post Link to post Share on other sites
Sgt.Spunkmeyer 14 Posted August 29, 2016 Or you could use aswell. It's easier but more simple. _Spkunits = [heli_1, heli_2, heli_3, heli_4]; // the name of the Helicopters _time = random 60; // 60 seconds Max { for "_i" from 0 to _time do { sleep 1; }; } forEach _Spkunits; 1 Share this post Link to post Share on other sites
scottb613 263 Posted August 30, 2016 Hi... Thanks so much for all the help - I tried using your examples - I couldn't get them to work inside a waypoint or trigger - I'm pretty new at this stuff although I do know Unix shell scripting so I am starting from a better place than many... I'm guessing these are stand alone sqf scripts ? That said - I did find a fix... I had three helicopters in standby waiting for a radio call - so I started with a single trigger synced to three different "hold" waypoints adjacent to the respective helicopters - as I'm sure you know - when he trigger fired all three helicopters started engines and took off at exactly the same time... It looked pretty fake... If I used the (min/mid/max) timer in the "hold" wp - the helicopters would ignore the synced radio trigger and would take off without the trigger being fired when the "hold" wp timer expired... The fix seemed to be changing the "hold" wp to a "move" wp - not syncing the trigger to the waypoints at all - and - using the function "triggerActivated" to test if the named trigger had fired in the "condition" field of the "move" wp - and - also setting values in the (min/mid/max) timer fields... Now when I fire the radio trigger - all three helicopters start randomly anywhere from 60 to 120 seconds... It looks much better now... Thanks !!! Regards, Scott Sent from my iPhone using Tapatalk Share this post Link to post Share on other sites
Sgt.Spunkmeyer 14 Posted August 30, 2016 Regards. Those examples were only examples. I mean they should be put into your script via .sqf. So, they don't do anything alone; they need something else like: _Spkunits = [heli_1, heli_2, heli_3, heli_4]; // the name of the Helicopters _time = random 60; // 60 seconds Max { for "_i" from 0 to _time do { sleep 1; }; _x setDamage 1; // New commands here. Ex: When time passed then every unit is destroyed. } forEach _Spkunits; Share this post Link to post Share on other sites
scottb613 263 Posted August 30, 2016 Hi... Thanks - one follow up - what's the deal with the underscore preceding variables ? Is it just proper etiquette or required syntax ? Regards, Scott Sent from my iPhone using Tapatalk Share this post Link to post Share on other sites
Sgt.Spunkmeyer 14 Posted August 30, 2016 This part? _x setDamage 1; // New commands here. Ex: When time passed then every unit is destroyed. That's only a new command to use passed the time required. It can be deleted. 1 Share this post Link to post Share on other sites