Jump to content
Sign in to follow this  
kuwahara<ANZAC>

scripting help adding magazines

Recommended Posts

ok iv got this script below that is working all fine,

the problem i am getting is with the rearming of the hummerMK.

i can get it to reload just 1 set of 48 mk rounds.

can someone help me with filling it with the 4 sets of 48 not just the 1??

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_player = _this;

if (not local (_player)) exitWith {};

for [{_loop=0}, {_loop<1}, {_loop=_loop}] do

{

_rounds = "nil";

_rockets = "nil";

_missiles = "nil";

_vec = (vehicle player);

_type = typeOf vehicle player;

if(getDammage _vec > 0 or fuel _vec < 0.98 and not (_vec isKindOf "Man") and (local _vec)) then

{

if({_vec == _x} count list AirportIn > 0 and _vec != player and speed _vec > -2 and speed _vec < 2 and position _vec select 2 < 2.0 and (local _vec)) then

{

switch (_type) do

{

case "AH6":

{

_rounds = "4000Rnd_762x51_M134";

_rockets = "14Rnd_FFAR";

_missiles = "nil";

};

case "HMMWVMK":

{

_rounds = "48Rnd_40mm_MK19";

_rockets = "nil";

_missiles = "nil";

};

};

titleText ["Servicing", "PLAIN DOWN",0.3];

for [{_loop2=0}, {_loop2<1}, {_loop2=_loop2}] do

{

sleep 0.200;

if (getDammage _vec > 0) then {_vec setDammage ((getDammage _vec)-0.0125);};

if (Fuel _vec < 1) then {_vec setFuel ((Fuel _vec)+0.0125);};

if (getDammage _vec == 0 and Fuel _vec == 1) then {_loop2=1;};

if(_vec != vehicle player or speed _vec < -2 or speed _vec > 2 or position _vec select 2 > 2.0) then {_loop2=1;_rounds = "nil";_rockets = "nil";_missiles = "nil";titleText ["Service Aborted", "PLAIN DOWN",0.3];};

};

If (_rounds != "nil") then {_vec removeMagazines _rounds;};

If (_rockets != "nil") then {_vec removeMagazines _rockets;};

If (_missiles != "nil") then {_vec removeMagazines _missiles;};

If (_rounds != "nil") then {_vec addMagazine _rounds;titleText ["Rearming", "PLAIN DOWN",0.3];};

sleep 3.000;

If (_rockets != "nil") then {_vec addMagazine _rockets;titleText ["Rearming", "PLAIN DOWN",0.3];};

sleep 3.000;

If (_missiles != "nil") then {_vec addMagazine _missiles;titleText ["Rearming", "PLAIN DOWN",0.3];};

sleep 3.000;

titleText ["Good to go", "PLAIN DOWN",0.3];

};

};

sleep 1.000;

};

Share this post


Link to post
Share on other sites

setVehicleAmmo might be a useful command. It does appear that it assumes that all vehicles use only single magazines. Many vehicles in ArmA use multiple mags...

For now, since you are using a hefty script anyway, you could add more magazines for each exceptional case requires. eg:

vehicle addMagazine "48Rnd_40mm_MK19"

Share this post


Link to post
Share on other sites

try this

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

EnableRadio true

_load = _this select 0

?((_load distance repstationheli)>15) :player sidechat "You are too Far from the repair helipad!";exit

_loadalt = getpos_load

_loadaltx = _loadalt select 0

_loadalty = _loadalt select 1

_loadaltz = _loadalt select 2

?(_loadaltz > 5) :player sidechat "You are too High from the repair pad!";exit

_typ = typeOf vehicle _load;

~1

player sidechat format ["%1 will be ready in 30 sec. Please wait..",_typ]

_load engineon false

player sidechat "Cleaning fuel tanks. Please wait.."

_load setfuel 0.2

~5

player sidechat "Adding old ammo to new pods. Please wait.."

? (_typ == "AV8B") : {_load removeWeapon _x} forEach Weapons _load;{_load removeMagazine _x} forEach magazines _load

? (_typ == "AV8B2") : {_load removeWeapon _x} forEach Weapons _load;{_load removeMagazine _x} forEach magazines _load

? (_typ == "UH60MG"):{_load removeWeapon _x} forEach Weapons _load;{_load removeMagazine _x} forEach magazines _load;

? (_typ == "UH60"):{_load removeWeapon _x} forEach Weapons _load;{_load removeMagazine _x} forEach magazines _load;

? (_typ == "AH1W"):{_load removeWeapon _x} forEach Weapons _load;{_load removeMagazine _x} forEach magazines _load;

? (_typ == "Truck5tMG"):{_load removeWeapon _x} forEach Weapons _load;{_load removeMagazine _x} forEach magazines _load;

? (_typ == "HMMWVMK"):{_load removeWeapon _x} forEach Weapons _load;{_load removeMagazine _x} forEach magazines _load;

? (_typ == "M1Abrams"):{_load removeWeapon _x} forEach Weapons _load;{_load removeMagazine _x}forEach magazines _load;

? (_typ == "Stryker_ICV_M2"): {_load removeWeapon _x} forEach Weapons _load;{_load removeMagazine _x} forEach magazines _load;

~3

player sidechat format ["Adding new pods to %1. Please wait..",_typ]

? (_typ == "AV8B"): _load addMagazine "300Rnd_25mm_GAU12"; _load addMagazine "5Rnd_GBU12_AV8B"; _load addWeapon "BombLauncher"; _load addWeapon "GAU12"; _load selectweapon "GAU12";

? (_typ == "AV8B2"): _load addMagazine "300Rnd_25mm_GAU12";_load addMagazine "4Rnd_Sidewinder_AV8B";_load addWeapon "SidewinderLaucher";_load addWeapon "GAU12"; _load selectweapon "GAU12";

? (_typ == "AH1W"): _load addMagazine "38Rnd_FFAR";_load addMagazine "8Rnd_Hellfire";_load addMagazine "750Rnd_M197_AH1";_load addWeapon "M197";_load addWeapon "FFARLauncher";_load addWeapon "HellfireLauncher";_load selectweapon "M197";

? (_typ == "UH60MG"): _load addMagazine "2000Rnd_762x51_M134";_load addweapon "M134";_load selectweapon "M134";

? (_typ == "UH60"): _load addMagazine "38Rnd_FFAR";_load addWeapon "FFARLauncher";_load selectweapon "FFARLauncher";

? (_typ == "Truck5tMG"): _load addMagazine "2000Rnd_762x51_M134"; _load addweapon "M2";_load selectweapon "M2";

? (_typ == "HMMWVMK"): _load addMagazine "48Rnd_40mm_MK19"; _load addMagazine "48Rnd_40mm_MK19";_load addMagazine "48Rnd_40mm_MK19";_load addMagazine "48Rnd_40mm_MK19";_load addweapon "MK19";_load selectweapon "MK19";

? (_typ == "M1Abrams"): _load addMagazine "20Rnd_120mmSABOT_M1A2";_load addMagazine "20Rnd_120mmHE_M1A2";_load addMagazine "1200Rnd_762x51_M240";_load addWeapon "M256";_load addWeapon "M240_veh";_load selectweapon "M240_veh";

? (_typ == "Stryker_ICV_M2"): _load addMagazine "100Rnd_127x99_M2";_load addMagazine "100Rnd_127x99_M2";_load addMagazine "100Rnd_127x99_M2";_load addMagazine "100Rnd_127x99_M2";_load addMagazine "100Rnd_127x99_M2";_load addMagazine "100Rnd_127x99_M2";_load addWeapon "M2";_load selectweapon "M2";

~5

player sidechat "Filling fuel tanks. Please wait.."

_load setfuel 0.4

~1

_load setfuel 0.6

~1

_load setfuel 0.8

~1

_load setfuel 1

_load setdamage (getdammage _load)-1

~3

player sidechat format ["%1 is ready for flight, You can head off now.",_typ]

_load engineon true

EnableRadio false

exit

to use this add a action or a trigger to fire the script when your close to the "repstationheli" pad

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_unit = _this select 0;

genAct = _unit addAction ["Repair @ Helipad", "reload\Reload.sqs"];

exit;

i know its sqs but should be easy to convert to sqf

Share this post


Link to post
Share on other sites

This script doesn't reload secondary turrets (tank commaner, uh60 door gunner). setVehicleAmmo does refill the secondary turret's magazine, but I don't know how to add magazines to those weapons, nor even how to refer to them to check their ammo load. Does anybody have any ideas?

Share this post


Link to post
Share on other sites

armatechs script is very nice but can some please help me set it so it works off more than 1 (repair pad)//

?((_load distance repstationheli)>15) :player sidechat "TO FAR AWAY TEXT";exit

i would like to to check repstationheli and if not close to it then check for repstationheli_1 and exit if not close to either or continue if close to either.

anyone know how i do this?

Share this post


Link to post
Share on other sites

make 2 scripts and just rename the second scirpt to whatever2 and change the heli pads names in the second script

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  

×