Jump to content
johnnyboy

Make Prairie Fire Radio Support action available to player when player respawns to next playable unit

Recommended Posts

I've created a Prairie Fire mission in Editor an placed the Radio Support module.  All units in player group are playable.  When I run the mission, the Radio Support action is available to player and works perfectly.  When player killed, I team switch or group respawn into next playable unit.  The Radio Support action is now no longer available to player.

 

How do make the Radio Support module available to player if he team switches or group respawns into a different playable unit?"

Share this post


Link to post
Share on other sites

Respawning on the same unit is not a problem. The module (and functions) is OK for that.

but:
Team switching is often (always) missed in modules (even BI ones).

In MP (when you can open the team switch menu and choose a unit):

addMissionEventHandler ["TeamSwitch",{
 params ["_previousUnit", "_newUnit"];
 call VN_fnc_artillery_actions;
}];


but that can't work with automatic respawn on group member (because the menu is not opened and this MEH doesn't fire)

You need to run something like:

0 = [] spawn {
  while {true} do {
    waitUntil {sleep 1; !isNil {player getVariable "bis_fnc_selectrespawntemplate_respawned"}};
    call VN_fnc_artillery_actions;
    sleep 10;
    player setVariable ["bis_fnc_selectrespawntemplate_respawned",nil];
  };
};

 

Now, you have both SP/MP tools for team switching.
Note: the radio support is not removed from killed character (so you can have double menu, pointing at dead). You need to add an extra script for removing (all) actions on dead.

  • Like 2
  • Thanks 2

Share this post


Link to post
Share on other sites
On 6/21/2021 at 3:21 PM, pierremgi said:

but that can't work with automatic respawn on group member (because the menu is not opened and this MEH doesn't fire)

You need to run something like:


0 = [] spawn {
  while {true} do {
    waitUntil {sleep 1; !isNil {player getVariable "bis_fnc_selectrespawntemplate_respawned"}};
    call VN_fnc_artillery_actions;
    sleep 10;
    player setVariable ["bis_fnc_selectrespawntemplate_respawned",nil];
  };
};

 

Thank you very much Pierre! The waitUntil condition wasn't working for me, so I changed it to look for case where player did not have an Action with title "Radio Support" and it worked perfectly.  I will probably refine this later to only units that have radios, or player is near a unit with a radio.  This is my changed code I put in in init.sqf:

0 = [] spawn {
  sleep 3;
  while {true} do {
    //waitUntil {sleep 1; !isNil {player getVariable "bis_fnc_selectrespawntemplate_respawned"}};
    waitUntil {sleep 1; {player actionParams _x select 0 == "Radio Support"} count actionIDs player == 0};
    call VN_fnc_artillery_actions;
    sleep 10;
    player setVariable ["bis_fnc_selectrespawntemplate_respawned",nil];
  };
};

 

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

×