Important! : name your modules requester (here req), (virtual or real support providers, here cas1, arty1, drop1) in init.sqf:
MGI_radios = ["UNS_alice_FR","UNS_USMC_RTO","UNS_USMC_RTO2","UNS_ARMY_RTO","UNS_ARMY_RTO2","UNS_SF_RTO"];
MGI_fnc_radioSupport = compileFinal preprocessFileLineNumbers "MGI_fnc_radioSupport.sqf";
player spawn MGI_fnc_radioSupport; // the code for RTO
player addMPEventHandler ["MPRespawn",{(_this select 0) spawn MGI_fnc_radioSupport}]; // for respawn loop
addMissionEventHandler ["teamSwitch", { // like for tasks, but in this case, SP team switch is one of the toughest thing to make it work! to be tested deeper...
params ["_ancient","_newbie"];
[req,_ancient] call BIS_fnc_removeSupportLink;
_newbie spawn MGI_fnc_radioSupport;
BIS_requesterFSM = nil;
[req] execVM "A3\modules_f\supports\init_requester.sqf";
[drop1] execVM "A3\modules_f\supports\init_provider_virtual.sqf";
[cas1] execVM "A3\modules_f\supports\init_provider_virtual.sqf";
[arty1] execVM "A3\modules_f\supports\init_provider_virtual.sqf";
call BIS_SUPP_refreshMainWindow;
}]; The script MGI_fnc_radioSupport.sqf : _plyr = _this;
_plyr spawn {
_unit = _this;
while {alive _unit} do {
waituntil {sleep 2; (backpack _unit in MGI_radios or (backpack _unit) isKindOf "TFAR_bag_base")}; // TFAR_bag_base is case of TFAR mod present
[_unit,req,cas1] call BIS_fnc_addSupportLink;
[_unit,req,drop1] call BIS_fnc_addSupportLink;
[_unit,req,arty1] call BIS_fnc_addSupportLink;
waituntil {sleep 2; (!(backpack _unit in MGI_radios) && !((backpack _unit) isKindOf "TFAR_bag_base"))};
[req,_unit] call BIS_fnc_removeSupportLink;
};
}; |