Skip to content

Reinforcements

TyroneMF edited this page Mar 2, 2021 · 31 revisions

This page will explain the usage of the Reinforcements function.

Contents


How it works

The function takes a group variable name, then iterates disabling all AI behaviours, disables simulation and then hides the unit. If the units are in a vehicle it will also disable the simulation and hide the vehicle too. When hidden these units cannot be seen, heard or damaged in any way.

Any waypoints or behaviours set on these units will remain after you run the function on them.


Usage

Each group you want to act as reinforcements must have a group variable name. You can set this by double clicking the rectangle above the group leader. For explanation purposes the group we'll use is called Example_Group_1

Once named you must run the function on the group, this is done via init.sqf and NOT the editor init field. [Example_Group_1, true] call FUNC(reinforcements);

Upon loading into your mission that group will now be hidden.

If you have multiple groups you can run a forEach loop to make things easier.

{
    [_x, true] call FUNC(Reinforcements);
} forEach [Example_Group_1, Example_Group_2];

This directly translates into

[Example_Group_1, true] call FUNC(Reinforcements);
[Example_Group_2, true] call FUNC(Reinforcements);

_x is a magic variable, it will iterate through everything in your array which is [Example_Group_1, Example_Group_2];


Activation

Now that you have your reinforcement units set, you will need to activate them at some point. Above uses a macro which cannot be resolved in game, Macros only work in the file structure outside of the game.

Attempting to use [Example_Group_1, false] call FUNC(Reinforcements); in game will give you an error.

The func macro works like this: FUNC(x) == TAC_Scripts_fnc_x

So to correctly activate your units you would need to use
[Example_Group_1, false] call TAC_Scripts_fnc_reinforcements;

This can be called from a trigger in the onActivation.

Be aware that running a large forEach loop on hiding the units at mission start is fine, but doing it mid-game will cause noticable lag. Simply activating the units with a time delay is much smoother and less noticeable.

[Example_Group_1, false] call TAC_Scripts_fnc_reinforcements;

[{
    [Example_Group_2, false] call TAC_Scripts_fnc_reinforcements;
}, [], 10] call CBA_fnc_waitAndExecute;

This will activate Example_Group_1 and then wait 10s and then activate Example_Group_2. the waitAndExecute function is cheap and costs no performance to run while a trigger is expensive.

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

This can also be expanded on to make things a bit easier, 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.

{
    [_x, false] call TAC_Scripts_fnc_reinforcements;
} forEach [Example_Group_1, Example_Group_2];

[{
    {
        [_x, false] call TAC_Scripts_fnc_reinforcements;
    } forEach [Example_Group_3, Example_Group_4];
}, [], 10] call CBA_fnc_waitAndExecute;

[{
    {
        [_x, false] call TAC_Scripts_fnc_reinforcements;
    } forEach [Example_Group_5, Example_Group_6];
}, [], 20] call CBA_fnc_waitAndExecute;

This block will activate 6 groups in the space of 20 seconds.


Randomisation

You can randomise the time at which these units will spawn with CBA_fnc_waitAndExecute

[Example_Group_1, false] call TAC_Scripts_fnc_reinforcements;

[{
    [Example_Group_2, false] call TAC_Scripts_fnc_reinforcements;
}, [], (random 20) + 10] call CBA_fnc_waitAndExecute;

on the time delay using (random 20) will give you a number between 0-20. Then the + 10 will simply add another 10 seconds onto it.

Using this method is helpful if you want to give your reinforcements a larger spread for filtering in.


Tips

Before placing your reinforcements, build your mission first. Once you have your objectives done and are under the AI limit then you can worry about placing additional AI.

To speed up the naming process of groups, simply place a group and give it a variable name of Example_Group_1, if you then copy and paste this group the next one will already be named Example_Group_2 the x here: Example_Group_X goes up sequentially.

If your group name has the number anywhere but the end it will automatically gain a _x at the end. i.e Example_1_Group becomes Example_1_Group_1 and then any other units copied become Example_1_Group_2 and so on.

If you are stacking multiple waitAndExecute into a trigger, do it in a text editor and not in the onActivation box. It will help.


Next Page | Previous Page

Clone this wiki locally