Jump to content
Sign in to follow this  

Using artillery after switching to a new unit

Recommended Posts

As the title says, the game does not allow the player to use artillery after they switch to another unit, or after they die and switch to another unit. I've synched the artillery to every single controllable unit in the game. But that does not help, because as soon as I switch to another unit or die I can no longer view it under the "Supports" area.


I'm not sure why something so simple cannot be accomplished in any insightful way, and not a single search result or tutorial on youtube can bring up something useful.





I've even made unique support provider / requesters for each and every unit previously, which did nothing. To say I'm fucking pissed at how difficult it is to do such a simple function would be putting it lightly. Three games, dozens of DLCs later, and something so simple and remedial is obscenely hard to accomplish in this game.

Share this post

Link to post
Share on other sites

I did find this post but I couldn't get it to work https://forums.bistudio.com/forums/topic/157541-re-adding-supports-after-player-was-killed/

I tried using it from a trigger after the leader died, although the code runs nothing seems to happen.


just noticed this but too late to try it https://forums.bistudio.com/forums/topic/144510-multiple-support-requesters/



Share this post

Link to post
Share on other sites

Switching makes sense on SP. You have a Mission Event Handler working for that: TeamSwitch. You could need it for support but also tasks... unit trat, addactions... all these tools you applied to player, and often missed for switchable AIs (in my case at least).


So, for example:

addMissionEventHandler ["teamSwitch", {
  params ["_ancient","_newbie"];
  _tasks = simpleTasks _ancient;
    _task = _tasks select _foreachindex;
    _taskdest = taskDestination _task;
    _taskdescr = taskDescription _task;
    _tasktype = taskType _task;
    _taskState = taskState _task;
    _newTask = _newbie createSimpleTask ["newbieTask"+str(_foreachindex)];
    _newTask setSimpleTaskDescription _taskdescr;
    _newTask setSimpleTaskDestination _taskdest;
    _newTask setSimpleTaskType _tasktype;
    _newTask setTaskState _taskState;
  } forEach _tasks;

  [req,_ancient] call BIS_fnc_removeSupportLink;
  _newbie spawn MGI_fnc_radioSupport;
  BIS_requesterFSM = nil;
  [req] execVM "A3\modules_f\supports\init_requester.sqf";
  [drop_veh] 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;

  _newbie setUnitTrait ["medic",true];
  _newbie setUnitTrait ["engineer",true];
  _newbie setUnitTrait ["explosiveSpecialist",true];

NOTE: Sorry, my code above,  for support link is a bit complicated. I had to make it work for a conditional radio backpack. See the f2kSel links instead.

  • Like 1

Share this post

Link to post
Share on other sites

The code supplied by Larrow in the second link works great for me.

I incorporated it in the onteamswitch command so I didn't need the waituntil, I had to remove the isdedicated command  from the script


the red code is optional and not part of the support script, it allows units to carry on moving to waypoints after team switch. Place code in units init or logic init.

null=[] spawn {sleep 0.5;onTeamSwitch "[_from] call TransferProviders;selectPlayer (leader _from); {_x doFollow leader _from} foreach units _from; selectPlayer _to;"}


I don't know about tasks I've not looked at them in A3.










  • Like 1

Share this post

Link to post
Share on other sites

So I take it this is the important stuff:



if (! isDedicated) then {

waitUntil {!isNull player};

TransferProviders = {

_oldUnit = _this select 0;

_oldProviders = _oldUnit getVariable ["BIS_SUPP_allProviderModules",[]];

_HQ = _oldUnit getVariable ["BIS_SUPP_HQ",nil];

if (isNil {player getVariable ["BIS_SUPP_HQ",nil]}) then {

if ((count _oldProviders) > 0) then {


_providerModule = _x;


if (typeOf _x == "SupportRequester" && _oldUnit in (synchronizedObjects _x)) then {

[player, _x, _providerModule] call BIS_fnc_addSupportLink;


}forEach synchronizedObjects _providerModule;

}forEach _oldProviders;


player setVariable ["BIS_SUPP_transmitting", false];

player kbAddTopic ["BIS_SUPP_protocol", "A3\Modules_F\supports\kb\protocol.bikb", "A3\Modules_F\supports\kb\protocol.fsm", {call compile preprocessFileLineNumbers "A3\Modules_F\supports\kb\protocol.sqf"}];

player setVariable ["BIS_SUPP_HQ", _HQ];



_used = _oldUnit getVariable [format ["BIS_SUPP_used_%1",_x], 0];

player setVariable [format ["BIS_SUPP_used_%1", _x], _used, true]

} forEach [









_thread = [] spawn {

_unit = player;

while {true} do {

waitUntil {_unit != player };

hintSilent " Player has changed";

[_unit] call TransferProviders;

_unit = player;






But where would I place it? The INT line for the support requester? Or provider? Both?

Share this post

Link to post
Share on other sites

Save as an sqf file example   "TransferProviders.sqf"


then in an init file or trigger or logic init you just need to start the script using   null=[] execvm "TransferProviders.sqf";

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