rkemsley 10 Posted August 7, 2019 I am currently trying to make it so that when a hold action is preformed on a crate, it will put the crate in the back of a non specific Zamak Truck. This would mean that the seats in the back of the truck would have to be locked and anyone sitting in the truck must be ejected from those seats. This is my script so far, all working fine. [ this, "Load.", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, { _this call { _ZamakTrans = nearestObjects [ _this select 0, [ "Truck_02_transport_base_F" ], 25 ]; if (count _ZamakTrans > 0) then { target = _ZamakTrans select 0; { target lockCargo [ _x,true ] } forEach [ 2, 3, 4, 5, 6, 7 ]; box attachTo [ target, [ 0, 0.25, -0.15 ] ]; box setVectorDirAndUp [ [ 1, 0, 0], [0, 0, 1 ] ]; }; } }, {}, [], 2, Nil, true, false ] remoteExec [ "BIS_fnc_holdActionAdd", 0, this ]; All I need at the moment is to be able to eject people from the seats 2, 3 4, 5, 6 and 7. (any advice/criticism on my script will be greatly appreciated.) Share this post Link to post Share on other sites
Sgt. Dennenboom 98 Posted August 7, 2019 You can use the moveOut command to safely kick a unit from a vehicle, but then you need a way to determine which units need to be kicked. The fullCrew command returns an array which also gives the cargo index for each unit in the vehicle. You can compare that to your list of cargo indexes like such (quick and dirty): _ZamakTrans = nearestObjects [ _this select 0,["Truck_02_transport_base_F"],25]; if (count _ZamakTrans > 0) then { target = _ZamakTrans select 0; // Kick units from cargo slots and lock them _lockIndexes = [2,3,4,5,6,7]; {if ((_x select 2) in _lockIndexes) then {moveOut (_x select 0)};} forEach fullCrew target; {target lockCargo [_x,true];} forEach _lockIndexes // Attach box box attachTo [target,[0,0.25,-0.15]]; box setVectorDirAndUp [[1,0,0],[0,0,1]]; }; 1 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4206 Posted August 7, 2019 Hello there rkemsley ! Here is also a workaround in order to use the script for every vehicle : //___________________ Count all available seats including cargo slots ___________________ _Seats_Number = [_Helicopter,true] call BIS_fnc_crewCount; systemchat format ['Vehicle: %1 seats: %2', _Helicopter , _Seats_Number]; //___________________ Counts all available seats excluding cargo slots ___________________ _Seats_Crew = [_Helicopter,false] call BIS_fnc_crewCount; //___________________ Counts all cargo slots ___________________ _Seats_Cargo = _Seats_Number - _Seats_Crew; { unassignvehicle _x; //_x action ["Eject", vehicle _x]; // one by one moveOut _x; // move out at once }foreach units _this; }foreach units _Group; part of the code below : (WIP ) GF_Zone_Spawner Spoiler //___________________ GF_Zone_Spawner_Heli_Stalk ___________________ GF_Zone_Spawner_Heli_Stalk = { if(count GF_Zone_Spawner_allUnits < GF_Zone_Spawner_Enemy_Max_Number)then{ _pos = GF_Zone_Spawner_pos; if!(_pos isEqualTo [0,0,0])then{ _Group = createGroup GF_Zone_Spawner_Enemy_Side; _Group_Crew = createGroup GF_Zone_Spawner_Enemy_Side; _Spawn_Height = 1000; _Helicopter = selectRandom GF_Zone_Spawner_Helicopters; _Spawned_Helicopter = createVehicle [_Helicopter,_pos, [], 0, "FLY"]; _Spawned_Helicopter setPosATL [getPosATL _Spawned_Helicopter select 0, getPosATL _Spawned_Helicopter select 1, _Spawn_Height]; _Spawned_Helicopter engineOn true; _Spawned_Helicopter setVariable ["Var_GF_Zone_Spawner_Spawn",true]; _Spawned_Helicopter spawn GF_Zone_Spawner_Cleaner; //___________________ Count all available seats including cargo slots ___________________ _Seats_Number = [_Helicopter,true] call BIS_fnc_crewCount; if (GF_Zone_Spawner_Systemchat_info)then{ systemchat format ['Vehicle: %1 seats: %2', _Helicopter , _Seats_Number]; }; //___________________ Counts all available seats excluding cargo slots ___________________ _Seats_Crew = [_Helicopter,false] call BIS_fnc_crewCount; //___________________ Spawn Crew ___________________ for "_x" from 1 to _Seats_Crew do{ _Crew = _Group_Crew createunit [selectrandom GF_Zone_Spawner_Infantry_Helicopter,_pos,[],0,"Can_collide"]; [_Crew] JoinSilent _Group_Crew; _Crew moveInAny _Spawned_Helicopter; _Crew setVariable ["Var_GF_Zone_Spawner_Spawn",true]; _Crew spawn GF_Zone_Spawner_Cleaner; if(GF_Zone_Spawner_Change_Loadout)then{_Crew spawn GF_Zone_Spawner_Loadout;}; removeBackpack _Crew; _Crew addBackPack "B_parachute"; }; //___________________ Counts all cargo slots ___________________ _Seats_Cargo = _Seats_Number - _Seats_Crew; //___________________ Spawn units in Cargo ___________________ for "_x" from 1 to _Seats_Cargo do{ _unit = _Group createunit [selectrandom GF_Zone_Spawner_Infantry,_pos,[],0,"Can_collide"]; [_unit]joinSilent _Group; _unit moveInAny _Spawned_Helicopter; _unit setVariable["Var_GF_Zone_Spawner_Spawn",true]; _unit spawn GF_Zone_Spawner_Cleaner; if(GF_Zone_Spawner_Change_Loadout)then{_unit spawn GF_Zone_Spawner_Loadout;}; //___________________ backpackitems + parachute ___________________ private _data = [backpack _unit,backpackitems _unit]; removeBackpack _unit; _unit addBackPack "B_parachute"; [_unit,_data]spawn{ private ["_unit","_data"]; _unit = _this select 0; _data = _this select 1; waitUntil {uisleep 1; isTouchingGround _unit or (position _unit select 2) < 1}; uisleep 1; removeBackpack _unit; _unit addbackpack (_data select 0); {_unit additemtobackpack _x;} foreach (_data select 1); }; }; _Group_Crew setBehaviour "AWARE"; _Group_Crew setCombatMode "RED"; _Group setBehaviour "AWARE"; _Group setCombatMode "RED"; if (isMultiplayer)then{ _stalked = selectrandom GF_Zone_Spawner_allPlayers; [_Group_Crew,group _stalked,10,nil,{true} ,0] spawn BIS_fnc_stalk; [_Group,group _stalked] spawn BIS_fnc_stalk; }else{ [_Group_Crew,group player,10,nil,{true} ,0] spawn BIS_fnc_stalk; [_Group,group player] spawn BIS_fnc_stalk; }; waitUntil{ if (isMultiplayer)then{ uisleep 1; {_x distance2D _Spawned_Helicopter < 600}count GF_Zone_Spawner_allPlayers > 0; }else{ uisleep 1; _Spawned_Helicopter distance player < 600; }; }; { unassignvehicle _x; _x action ["Eject", vehicle _x]; }foreach units _Group; //___________________ addwaypoint ___________________ _pos = getpos _Spawned_Helicopter; _random_Wp = _pos getPos [3500,random 360]; _Wp = _Group_Crew addwaypoint [(_random_Wp),0]; _Wp setWaypointType "MOVE"; _Wp setWaypointSpeed "FULL"; _Wp setWaypointBehaviour "AWARE"; _Wp setWaypointCombatMode "RED"; //___________________ Delete ___________________ waitUntil {uisleep 1; _Spawned_Helicopter distance2D _pos > 3000 }; deleteVehicle _Spawned_Helicopter; {deleteVehicle _x} forEach units _Group_Crew; }; }; }; 2 Share this post Link to post Share on other sites
rkemsley 10 Posted August 7, 2019 (edited) @Sgt. Dennenboom Thank you very much! _ZamakTrans = nearestObjects [ _this select 0,["Truck_02_transport_base_F"],25]; if (count _ZamakTrans > 0) then { target = _ZamakTrans select 0; // Kick units from cargo slots and lock them _lockIndexes = [2,3,4,5,6,7]; {if ((_x select 2) in _lockIndexes) then {moveOut (_x select 0)};} forEach fullCrew target; {target lockCargo [_x,true];} forEach _lockIndexes // Attach box box attachTo [target,[0,0.25,-0.15]]; box setVectorDirAndUp [[1,0,0],[0,0,1]]; }; This was perfect! Just had to make one minor change to the code so it would work. [ this, "Load.", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, { _this call { _ZamakTrans = nearestObjects [ _this select 0, [ "Truck_02_transport_base_F" ], 25 ]; if ( count _ZamakTrans > 0 ) then { target = _ZamakTrans select 0; _lockIndexes = [ 2, 3, 4, 5, 6, 7 ]; { if ( ( _x select 2 ) in _lockIndexes ) then { moveOut ( _x select 0 ) }; } forEach fullCrew target; { target lockCargo [ _x, true ]; } forEach _lockIndexes; box attachTo [ target, [ 0, 0.25, -0.15 ] ]; box setVectorDirAndUp [ [ 1, 0, 0], [0, 0, 1 ] ]; }; } }, {}, [], 2, Nil, true, false ] remoteExec [ "BIS_fnc_holdActionAdd", 0, this ]; ^^ For anyone who would like to replicate what I've done. If the Zeus player is sitting in the position which gets locked while in Zeus mode, he will not be kicked out of the vehicle. Edited August 7, 2019 by rkemsley 1 1 Share this post Link to post Share on other sites