Difference between revisions of "Arma 3: Respawn"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<tt>([^= ]+)<\/tt>" to "{{hl|$1}}")
m (Some wiki formatting)
 
Line 48: Line 48:
 
| Show singleplayer death screen
 
| Show singleplayer death screen
 
| {{n/a}}
 
| {{n/a}}
|style="text-align:center;"| {{Icon|checked}}
+
| style="text-align: center" | {{Icon|checked}}
|style="text-align:center;"| {{Icon|unchecked}}
+
| style="text-align: center" | {{Icon|unchecked}}
  
 
|-
 
|-
Line 56: Line 56:
 
| Respawn to a seagull
 
| Respawn to a seagull
 
| Spectator, EndMission
 
| Spectator, EndMission
|style="text-align:center;"| {{Icon|unchecked}}
+
| style="text-align: center" | {{Icon|unchecked}}
|style="text-align:center;"| {{Icon|checked}}
+
| style="text-align: center" | {{Icon|checked}}
  
 
|-
 
|-
Line 64: Line 64:
 
| Respawn on spot where player died
 
| Respawn on spot where player died
 
| Instant, Counter
 
| Instant, Counter
|style="text-align:center;"| {{Icon|checked}}
+
| style="text-align: center" | {{Icon|checked}}
|style="text-align:center;"| {{Icon|checked}}
+
| style="text-align: center" | {{Icon|checked}}
  
 
|-
 
|-
Line 85: Line 85:
 
You can have multiple markers simply by adding any text behind the name, e.g. ''respawn_west1'', ''respawn_westBase'' etc. When no markers are defined, player is respawned on position where he started the mission. More about marker respawn can be found [http://killzonekid.com/arma-scripting-tutorials-respawn-on-marker/ here]. Alternatively you can also use the ''Respawn Position'' module.
 
You can have multiple markers simply by adding any text behind the name, e.g. ''respawn_west1'', ''respawn_westBase'' etc. When no markers are defined, player is respawned on position where he started the mission. More about marker respawn can be found [http://killzonekid.com/arma-scripting-tutorials-respawn-on-marker/ here]. Alternatively you can also use the ''Respawn Position'' module.
 
| Base, Counter
 
| Base, Counter
|style="text-align:center;"| {{Icon|checked}}
+
| style="text-align: center" | {{Icon|checked}}
|style="text-align:center;"| {{Icon|checked}}
+
| style="text-align: center" | {{Icon|checked}}
  
 
|-
 
|-
Line 93: Line 93:
 
| Respawn to the next available playable unit in a group. When none is left, BIRD respawn is used instead.
 
| Respawn to the next available playable unit in a group. When none is left, BIRD respawn is used instead.
 
| Group, EndMission
 
| Group, EndMission
|style="text-align:center;"| {{Icon|unchecked}}
+
| style="text-align: center" | {{Icon|unchecked}}
|style="text-align:center;"| {{Icon|checked}}
+
| style="text-align: center" | {{Icon|checked}}
  
 
|-
 
|-
Line 101: Line 101:
 
| Respawn to the next available playable unit of the same side (selected using team switch window). When none is left, BIRD respawn is used instead.
 
| Respawn to the next available playable unit of the same side (selected using team switch window). When none is left, BIRD respawn is used instead.
 
| Side, EndMission
 
| Side, EndMission
|style="text-align:center;"| {{Icon|unchecked}}
+
| style="text-align: center" | {{Icon|unchecked}}
|style="text-align:center;"| {{Icon|checked}}
+
| style="text-align: center" | {{Icon|checked}}
 
|}
 
|}
  
Line 131: Line 131:
 
respawnTemplates[] = { "MenuPosition", "Spectator" };
 
respawnTemplates[] = { "MenuPosition", "Spectator" };
 
</syntaxhighlight>
 
</syntaxhighlight>
<code>{{cc|initPlayerLocal.sqf}}
+
<sqf>
{{cc|--- Enable full spectator in respawn screen}}
+
// initPlayerLocal.sqf
 +
// --- Enable full spectator in respawn screen
 
{
 
{
[[missionNamespace]] [[setVariable]] [<nowiki/>[[Magic Variables#x|_x]], [[true]]];
+
missionNamespace setVariable [_x, true];
} [[forEach]] [
+
} forEach [
"BIS_respSpecAi", {{cc|Allow spectating of AI}}
+
"BIS_respSpecAi", // Allow spectating of AI
"BIS_respSpecAllowFreeCamera", {{cc|Allow moving the camera independent from units (players)}}
+
"BIS_respSpecAllowFreeCamera", // Allow moving the camera independent from units (players)
"BIS_respSpecAllow3PPCamera", {{cc|Allow 3rd person camera}}
+
"BIS_respSpecAllow3PPCamera", // Allow 3rd person camera
"BIS_respSpecShowFocus", {{cc|Show info about the selected unit (dissapears behind the respawn UI)}}
+
"BIS_respSpecShowFocus", // Show info about the selected unit (dissapears behind the respawn UI)
"BIS_respSpecShowCameraButtons", {{cc|Show buttons for switching between free camera, 1st and 3rd person view (partially overlayed by respawn UI)}}
+
"BIS_respSpecShowCameraButtons", // Show buttons for switching between free camera, 1st and 3rd person view (partially overlayed by respawn UI)
"BIS_respSpecShowControlsHelper", {{cc|Show the controls tutorial box}}
+
"BIS_respSpecShowControlsHelper", // Show the controls tutorial box
"BIS_respSpecShowHeader", {{cc|Top bar of the spectator UI including mission time}}
+
"BIS_respSpecShowHeader", // Top bar of the spectator UI including mission time
"BIS_respSpecLists" {{cc|Show list of available units and locations on the left hand side}}
+
"BIS_respSpecLists" // Show list of available units and locations on the left hand side
 
];
 
];
</code>
+
</sqf>
  
 
=== Official Templates ===
 
=== Official Templates ===
Line 238: Line 239:
 
Both templates feature a similar respawn UI and therefore share the following options:
 
Both templates feature a similar respawn UI and therefore share the following options:
 
* '''Timeout disabling'''
 
* '''Timeout disabling'''
** Mission designer can disable the timeout used between death of a unit and opening of the respawn screen.:
+
** Mission designer can disable the timeout used between death of a unit and opening of the respawn screen: <sqf>
<code style="margin-left: 4em">[[missionNamespace]] [[setVariable]] ["BIS_RscRespawnControls_skipBlackOut", [[true]], [[true]]]; {{cc|disable timout}}
+
missionNamespace setVariable ["BIS_RscRespawnControls_skipBlackOut", true, true]; // disable timout
[[missionNamespace]] [[setVariable]] ["BIS_RscRespawnControls_skipBlackOut", [[nil]], [[true]]]; {{cc|reset to original timeout}}</code>
+
missionNamespace setVariable ["BIS_RscRespawnControls_skipBlackOut", nil, true]; // reset to original timeout
 +
</sqf>
 
* '''Autorespawn'''
 
* '''Autorespawn'''
 
** A checkbox can be ticket to let the player automatically respawn once the coundown reached 0. If disabled player is not respawned immediately, but must confirm selection by clicking on "RESPAWN" button.
 
** A checkbox can be ticket to let the player automatically respawn once the coundown reached 0. If disabled player is not respawned immediately, but must confirm selection by clicking on "RESPAWN" button.
Line 349: Line 351:
 
'''Author:''' {{User|R3vo}}<br>
 
'''Author:''' {{User|R3vo}}<br>
 
<spoiler>
 
<spoiler>
<syntaxhighlight lang="cpp">
+
<sqf>
 
/*
 
/*
 
Author: R3vo
 
Author: R3vo
Line 424: Line 426:
 
copyToClipboard _export;
 
copyToClipboard _export;
 
_export
 
_export
</syntaxhighlight>
+
</sqf>
 
</spoiler>
 
</spoiler>
 
{{Feature|important|Loadouts are only available after they were added with the [[BIS_fnc_addRespawnInventory]] function!}}
 
{{Feature|important|Loadouts are only available after they were added with the [[BIS_fnc_addRespawnInventory]] function!}}
Line 433: Line 435:
 
In order to let players respawn with the gear they started the mission with, create the following two files in your mission folder and add the code:<br>
 
In order to let players respawn with the gear they started the mission with, create the following two files in your mission folder and add the code:<br>
 
{{hl|[[Event Scripts|initPlayerLocal.sqf]]}}
 
{{hl|[[Event Scripts|initPlayerLocal.sqf]]}}
<code>[[player]] [[setVariable]] ["TAG_LoadoutStart", [[getUnitLoadout]] [[player]]];</code>
+
<sqf>
{{hl|[[Event Scripts|onPlayerRespawn.sqf]]}}
+
player setVariable ["TAG_LoadoutStart", getUnitLoadout player];
<code>[[player]] [[setUnitLoadout]] ([[player]] [[getVariable]] ["TAG_LoadoutStart", []]);</code>
+
player addEventHandler ["Respawn", { player setUnitLoadout (player getVariable ["TAG_LoadoutStart", []]); }];
 +
</sqf>
  
 
Alternatively you can do:<br>
 
Alternatively you can do:<br>
 
{{hl|[[Event Scripts|initPlayerLocal.sqf]]}}
 
{{hl|[[Event Scripts|initPlayerLocal.sqf]]}}
<code>[[player]] [[setVariable]] ["TAG_LoadoutStart", [[getUnitLoadout]] [[player]]];
+
<sqf>player setVariable ["TAG_LoadoutStart", getUnitLoadout player];</sqf>
[[player]] [[addEventHandler]] ["Respawn", { [[player]] [[setUnitLoadout]] ([[player]] [[getVariable]] ["TAG_LoadoutStart", []]); }];</code>
+
{{hl|[[Event Scripts|onPlayerRespawn.sqf]]}}
 +
<sqf>player setUnitLoadout (player getVariable ["TAG_LoadoutStart", []]);</sqf>
  
  
 
{{GameCategory|arma3|Editing}}
 
{{GameCategory|arma3|Editing}}

Latest revision as of 22:11, 15 April 2022


Settings


Scripting

Scripting Commands

Scripting Functions

Event Scripts


Respawn Types

Type is represented either by respawn ID, or by its name.

respawn = "BASE";
respawn = 3;
ID Name Description Default Templates onPlayerKilled onPlayerRespawn
0 "NONE" Show singleplayer death screen N/A Checked Unchecked
1 "BIRD" Respawn to a seagull Spectator, EndMission Unchecked Checked
2 "INSTANT" Respawn on spot where player died Instant, Counter Checked Checked
3 "BASE" Respawn on a marker(s) start by following strings:

Unit respawn

  • respawn (used only when side variant is not found)
  • respawn_west
  • respawn_east
  • respawn_guerrila
  • respawn_civilian

Vehicle respawn

  • respawn (used only when side variant is not found)
  • respawn_vehicle_west
  • respawn_vehicle_east
  • respawn_vehicle_guerrila
  • respawn_vehicle_civilian

You can have multiple markers simply by adding any text behind the name, e.g. respawn_west1, respawn_westBase etc. When no markers are defined, player is respawned on position where he started the mission. More about marker respawn can be found here. Alternatively you can also use the Respawn Position module.

Base, Counter Checked Checked
4 "GROUP" Respawn to the next available playable unit in a group. When none is left, BIRD respawn is used instead. Group, EndMission Unchecked Checked
5 "SIDE" Respawn to the next available playable unit of the same side (selected using team switch window). When none is left, BIRD respawn is used instead. Side, EndMission Unchecked Checked


Respawn Templates

Respawn Templates are case-sensitive!

Templates are pre-defined scripts called when player dies and respawns. They are defined in an array and can be combined together.

respawnTemplates[] = { "MenuInventory", "MenuPosition" };

Additionally, you can define side specific templates. When a side has no unique templates, it will use general respawnTemplates instead.

 respawnTemplatesWest[] = { "MenuInventory" };
 respawnTemplatesEast[] = { "Counter" };
 respawnTemplatesGuer[] = { "Tickets" };
 respawnTemplatesCiv[] = { "Spectator" };
 respawnTemplatesVirtual[] = {}; // Virtual players, used mainly in Curator (Zeus) missions
When the respawnTemplates entry is missing, default templates based on the respawn type are used.

Conflicts

The respawn templates "MenuPosition" and "Spectator" are not compatible since MenuPosition will force the map open. Instead you can use the following settings to get access to the full spectator mode:

// description.ext
respawn = 3;
respawnTemplates[] = { "MenuPosition", "Spectator" };

// initPlayerLocal.sqf // --- Enable full spectator in respawn screen { missionNamespace setVariable [_x, true]; } forEach [ "BIS_respSpecAi", // Allow spectating of AI "BIS_respSpecAllowFreeCamera", // Allow moving the camera independent from units (players) "BIS_respSpecAllow3PPCamera", // Allow 3rd person camera "BIS_respSpecShowFocus", // Show info about the selected unit (dissapears behind the respawn UI) "BIS_respSpecShowCameraButtons", // Show buttons for switching between free camera, 1st and 3rd person view (partially overlayed by respawn UI) "BIS_respSpecShowControlsHelper", // Show the controls tutorial box "BIS_respSpecShowHeader", // Top bar of the spectator UI including mission time "BIS_respSpecLists" // Show list of available units and locations on the left hand side ];

Official Templates

Class Description Preview
None Singleplayer death screen. Default in singleplayer.
Spectator Spectator Mode.
Instant Currently empty.
Base Currently empty.
Group Cutscene showing a newly controlled unit.
Side Cutscene showing a newly controlled unit.
Seagull Operation Flashpoint-style seagull respawn
Wave Adjusts respawn counter so players spawns together. Wave delay is based on respawnDelay and Player's respawn time is set between 1 and 2 times respawnDelay: if respawnDelay is set to e.g 10, respawn waves happen every 10 seconds. If a player dies and the next respawn wave is in 3 seconds, the player's respawn time is set to 17 seconds to match the next wave.
Tickets Use a limited respawn ticket pool for players. Pool can be applied to everyone, a side, a group or a single unit.

Use BIS_fnc_respawnTickets to update the amount of available tickets. Note that the template will have no effect if this function is never used, meaning players outside of all given pools will have infinite respawns.

Counter Show a simple respawn countdown.
EndMission Automatically fail the mission once all players are dead (for NONE, BIRD, GROUP and SIDE respawn types) or when all respawn tickets are exceeded (for INSTANT and BASE respawn types with Tickets template)
MenuPosition Lets players select from available respawn positions defined either by respawn markers, see Respawn Types, by BIS_fnc_addRespawnPosition function or by the Respawn Position module. A new screen was released with Arma 3 logo black.png1.60 and brings new functionalities together with a new design.

Item disabling

A3 respawnSelectPosition.jpg
MenuInventory

Lets players pick a respawn loadout defined in CfgRespawnInventory. Loadouts can be added using BIS_fnc_addRespawnInventory function. A new screen was released with Arma 3 logo black.png1.60 and brings new functionalities together with a new design.

Role selection

  • Respawn inventories are sorted in to Roles which can be defined in CfgRoles.

Item disabling

  • Roles and loadouts can be disabled. This can happen automatically (e.g., Role/loadout limit was reached) or can be manually by calling BIS_fnc_showRespawnMenuDisableItem.

Limits

  • Roles and loadouts can be limited. This way only limited number of player can use given role/loadout in a mission. For details on how to do that see BIS_fnc_addRespawnInventory.
A3 respawnSelectInventory.jpg

Options shared by MenuInventory and MenuPosition
Both templates feature a similar respawn UI and therefore share the following options:

  • Timeout disabling
  • Autorespawn
    • A checkbox can be ticket to let the player automatically respawn once the coundown reached 0. If disabled player is not respawned immediately, but must confirm selection by clicking on "RESPAWN" button.
  • Spectator Camera
    • The Spectator Camera used in here is slightly modified (no free camera available etc.) version of Spectator Mode. For full documentation see Spectator Mode documentation.
    • Mission designer needs to use the Spectator respawn template, the camera is disabled otherwise.

Custom Respawn Templates

New templates can be defined in global Config.cpp or in mission and campaign Description.ext files.
Example: Show text


Loadouts and Roles

The main purpose of the roles is to make things more clear and simple for player when selecting loadout. All the loadouts available in a mission are now divided into various roles.
Mission designer can use roles already created in the game config, or custom roles can be defined in description.ext file. Loadouts with no role assigned are automatically assigned to the Default role.
Loadout config example: Show text

Export Function:

  • The following function will copy a complete respawn inventory to your clipboard, see function header for more information.

Author: R3vo
Show text

Loadouts are only available after they were added with the BIS_fnc_addRespawnInventory function!


Restore Loadout on Respawn

In order to let players respawn with the gear they started the mission with, create the following two files in your mission folder and add the code:
initPlayerLocal.sqf

player setVariable ["TAG_LoadoutStart", getUnitLoadout player]; player addEventHandler ["Respawn", { player setUnitLoadout (player getVariable ["TAG_LoadoutStart", []]); }];

Alternatively you can do:
initPlayerLocal.sqf

player setVariable ["TAG_LoadoutStart", getUnitLoadout player];

onPlayerRespawn.sqf

player setUnitLoadout (player getVariable ["TAG_LoadoutStart", []]);