Jump to content
Sign in to follow this  
DTM2801

Mulitple vehicle - transport script

Recommended Posts

I've been fiddeling with an existing script from disobey to get a transport sollution for multiple active vehicles across the missionmap with their own markers working with 1 script.

It works for all vehicles classes (to use a C130 as a transporter I recommend you use the C130 fix addon from GNAT).

Note: Atm transport planes have to start without fuel

You may find this useful in your custom missions when using unit transports between bases, cities, strongholds and such.

Vehicle init: [this, getmarkerpos "marker1", getmarkerpos "marker2"] exec "transport.sqf";

transport.sqf:

 _unit = _this select 0;
_pickupPos = _this select 1;
_dropoffPos = _this select 2;
_group = group _unit;
_unit setVariable ["logistic_state", 4, true];

_unit addEventHandler ["GETIN", { _this select 0 setVariable ["logistic_state", 2, true]; hint format ["%1 is loading up.",_this select 0]; }];
_unit addEventHandler ["GETOUT", { _this select 0 setVariable ["logistic_state", 4, true]; hint format ["%1 is unloading.",_this select 0]; }];
_unit addEventHandler ["FUEL", { hint format ["%1 is unavailable, out of fuel.",_this select 0]; }];
_unit addEventHandler ["DAMMAGED", { group (_this select 0) setCurrentWaypoint [group (_this select 0), 1]; hint format ["%1 has been damaged, returning to base.",_this select 0]; }];
_unit addEventHandler ["KILLED", { hint format ["%1 has been destroyed.",_this select 0]; }];

_waypoint0 = _group addwaypoint[_pickupPos, 5];
_waypoint0 setwaypointtype "LOAD";
_waypoint0 setwaypointCombatMode "BLUE";
_waypoint0 setwaypointBehaviour "SAFE";
_waypoint0 setwaypointSpeed "Full";
_waypoint0 setwaypointTimeout [0,0,0];
if (_unit isKindOf "Air") then {call compile format ["_waypoint0 setwaypointStatements ['%1 getVariable ''logistic_state'' == 2;','hintsilent ''%1 moving to dropoff location.'';'];",_unit]}; 
if (_unit isKindOf "Plane") then {call compile format ["_waypoint0 setwaypointStatements ['%1 getVariable ''logistic_state'' == 2;','%1 setfuel 1; hintsilent ''%1 moving to dropoff location.'';'];",_unit]};
if (_unit isKindOf "Land") then {call compile format ["_waypoint0 setwaypointStatements ['%1 getVariable ''logistic_state'' == 2;','hintsilent ''%1 moving to dropoff location.'';'];",_unit]};
if (_unit isKindOf "Ship") then {call compile format ["_waypoint0 setwaypointStatements ['%1 getVariable ''logistic_state'' == 2;','hintsilent ''%1 moving to dropoff location.'';'];",_unit]};

_waypoint1 = _group addwaypoint[_dropoffPos, 5];
_waypoint1 setwaypointtype "TR UNLOAD";
_waypoint1 setwaypointTimeout [5,5,5];
if (_unit isKindOf "Air") then {call compile format ["_waypoint1 setwaypointStatements ['%1 getVariable ''logistic_state'' == 4;','%1 land ''LAND''; hintsilent ''%1 is ready.'';'];",_unit]};
if (_unit isKindOf "Plane") then {call compile format ["_waypoint1 setwaypointStatements ['%1 getVariable ''logistic_state'' == 4;','%1 setfuel 0; hintsilent ''%1 is ready.'';'];",_unit]};
if (_unit isKindOf "Land") then {call compile format ["_waypoint1 setwaypointStatements ['%1 getVariable ''logistic_state'' == 4;','hintsilent ''%1 is ready.'';'];",_unit]};
if (_unit isKindOf "Ship") then {call compile format ["_waypoint1 setwaypointStatements ['%1 getVariable ''logistic_state'' == 4;','hintsilent ''%1 is ready.'';'];",_unit]};

_waypoint2 = _group addwaypoint[_dropoffPos, 5];
_waypoint2 setwaypointtype "LOAD";
_waypoint2 setwaypointTimeout [0,0,0];
if (_unit isKindOf "Air") then {call compile format ["_waypoint2 setwaypointStatements ['%1 getVariable ''logistic_state'' == 2;','hintsilent ''%1 moving to dropoff location.'';'];",_unit]};
if (_unit isKindOf "Plane") then {call compile format ["_waypoint2 setwaypointStatements ['%1 getVariable ''logistic_state'' == 2;','%1 setfuel 1; hintsilent ''%1 moving to dropoff location.'';'];",_unit]};
if (_unit isKindOf "Land") then {call compile format ["_waypoint2 setwaypointStatements ['%1 getVariable ''logistic_state'' == 2;','hintsilent ''%1 moving to dropoff location.'';'];",_unit]};
if (_unit isKindOf "Ship") then {call compile format ["_waypoint2 setwaypointStatements ['%1 getVariable ''logistic_state'' == 2;','hintsilent ''%1 moving to dropoff location.'';'];",_unit]};

_waypoint3 = _group addwaypoint[_pickupPos, 5];
_waypoint3 setwaypointtype "TR UNLOAD";
_waypoint3 setwaypointTimeout [5,5,5];
if (_unit isKindOf "Air") then {call compile format ["_waypoint3 setwaypointStatements ['%1 getVariable ''logistic_state'' == 4;','%1 land ''LAND''; hintsilent ''%1 is ready.'';'];",_unit]};
if (_unit isKindOf "Plane") then {call compile format ["_waypoint3 setwaypointStatements ['%1 getVariable ''logistic_state'' == 4;','%1 setfuel 0; hintsilent ''%1 is ready.'';'];",_unit]};
if (_unit isKindOf "Land") then {call compile format ["_waypoint3 setwaypointStatements ['%1 getVariable ''logistic_state'' == 4;','hintsilent ''%1 is ready.'';'];",_unit]};
if (_unit isKindOf "Ship") then {call compile format ["_waypoint3 setwaypointStatements ['%1 getVariable ''logistic_state'' == 4;','hintsilent ''%1 is ready.'';'];",_unit]};

_waypoint4 = _group addwaypoint[_pickupPos, 5];
_waypoint4 setwaypointtype "CYCLE"; 

Edited by DTM2801
code update

Share this post


Link to post
Share on other sites

The script is updated to work with all vehicles. You can download an example mission here, it will move you across the map via all available vehicle types.

Edited by DTM2801
example mission updated

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×