Skip to content

Surrender

Mike-MF edited this page Jan 22, 2023 · 4 revisions

This page will explain the usage of the Surrender function.


/*
 * Author: Mike
 * Random chance of an enemy surrendering when being suppressed.
 * Fires everytime a bullet passes close to an enemy.
 * Call from init.sqf
 *
 * Arguments:
 * 0: Group <GROUP>
 * 1: Chance <NUMBER> (default: 5)
 * 2: Distance <NUMBER> (default: 400)
 * 3: Rally Chance <NUMBER> (default: 0)
 *
 * Return Value:
 * None
 *
 * Example:
 * [My_Group, 50] call MFUNC(surrender)
 */

Usage

This function will give the AI a chance for surrendering when being suppressed. Even lower chances such as 10% will still often result in AI surrendering due to overwhelming fire.

The recommended value for regular AI would be around 1-5%.

Additionally you can add a distance check from the person suppressing (defaulted at 400m) and a chance of a unit to Rally and get back into the fight. (defaulted at 0) it will use a random time, minimum of 10 seconds and a maximum of 2 minutes.

Call from init.sqf

Example:

[My_Group, 1] call MFUNC(surrender);

Extended Examples:

{
    [_x, 1] call MFUNC(surrender);
} forEach [My_Group_One, My_Group_Two, My_Group_Three];

Extra Parameters

// Sides are: west, east, resistance & civilian
private _indepGroups = allGroups select {side _x isEqualTo resistance};
{
    [_x, 5, 300, 60] call MFUNC(surrender);
} forEach _indepGroups;
Clone this wiki locally