Forum Jump :

Author Message


Posts: 89
Rank:


Level: Member

Country: in
Location:
Occupation:
Age:
In-game name:

 
#196441 Posted at 2017-02-23 16:32        
     
I have edited my script now u can select single as well as multiple units with this version.
Place init.sqf, selectunits.sqf & setunitspos.sqf in your mission folder.
init.sqf
waitUntil {!isNull(findDisplay 46)}; 
disableSerialization;
_display = findDisplay 46;
_display displaySetEventHandler ["KeyDown","_nil = _this execVM ""selectUnits.sqf"""];

titleText ["Press windows Left key once to activate script","plain down"];

selectunits.sqf
private['_handled'];
_handled = false;

sleep 0.1;
switch (_this select 1) do
{
// KEY windows Left 
case 219: 
{
markerIcon = "Sign_arrow_down_large_EP1" createVehicle [0,0,0];
titleText ["Select any units (F2,F3,F4..F12) once & place marker towards position to move units to position!","plain down"];
_handled = true;

sleep 1;
hintsilent "select units in 5 seconds!";

sleep 1;
hintsilent "select units in 5";
sleep 1;
hintsilent "select units in 4";
sleep 1;
hintsilent "select units in 3";
sleep 1;
hintsilent "select units in 2";
sleep 1;
hintsilent "select units in 1";
sleep 1;

SquadUnits = groupSelectedUnits player;
countunits = count squadUnits;

sleep 0.1;
if (countunits == 0) exitwith {hintsilent "No units selected!,initiate script again!;";deletevehicle _marker;};

sleep 1;
hintsilent "units selected!";

moveai = [markerIcon,SquadUnits] execVM "setunitspos.sqf";
waituntil {scriptdone moveai};

hintsilent "Select other units!";
};
};
_handled;

setunitspos.sqf
_marker = _this select 0;
_selectedunits = _this select 1;

sleep 1;
_marker attachTO [player,[0,3,1.3]];
 
sleep 5;
_marker setvelocity [0,0,0];
detach _marker;
_marker setPosATL getPosATL player;
_marker setposATL (player modelToWorld [0,3,0]);

sleep 0.1;
{_x dowatch _marker} foreach _selectedunits;
{_x domove getposATL _marker} foreach _selectedunits;
{_x setspeedmode "FULL"} foreach _selectedunits;

sleep 1;
waituntil {{unitready _x} foreach _selectedunits;};
_selectedunits dowatch objnull;
deletevehicle _marker;

exit;