Author: Pierre MGI
Author Website:

Short description: Need to allow supports on units which have a radio backpack only?
Date: 2017-01-06 18:29
Submitted by: Pierre MGI


Comments: (0)
Rating:



 

This script is made for UNSUNG DELTA mod and works with TFAR radios.You can adapt it easily while modifying the array of radio classes. You can even decide to make support available with a simple radio in inventory. This needs to change any backpack consideration for assignedItems.


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;
    };
  };




Tags: Radio,   Backpack,   Support,   Module