Jump to content
Sign in to follow this  
callaway

Airfield Resupply

Recommended Posts

So, how is this done as in Evo and other mods. I'd like to have the airfield be a "resupply" point and auto repair/rearm/refuel vehicles without getting 1 meter from trucks. I'm not sure how they've done it, but I have a few ideas. Thanks for any help you can provide.

Share this post


Link to post
Share on other sites

How about you just unpbo the evo mission, and have a look at the code yourself :)

Share this post


Link to post
Share on other sites

Speeder, thanks for your suggestion, I've done that, but as anyone who has looked at an evo map knows, it's a TON of stuff. I'm having trouble deciphering most of it. I thought maybe there was a script used to do this that was adopted by them.

Refuel and repair are really easy triggers; however, rearm is a totally different nut to crack.

Share this post


Link to post
Share on other sites

Don't know about Evolution, but here is the script used in Domination. Remove the includes, any references to ACE and mando stuff, it might work. Calls to XfVehicleChat can be easily replaced with a normal vehicleChat, you don't loose that much from the script I guess. If not it should at least get you going with the more advanced stuff (turret problems):

// by Xeno
private ["_config","_count","_i","_magazines","_object","_type","_type_name"];

#include "x_setup.sqf"
#include "x_macros.sqf"

_object = _this select 0;

_type = typeof _object;

if (_object isKindOf "ParachuteBase") exitWith {};

if (isNil "x_reload_time_factor") then {x_reload_time_factor = 1;};

//if (!local _object) exitWith {};

if (d_reload_engineoff) then {
   _object action ["engineOff", _object];
};
if (!alive _object) exitWith {};
_object setFuel 0;
_object setVehicleAmmo 1;   // Reload turrets / drivers magazine

_type_name = [_type,0] call XfGetDisplayName;

[_object,format ["Servicing %1... Please stand by...", _type_name]] call XfVehicleChat;

_magazines = getArray(configFile >> "CfgVehicles" >> _type >> "magazines");

if (count _magazines > 0) then {
   _removed = [];
   {
       if (!(_x in _removed)) then {
           _object removeMagazines _x;
           _removed = _removed + [_x];
       };
   } forEach _magazines;
   {
       [_object, format ["Reloading %1", _x]] call XfVehicleChat;
       sleep x_reload_time_factor;
       if (!alive _object) exitWith {};
       _object addMagazine _x;
   } forEach _magazines;
};

_count = count (configFile >> "CfgVehicles" >> _type >> "Turrets");

if (_count > 0) then {
   for "_i" from 0 to (_count - 1) do {
       scopeName "xx_reload2_xx";
       _config = (configFile >> "CfgVehicles" >> _type >> "Turrets") select _i;
       _magazines = getArray(_config >> "magazines");
       _removed = [];
       {
           if (!(_x in _removed)) then {
               _object removeMagazines _x;
               _removed = _removed + [_x];
           };
       } forEach _magazines;
       {
           _mag_disp_name = [_x,2] call XfGetDisplayName;
           [_object,format ["Reloading %1", _mag_disp_name]] call XfVehicleChat;
           sleep x_reload_time_factor;
           if (!alive _object) then {breakOut "xx_reload2_xx"};
           _object addMagazine _x;
           sleep x_reload_time_factor;
           if (!alive _object) then {breakOut "xx_reload2_xx"};
       } forEach _magazines;
       // check if the main turret has other turrets
       _count_other = count (_config >> "Turrets");
       // this code doesn't work, it's not possible to load turrets that are part of another turret :(
       // nevertheless, I leave it here
       if (_count_other > 0) then {
           for "_i" from 0 to (_count_other - 1) do {
               _config2 = (_config >> "Turrets") select _i;
               _magazines = getArray(_config2 >> "magazines");
               _removed = [];
               {
                   if (!(_x in _removed)) then {
                       _object removeMagazines _x;
                       _removed = _removed + [_x];
                   };
               } forEach _magazines;
               {
                   _mag_disp_name = [_x,2] call XfGetDisplayName;
                   [_object, format ["Reloading %1", _mag_disp_name]] call XfVehicleChat;
                   sleep x_reload_time_factor;
                   if (!alive _object) then {breakOut "xx_reload2_xx"};
                   _object addMagazine _x;
                   sleep x_reload_time_factor;
                   if (!alive _object) then {breakOut "xx_reload2_xx"};
               } forEach _magazines;
           };
       };
   };
};
_object setVehicleAmmo 1;   // Reload turrets / drivers magazine
if (__ACEVer || __MandoVer) then {
   if (_object isKindOf "Air") then {
       _fcleft = _object getVariable "mando_flaresleft";
       _maxfc = _object getVariable "mando_maxflares";
       if (format ["%1", _fcleft] != "<null>" && format ["%1", _maxfc] != "<null>") then {
           _object setVariable ["mando_flaresleft", _maxfc];
       };
   };
};
sleep x_reload_time_factor;
if (!alive _object) exitWith {};
[_object, "Repairing..."] call XfVehicleChat;
_object setDamage 0;
sleep x_reload_time_factor;
if (!alive _object) exitWith {};
[_object, "Refueling..."] call XfVehicleChat;
while {fuel _object < 0.99} do {
   //_object setFuel ((fuel _vehicle + 0.1) min 1);
   _object setFuel 1;
   sleep 0.01;
};
sleep x_reload_time_factor;
if (!alive _object) exitWith {};
[_object, format ["%1 is ready...", _type_name]] call XfVehicleChat;

if (true) exitWith {};

Edit: Oh, this is for Arma1 Domination 3.70. You might be better off downloading Domination for Arma2 and look for x_scripts\x_reload.sqf.

Share this post


Link to post
Share on other sites

Thanks, great stuff! Maybe I can get something working for others to easily use.

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  

×