Jump to content
Sign in to follow this  
bamboofats

Rearm vehicle magazines

Recommended Posts

hi all. I want to make a simple script just to refit magazines onto vehicles.

The vehicle rearm truck is only able to rearm non magazine weapons on vehicles. Magazine weapons will only have their current magazine rearmed, but will not replenish the number of magazines. Same goes for the script setvehicleammo 1

Does any one have a script that can do this? Currently I managed to refit a named vehicle entering a trigger area, by _car removeMagazines "100Rnd_127x99_M2" then ( _car addMagazine "100Rnd_127x99_M2" ) say 5 times, to fill up to the default. I attached the trigger to a rearm truck so if _car gets close its rearmed.

i want to add on to this script. lets say theres a large number of generic HMMWVs and UAZs in a mission that can be rearmed. Once one of it enters the trigger area, the script checks if its a UAZ_MG_CDF or HMMWV_M2 before giving it 50Rnd_127x107_DSHKM or 100Rnd_127x99_M2 magazines. can this be done? Must i give each of the vehicles a name to tell the script if its a UAZ or HMMV? Or is there a better way to do this rearming?

Share this post


Link to post
Share on other sites

you could trigger /call a routine/script with (type of vehicle) and then add ammo based on

case "hmmwv_m2":

case: "uaz_mg_ins":

etc etc

I have this for vehicles in ariport in evolution

sensor (in mission)

class Item2

{

position[]={4555.1587,339,10290.808};

a=720;

b=250;

angle=240;

rectangular=1;

activationBy="ANY";

age="UNKNOWN";

text="airport";

name="AirportIn";

class Effects

{

};

};

then in mainthreadc.sqf

BIS_EVO_Repair = 
{
_vec = (vehicle player);
_type = typeOf vehicle player;
//	hintsilent format["Type: %1",(_type)];

if(getDammage _vec > 0 or fuel _vec < 0.98 and not (_vec isKindOf "Man")) then
{
	_inrepairzone = ((_vec in list AirportIn) or (_vec in list farp1) or (_vec in list farp2) or (_vec in list farp3) or (_vec in list farp4) or (_vec in list reng1) or (_vec in list reng2) or (_vec in list reng3) or (_vec in list reng4) or (_vec in list dock1) or (_vec in list dock2));
	if(((_vec in list AirportIn) or (_vec in list farp1) or (_vec in list farp2) or (_vec in list farp3) or (_vec in list farp4) or (_vec in list reng1) or (_vec in list reng2) or (_vec in list reng3) or (_vec in list reng4) or (_vec in list dock1) or (_vec in list dock2)) and _vec != player and speed _vec > -2 and speed _vec < 2 and position _vec select 2 < 2.0 and (local _vec)) then
	{

		 titleText [localize "STR_M04t83", "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;titleText [localize "STR_M04t84", "PLAIN DOWN",0.3];};
		    _dam = (getDammage _vec)*100;
		    _ful = (Fuel _vec)*100;
		    hint format["Damage: %1\nFuel: %2",Round _dam,Round _ful];
		};
		_vec setVehicleAmmo 1;	
//adding cheats to planes
		if(_type == "A10") then 
		{
			_weapons = weapons _vec;
			if(not ("Mk82BombLauncher_6" in _weapons)) then {_vec addweapon "Mk82BombLauncher_6"};
			_vec removeMagazine "6Rnd_Mk82";
			_vec addMagazine "6Rnd_Mk82";
			_vec removeMagazine "1350Rnd_30mmAP_A10";
			_vec removeMagazine "1350Rnd_30mmAP_A10";
			_vec addMagazine "1350Rnd_30mmAP_A10";
			_vec addMagazine "1350Rnd_30mmAP_A10";
			_vec removeMagazine "2Rnd_Maverick_A10";
			_vec removeMagazine "2Rnd_Maverick_A10";
			_vec addMagazine "2Rnd_Maverick_A10";
			_vec addMagazine "2Rnd_Maverick_A10";
			if(("FFARLauncher_14" in _weapons)) then {_vec removeweapon "FFARLauncher_14"};
			_vec removeMagazine "14Rnd_FFAR";
			if(not ("FFARLauncher" in _weapons)) then {_vec addweapon "FFARLauncher"};
			_vec removeMagazine "38Rnd_FFAR";
			_vec removeMagazine "38Rnd_FFAR";
			_vec addMagazine "38Rnd_FFAR";
			_vec addMagazine "38Rnd_FFAR";
		};

so you can see for specific vehicles like A10 I have made a specific scriptto add weapons and ammo beyond the default...

you could cannibalise this approach

Share this post


Link to post
Share on other sites

haha thanks awesome, so typeOf is the trick. Another question, how to I set a trigger such that it is triggered by all units entering it, except for a truck called _trucks , which will not trigger. Can i script this diectly into the editor window for the trigger or must I use attached scripts.

Edited by bamboofats

Share this post


Link to post
Share on other sites

a bit like this above

_inrepairzone = (_vec in list AirportIn);

if((_vec in list AirportIn) and _vec != player and speed _vec > -2 and speed _vec < 2 and position _vec select 2 < 2.0 and (local _vec) and _vec != _trucks) then

repair etc

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  

×