Reinforcements - Theseus-Aegis/MissionTemplate GitHub Wiki

This page will explain the usage of the Reinforcements function.


/*
 * Author: Jonpas, Mike
 * Sets visibility of units, simulation and AI behaviour of a group along with any vehicles manned by the group.
 * Call from initServer.sqf
 *
 * Arguments:
 * 0: Groups <ARRAY>
 * 1: Disable <BOOL> (default: true)
 * 2: Distance <NUMBER> (default: 0)
 *
 * Return Value:
 * None
 *
 * Example:
 * [[Group_1, Group_2]] call MFUNC(reinforcements)
 * [[Group_1, Group_2], false] call MFUNC(reinforcements)
 * [[Group_1, Group_2], false, 50] call MFUNC(reinforcements)
 */

Usage

This function will hide or unhide a group of units for use later, preserving behaviour, loadouts and waypoints. Will also do the same to vehicles provided a group member is inside one.

Upon unhiding units you can add a "distance" check for nearby players, if they are closer than the number specified they will not be unhidden. The distance check parameter should never be used for hiding units on mission start, only unhiding them.

Call from trigger with Server check or initServer.sqf

Examples:

[My_Group] call MFUNC(reinforcements); // Will hide units.
if (!isServer) exitWith {};
[My_Group, false] call TAC_Mission_fnc_reinforcements; // Will unhide units via Trigger

Multiple Groups

// Hiding Groups
[[My_Group_One, My_Group_Two, My_Group_Three]] call MFUNC(reinforcements);

// Unhiding Groups (via Trigger)
if (!isServer) exitWith {};
[[My_Group_One, My_Group_Two, My_Group_Three], false] call TAC_Mission_fnc_reinforcements;

Staggered unhiding
Note: the 10/20 in the waitAndExecute function is done in seconds, and the delay is from when the trigger is activated, not the last thing that ran.

While activating 1 or 2 groups will not be noticeable the more you activate at once the more noticeable it will become. i.e 5 groups of 10 men at once is noticeable. 2 groups is not. In this case the example below should always be used.

Alternatively you can also use the Reinforcement Waves function, it will stagger out unhiding the units every X seconds you wish. (See alternative example, will unhide all 6 groups 2 seconds apart.)

Example:

if (!isServer) exitWith {};
[[Example_Group_1, Example_Group_2], false] call TAC_Mission_fnc_reinforcements;

[{
    [[Example_Group_3, Example_Group_4], false] call TAC_Mission_fnc_reinforcements;
}, [], 10] call CBA_fnc_waitAndExecute;

[{
    [[Example_Group_5, Example_Group_6], false] call TAC_Mission_fnc_reinforcements;
}, [], 20] call CBA_fnc_waitAndExecute;

Alternative Example:

if (!isServer) exitWith {};
[[Example_Group_1, Example_Group_2, Example_Group_3, Example_Group_4, Example_Group_5, Example_Group_6], 2] call TAC_Mission_fnc_reinforcementWaves;

Distance Checking

if (isServer) then {
    [Example_Group_1, false, 500] call TAC_Mission_fnc_reinforcements;
};
⚠️ **GitHub.com Fallback** ⚠️