Arma 3 Scripting

BIS_fnc_EXP_camp_manager

  • Runs with spawn
  • Arma 3 v1.62

Function · Markdown · JSON · original wiki page

Description

Synchronises the start of an Apex campaign mission between the server and the clients by moving the mission through the states "Waiting", "Intro", "Loadout" and "Started". Each state change fires a scripted event (see BIS_fnc_EXP_camp_manager_triggerEvent). The function is spawned on every machine by the campaign's shared init script (\A3\Missions_F_Exp\Campaign\Scripts\init.sqf, included by each mission's init.sqf), after the handlers for these events have been added. It is meant for internal use by the campaign.

On every machine, it stores the intro videos, their subtitle scripts and the noCinematics flag in missionNamespace.

On a machine with a player (hasInterface), it waits for player, fires the "Waiting" event locally, adds a public variable event handler that fires the event of every new state received from the server, and adds a "Respawn" event handler that deletes the player's old body (once).

On the server, after the mission time has started:

  1. setTimeMultiplier is set to 0.1 so the synchronisation does not move the time of day.
  2. It waits until every player has registered as preloaded (see BIS_fnc_EXP_camp_manager_onPlayerRegistered) or until mission time reaches maxWaitDelay, then waits minWaitDelay seconds.
  3. In multiplayer, if intro videos are given, it sets the state "Intro".
  4. In multiplayer, if wantsLoadoutSelection is true, it sets the state "Loadout", waits until every player has registered a finished loadout selection or maxLoadoutDelay seconds have passed, forces respawn on all machines (0 remoteExecCall ["setPlayerRespawnTime", 0]) and waits minLoadoutDelay seconds.
  5. It sets the state "Started" and restores the previous time multiplier.

In single-player the mission goes directly from "Waiting" to "Started".

Syntax

[introVideos, introVideosSubtitles, minWaitDelay, minLoadoutDelay, maxWaitDelay, maxLoadoutDelay, wantsLoadoutSelection, noCinematics] spawn BIS_fnc_EXP_camp_manager

Parameters:

Returns: Nothing

Examples

Example 1

As in the Apex campaign mission EXP_m02:

[
    ["A3\Missions_F_Exp\video\EXP_m02_vTitlecard.ogv", "A3\Missions_F_Exp\video\EXP_m02_vIN.ogv"],
    ["", "a3\Missions_F_Exp\Campaign\Briefings\EXP_m02_briefing.sqf"],
    nil, nil, nil, nil,
    true,
    false
] spawn BIS_fnc_EXP_camp_manager;

See also

BIS_fnc_EXP_camp_manager_getState · BIS_fnc_EXP_camp_manager_setState · BIS_fnc_EXP_camp_manager_triggerEvent · BIS_fnc_EXP_camp_manager_onPlayerRegistered · BIS_fnc_addScriptedEventHandler