End Conditions - Global-Conflicts-ArmA/Olsen-Framework-Arma-3 GitHub Wiki

The end conditions are checks to see if the mission has been completed. Stock these checks only run every 60 seconds, to reduce server stress and to make sure the mission does not end immediately. But the checking rate can be changed in the serverSettings.sqf file.

Example:

GVAR(EndConditionFrequency) = 30; // Frequency in seconds that the end conditions are checked

Ending the mission

To end the mission "TEXT" call FUNC(EndMission); is used, where TEXT is the text displayed on the top of the end screen. You can see an example of the end screen and read more about it here: End screen.

You can use <br/> to make line breaks, like pressing enter, in the end screen text.

When calling FUNC(EndMission) it must be called from the inside of an exitWith not a then.

Destruction example:

if (!(alive UAZ)) exitWith {

    "BLUFOR has destroyed the UAZ" call FUNC(EndMission);

};

If the UAZ is dead, then the mission ends with "BLUFOR has destroyed the UAZ".

Linking conditions

The end conditions can have unlimited complexity, they can be linked inline with || or &&. In other words with OR or AND.

The end conditions can also be linked through a method called nesting if statements.

Inline

Inline example: EVAC A and EVAC B is not valid code.

if (!(alive HVT) && (EVAC A || EVAC B)) exitWith {

    "BLUFOR has executed the HVT and successfully evacuated" call FUNC(EndMission);

};

If the HVT is dead and BLUFOR has evacuated from point A or point B, then the mission ends with "BLUFOR has executed the HVT and successfully evacuated".

Nesting

Nesting example: BLUFORCASUALTY is not valid code.

if (!(alive HVT)) exitwith {

    if (BLUFORCASUALTY < 35) then {

        "BLUFOR has executed the HVT without too many casualties" call FUNC(EndMission);

    } else {

        "BLUFOR has executed the HVT and fucked up" call FUNC(EndMission);

    };

};

If the HVT is dead and BLUFOR has taken less then 35% casualties then it ends with "BLUFOR has executed the HVT without too many casualties".

If the HVT is dead and BLUFOR has taken more then 35% casualties then it ends with "BLUFOR has executed the HVT and fucked up".

Destruction condition

Destroying static objects or vehicles or killing high value targets, this is all coded in the same fashion. Using the function alive it returns true if the unit is alive. But we want it to return true, if the unit is dead, for our end condition so we use ! which inverts the result.

Example:

if (!(alive UAZ)) exitWith {

    "BLUFOR has destroyed the UAZ" call FUNC(EndMission);

};

Casualty condition

The casualty percentage of a team can be retrieved with _teamCasualty = "TEAM" call FUNC(CasualtyPercentage);. The casualty percentage can be used to end the mission or to determine how well the mission was completed.

TEAM is the framework name for the team.

Example:

_westCasualty = "USMC" call FUNC(CasualtyPercentage);

if (_westCasualty >= 50) exitWith {

    "OPFOR DECISIVE VICTORY<br/>BLUFOR has retreated due to casualties." call FUNC(EndMission); 

};

Count Area condition

The ammount of units within a certain distance to an object can be retrieved with
[SIDE,RADIUS,OBJECT] call FUNC(AreaCount). The ammount can be used to check if a certain area has been cleaned.

Example:

_westCount = [west,300,Gamelogic1] call FUNC(AreaCount);

if(_westCount <= 0) exitWith {

     "OPFOR DECISIVE VICTORY<br/>No Blufor remaining in OBJ." call FUNC(EndMission);

};
⚠️ **GitHub.com Fallback** ⚠️