Jump to content
Sign in to follow this  
cc_kronus

Link combat support to radio backpack

Recommended Posts

 

In our community we use Alive to provide combat supports (transport, CAS, artillery, etc... ) and for anyone to use the support, he needs to carry a TFAR long range radio "tf_rt1523g_big_rhs". Unfortunately, Making a  supply  drop forces mision editors on habilitating the full Alive combat logistic suite, which adds quite a lot of complexity.   Instead, we use the vanilla supply drop. Easy to set up and flawless.   The negative side is that

 

a) vanilla supply drop is linked to an individual, if the individual dies it is the end of the supply drop.

b) the link to combat logistics is no longer operating after respawn.

c) the link cannot be moved to another individual.

 

What we want is that the supply drop moves to whoever carries the indicated TFAR radio.

 

Consequently Since I am a noob in coding, I have had a friend help me to make some code to put in the init.sqf to check who is carrying the LR radio and stablish the sincronizations to enable access to supply drop to that individual.  If the radio changes hands (because the original operator was killed), the supply drop should be accessible to the new radio carrier. But we can't make it work and I would appreciate any help. 

 

 _X would be each player, 

Req1 is combat support requester

prov1 is virtual supply drop provider.

 

if (hasInterface) then {  // Only executed at client side
checkbackpack = [ ] spawn {

if (!isNull (unitBackpack _x)) then {
  if ((""tf_rt1523g_big_rhs"" == typeof _backpack)) then [_X, req1, prov1] call BIS_fnc_addSupportLink;
} else {
  [req1, prov1] call BIS_fnc_removeSupportLink;// removes any existing support link.
}

sleep 1; // wait for a second to repeat
};
};

 

 

 

Share this post


Link to post
Share on other sites
if (hasInterface) then { 

	_checkbackpack = [player] spawn {

		params ["_unit"];

		_tfr_backpacks = [
		"tf_mr3000","tf_mr3000_multicam","tf_mr3000_rhs","tf_bussole","tf_mr3000_bwmod","tf_mr3000_bwmod_tropen",
		"tf_mr6000l","tf_rt1523g","tf_rt1523g_big","tf_rt1523g_black","tf_rt1523g_fabric","tf_rt1523g_green",
		"tf_rt1523g_rhs","tf_rt1523g_sage","tf_rt1523g_big_bwmod","tf_rt1523g_big_bwmod_tropen","tf_rt1523g_big_rhs","tf_rt1523g_bwmod",
		"tf_anprc155","tf_anprc155_coyote","tf_anarc164","tf_anarc210"
		];

			while {true} do {

				_backpack = backpack _unit;
				_islinked = synchronizedObjects _unit;

				if (_backpack in _tfr_backpacks && _islinked isEqualTo []) then {
				
					[_unit, req1, prov1] call BIS_fnc_addSupportLink;
				
				};
				
				if (!(_backpack in _tfr_backpacks) && !(_islinked isEqualTo [])) then {

					[req1, prov1] call BIS_fnc_removeSupportLink;.
				
				};

			sleep 10; 
			};
	};
};

 

 

Or even smarter one:

 

 

if (hasInterface) then { 

	fnc_handlesupport = {

		params ["_unit"];
		
		private _tfr_backpacks = [
		
			"tf_mr3000","tf_mr3000_multicam","tf_mr3000_rhs","tf_bussole","tf_mr3000_bwmod","tf_mr3000_bwmod_tropen",
			"tf_mr6000l","tf_rt1523g","tf_rt1523g_big","tf_rt1523g_black","tf_rt1523g_fabric","tf_rt1523g_green",
			"tf_rt1523g_rhs","tf_rt1523g_sage","tf_rt1523g_big_bwmod","tf_rt1523g_big_bwmod_tropen","tf_rt1523g_big_rhs","tf_rt1523g_bwmod",
			"tf_anprc155","tf_anprc155_coyote","tf_anarc164","tf_anarc210"
		];
			
		private _suppreq = (allMissionObjects "SupportRequester") select 0;
		
		if (isnull _suppreq) exitWith {};
		
		while {alive _unit} do {

			private _backpack = backpack _unit;
			private _islinked = synchronizedObjects _unit;

				if (_backpack in _tfr_backpacks && _islinked isEqualTo []) then {
						
					_unit synchronizeObjectsAdd [_suppreq];
					call BIS_SUPP_refreshMainWindow;		
				};
					
				if (!(_backpack in _tfr_backpacks) && !(_islinked isEqualTo [])) then {
				
						
						_unit synchronizeObjectsRemove [_suppreq];
						call BIS_SUPP_refreshMainWindow;
					
				};

			sleep 10; 
		};

	};
	

	[player] spawn fnc_handlesupport;


	player addEventHandler ["Respawn",{


			null = [_this select 0] spawn {
			
				params ["_player"];
				
					waitUntil {sleep 1; !isNull _player};
					[_player] spawn fnc_handlesupport;
			};
			

	}];

};

 

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  

×