Jump to content
VariousArtist

Infantry rearm script?

Recommended Posts

Hello!

Im desperatly using a script that solves Armas severe problem to rearm your AI buddies!

 

Dug the web but found no solution. Which is a bit surprising regards how god-awful it is to even attempt to rearm multiple AI buddies!

Does anybody knows a script that solves this problem and where to find it?

thx.

Share this post


Link to post
Share on other sites

Have you tried C2, very good at rearming your group ai. If you want to rearm HC groups then I would look at a script

 

Share this post


Link to post
Share on other sites
params [["_unit",objNull,[objNull]]];

	private _unitLoadout = getUnitLoadout _unit;
	private _rearmTargets = [mhq1,mhq2,ammobox];
	private _rearmTarget = objNull;
	private _pAmmoCnt = count ((magazines _unit) select  {_x == ((primaryWeaponMagazine _unit) select 0)});
	private _sAmmoCnt = count ((magazines _unit) select  {_x == ((secondaryWeaponMagazine _unit) select 0)});
	private _pAmmoCntNow = 0;
	private _sAmmoCntNow = 0;
	
	while {alive _unit} do {
	
		waitUntil {
			sleep 60;
			_rearmTarget = ([_rearmTargets,[],{_unit distance _x},"ASCEND"] call BIS_fnc_sortBy) select 0;
			_pAmmoCntNow = count ((magazines _unit) select  {_x == ((primaryWeaponMagazine _unit) select 0)});
			_sAmmoCntNow = count ((magazines _unit) select  {_x == ((secondaryWeaponMagazine _unit) select 0)});
			((_unit distance2D _rearmTarget) < 100) &&
			{isNull (objectParent _unit)} &&
			{_pAmmoCntNow < _pAmmoCnt || _sAmmoCntNow < _sAmmoCnt}
		};
		
		0 = [leader _unit, "SentCmdRearm"] remoteExecCall ["groupRadio",[0,-2] select isDedicated,false];
		
		_unit doMove (position _rearmTarget);
		waitUntil {sleep 1; (_unit distance _rearmTarget) < 10};
		_unit action ["rearm",_rearmTarget];
		0 = [_unit, "Rearming..."] remoteExecCall ["groupChat",[0,-2] select isDedicated,false];
		_unit setUnitLoadout _unitLoadout;
	};

 

  • Thanks 4

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

×