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:
- setTimeMultiplier is set to 0.1 so the synchronisation does not move the time of day.
- 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.
- In multiplayer, if intro videos are given, it sets the state
"Intro". - 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. - 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:
introVideos: Array of Strings - (Optional, default []) paths of the intro videos to play in order; an empty array skips the introintroVideosSubtitles: Array of Strings - (Optional, default []) for each intro video, the path of a subtitle script run with execVM, or "" for noneminWaitDelay: Number - (Optional, default 2) seconds to wait after all players have preloadedminLoadoutDelay: Number - (Optional, default 2) seconds to wait after the loadout selection has endedmaxWaitDelay: Number - (Optional, default 30) mission time in seconds after which the server stops waiting for players to preloadmaxLoadoutDelay: Number - (Optional, default 300) maximum time in seconds to wait for all players to finish the loadout selectionwantsLoadoutSelection: Boolean - (Optional, default true) false to skip the loadout selectionnoCinematics: Boolean - (Optional, default false) true to disable BIS_fnc_EXP_camp_setCinematicMode; cinematics must then be handled manually
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