complacent_lizard 1 Posted August 14, 2017 This is going to be one odd request... Here's the situation - I want a line of units to form a queue. The idea is that every 10 seconds the unit at the front of the line moves to the back, and the unit behind him moves forward to take his place. The units are forming the line, and the player is supposed to wait in the line for the scenario. Here's the script I have so far: queue.sqf private ["_front","_back"]; _front = _this select 0; _back = _this select 1; while {true} do{ sleep 10; _back doMove (_front modelToWorld [0,-0.3,0]); }; _front refers to the unit in front of the _back unit in the line. Each unit in the queue executes this script with nul = [civ_1, civ_2] execVM "scripts\queue.sqf"; depending on who is in front of them. The problem with this script is that the units can only form a straight line (not such an issue), but when the unit at the front of the line moves to the back, the unit behind them doesn't move to the front of the line. In essence, the 2nd in line doesn't move and the queue slowly shifts backwards. Any pointers or obvious mistakes I've made? Thanks everyone! Share this post Link to post Share on other sites
M1ke_SK 230 Posted August 14, 2017 @complacent_lizard Something like that ? Feel free to add me on steam for code 2 Share this post Link to post Share on other sites
HazJ 1289 Posted August 14, 2017 1 hour ago, M1ke_SK said: Something like that ? That's cool! :) Share this post Link to post Share on other sites
complacent_lizard 1 Posted August 15, 2017 Yeah! Something exactly like that! Are you using markers to achieve that @M1ke_SK? And how do you think it would handle 25 units lined up? :P Share this post Link to post Share on other sites
M1ke_SK 230 Posted August 15, 2017 3 minutes ago, complacent_lizard said: Yeah! Something exactly like that! Are you using markers to achieve that @M1ke_SK? And how do you think it would handle 25 units lined up? :P Allright, so this script can handle any number of units! You just need to change sleep between moving. 1. Place down some helpers ( or markers), where you want your units to stand in line. You can even do curve line with this thing. 2. Place same amount of units next to these helpers 3. Define names for each unit and helper 4. Run the script note: if you want to use markers, you will need to tweak script little bit (line #27) _x doMove (getMarkerPos (_helpers select _forEachIndex)); Demo mission https://www.sendspace.com/file/slzegw init.sqf (usage) _units = [unit_1, unit_2, unit_3, unit_4, unit_5]; _helpers = [place_1, place_2, place_3, place_4, place_5]; [_units, _helpers] execVM "queue.sqf"; queue.sqf (script) params [ ["_units", []], ["_helpers", []] ]; if (count _units != count _helpers) exitWith { ["queue.sqf | count of units and positions do not match!"] call BIS_fnc_error; }; while { { alive _x } count _units > 0 } do { { if (_forEachIndex == 0) then { _helpers pushBack (_helpers select 0); _helpers deleteAt 0; }; if (_forEachIndex == count _helpers) then { _helpers = [(_helpers select ((count _helpers) - 1))] + _helpers; _helpers deleteAt ((count _helpers) - 1); }; _x limitSpeed 1; _x doMove (getPos (_helpers select _forEachIndex)); } forEach _units; sleep 15; }; Media Share this post Link to post Share on other sites
complacent_lizard 1 Posted August 15, 2017 This is a great little script @M1ke_SK! For the time being I've decided to change to a stationary line because I'm lining the units up in really close quarters (inside a building) and the path finding causes some messy problems! But I can see this script being useful especially when the the orange DLC comes out (maybe for a line of civilians waiting for aid?) Thanks so much! :D Share this post Link to post Share on other sites
M1ke_SK 230 Posted August 15, 2017 I modified this script little bit and now I am using it for air traffic where plane come to airfield, wait for a bit, than take off to another airfield and so on. Now I have created airlines with scheduled flights on Tanoa! :D 2 Share this post Link to post Share on other sites
complacent_lizard 1 Posted August 15, 2017 Well that escalated quickly! Share this post Link to post Share on other sites