R3vo/Sandbox – User

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
Line 1: Line 1:
{{SideTOC}}
{{SideTOC}}
==Overview==
[[File:A3 RespawnScreen.jpg|400px]]
The AI is characterized by a set of [[AI Sub-skills|sub-skills]].
== Description.ext ==
A wide range of [[Description.ext]] entries let you configure respawn settings for your mission. See [https://community.bistudio.com/wiki/Description.ext#Respawn.2FRevive Description.ext - Respawn] for a detailed documentation


Value of each of the [[AI Sub-skills|sub-skills]] is inherited either from [[skill]] value (set by skill slider in [[Mission Editor: Units|Insert Unit]] dialogue (default 0.6) or [[setSkill]] command) or directly defined by [[setSkill]] command.
== Eden Editor ==
[[Eden Editor]] offers alot of settings to customise your respawn system, however not all functionalities are available. Furthermore settings made in the description.ext will overwrite settings made in [[Eden Editor]].
[[File:A3 EdenEditor Respawn.jpg|400px]]
== Scripting ==
''' Scripting Commands '''
* [[playerRespawnTime]]
* [[setPlayerRespawnTime]]
* [[respawnVehicle]]


This value is interpolated into the corresponding range. This range is defined by a range set in [[CfgAISkill]] influenced by the value that comes from ''Game Options/Difficulty - AI Level'' (skillAI or precisionAI in player's .Arma3Profile if aiLevelPreset=3 (custom) is used).
''' Scripting Functions '''
* [[:Category:Function Group: Respawn|Respawn Functions]]


==CfgAISkill==
''' Event Scripts '''
CfgAISkill is a set of arrays, related to [[AI Sub-skills]], defining the interpolation curve of each of the sub-skill.
* [[Event Scripts|onPlayerRespawn.sqf]]
* [[Event Scripts|onPlayerKilled.sqf]]


== Respawn Types ==
Type is represented either by respawn ID, or by its name.
<code>respawn = "BASE";
respawn = 3;</code>
{| class="wikitable"
! ID
! Name
! Description
! Default Templates
! onPlayerKilled
! onPlayerRespawn
|-
| 0
| "NONE"
| Show singleplayer death screen
| -
|style="text-align:center;"| {{task/}}
|style="text-align:center;"| {{task}}


'''Example:'''
|-
In {w, x, y, z} value from (w,y) gets interpolated into (x,z).
| 1
[[File:CfgAISkill.jpg|thumb|Interpolation with vanilla A3 CfgAISkill]]
| "BIRD"
''spotDistance[] = {0,0.2, 1,0.4};'' value in a range 0-1 will change into value in a range 0.2-0.4.
| Respawn to a seagull
''setSkill ["spotDistance", 0.5]'' results in ''skill "spotDistance"'' returning ''0.3''
| Spectator, EndMission
|style="text-align:center;"| {{task}}
|style="text-align:center;"| {{task/}}


===Notes===
|-
More than 2 pairs of defining values can be used (minimum is 2 pairs).
| 2
| "INSTANT"
| Respawn on spot where player died
| Instant, Counter
|style="text-align:center;"| {{task/}}
|style="text-align:center;"| {{task/}}


The values are used to interpolate on run-time, so even after setting sub-skill by script command it will be interpolated and bound by this array.
|-
| 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 [http://killzonekid.com/arma-scripting-tutorials-respawn-on-marker/ here]. Alternatively you can also use the ''Respawn Position'' module.
| Base, Counter
|style="text-align:center;"| {{task/}}
|style="text-align:center;"| {{task/}}


'''See also:''' [[:Category:AI|AI]], [[AI Sub-skills]], [[skill]], [[setSkill]], [[setUnitAbility]]
|-
| 4
| "GROUP"
| Respawn to the next available playable unit in a group. When none is left, BIRD respawn is used instead.
| Group, EndMission
|style="text-align:center;"| {{task}}
|style="text-align:center;"| {{task/}}


===Defaults Arma 3===
|-
aimingAccuracy[] = {0, 0, 1, 1};
| 5
aimingShake[] = {0, 0, 1, 1};
| "SIDE"
aimingSpeed[] = {0, 0.5, 1, 1};
| 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.
commanding[] = {0, 0, 1, 1};
| Side, EndMission
courage[] = {0, 0, 1, 1};
|style="text-align:center;"| {{task}}
endurance[] = {0, 0, 1, 1};
|style="text-align:center;"| {{task/}}
general[] = {0, 0, 1, 1};
|}
reloadSpeed[] = {0, 0, 1, 1};
spotDistance[] = {0, 0, 1, 1};
spotTime[] = {0, 0, 1, 1};


==Sub-Skills==
== Respawn Templates ==
[[File:AI_skill_and_level.png|thumb|AI skill/level/final skill]]
Templates are pre-defined scripts called when player dies and respawns. They are defined in an array and can be combined together.
Sub-skills are a set of parameters ultimately defining the individual AI unit performance in the game.
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[] = {}; {{codecomment|// Virtual players, used mainly in [[Curator]] missions}}
{{Important|When the respawnTemplates entry is missing, default templates based on the respawn type are used}}




{| class="wikitable" style="float: center; margin: 0 0 0 0.5em; max-width: 100%;"
==Official Templates==
! Name
{| class="wikitable"
! Class
! Description
! Description
! Preview
|-
|-
| ''aimingAccuracy''
| '''None'''
|  
| Singleplayer death screen. Default in singleplayer.
*Affects how well the AI can lead a target
|
*Affects how accurately the AI estimate range and calculates bullet drop
 
*Affects how well the AI compensates for weapon dispersion
*Affects how much the AI will know to compensate for recoil (Higher value = more controlled fire)
*Affects how certain the AI must be about its aim on target before opening fire
|-
|-
| ''aimingShake''
| '''Spectator'''
|  
| [[Spectator Mode]].
*Affects how steadily the AI can hold a weapon (Higher value = less weapon sway)
|
 
|-
|-
| ''aimingSpeed''
| '''Instant'''
|  
| Currently empty.
*Affects how quickly the AI can rotate and stabilize its aim (Higher value = faster, less error)
|
 
|-
|-
| ''commanding''
| '''Base'''
|  
| Currently empty.
*Affects how quickly recognized targets are shared with the group (Higher value = faster reporting)
|
 
|-
|-
| ''courage''
| '''Group'''
|  
| Cutscene showing a newly controlled unit.
*Affects unit's subordinates' morale (Higher value = more courage)
|
 
|-
|-
| ''endurance''
| '''Side'''
|  
| Cutscene showing a newly controlled unit.
*''Disabled in {{arma3}}''
|
 
|-
|-
| ''general''
| '''Seagull'''
|  
| OFP-style seagull respawn
*Raw "Skill", value is distributed to sub-skills unless defined otherwise. Affects the AI's decision making.
|
 
|-
|-
| ''reloadSpeed''
| '''Wave'''
|  
| Adjusts respawn counter so players spawns together (wave delay is based on ''respawnDelay'')
*Affects the delay between switching or reloading a weapon (Higher value = less delay)Object Modifiers
|
 
|-
|-
| ''spotDistance''
| '''Tickets'''
|  
| Use a limited respawn ticket pool for players. Pool can be applied to everyone, a side, a group or a single unit.
*Affects the AI ability to spot targets within it's visual or audible range (Higher value = more likely to spot)
 
*Affects the accuracy of the information (Higher value = more accurate information)
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.
|
 
|-
|-
| ''spotTime''
| '''Counter'''
|  
| Show a simple respawn countdown.
*Affects how quick the AI react to death, damage or observing an enemy (Higher value = quicker reaction)
|
 
|-
| '''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|Respawn Types]], by [[BIS_fnc_addRespawnPosition]] function or by the ''Respawn Position'' module. A new screen was released with {{GVI|arma3|1.60}} and brings new functionalities together with a new design.
 
'''Item disabling'''
*Respawn positions can be disabled automatically (e.g., unit used as respawn point is dead) or manually by calling [[BIS_fnc_showRespawnMenuDisableItem]]<br>
| [[File:A3 respawnSelectPosition.jpg|200px]]
 
|-
| '''MenuInventory'''
|
Lets players pick a respawn loadout defined in ''[[Description.ext|CfgRespawnInventory]]''. Loadouts can be added using [[BIS_fnc_addRespawnInventory]] function. A new screen was released with {{GVI|arma3|1.60}} and brings new functionalities together with a new design.
 
'''Role selection'''
*Respawn inventories are sorted in to Roles which can be defined in ''CfgRole'', see (ADD LINK TO EXAMPLE).
 
'''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]].<br>
 
'''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]].
| [[File:A3 respawnSelectInventory.jpg|200px]]
|}
|}


===Notes===
'''Options shared by ''MenuInventory'' and ''MenuPosition'''''<br>
Each sub-skill is used in several calculations. Value of each sub-skill is inherited from the value set by skill slider in [[Mission Editor: Units|Insert Unit]] dialogue or [[setSkill]] command, or more precisely with setSkill alternative syntax. This value is interpolated into ranges defined in [[CfgAISkill]] and multiplied by a value of AI Level Skill or Precision set in player's profile (.Arma3Profile file).
Both templates feature a similar respawn UI and therefore share the following options:
 
*'''Timeout disabling'''
**Mission designer can disable the timeout used between death of a unit and opening of the respawn screen.<br>
{{Inline code|[[missionNamespace]] [[setVariable]] [ "BIS_RscRespawnControls_skipBlackOut", [[true]], [[true]] ];//Disable timout }}<br>
{{Inline code|[[missionNamespace]] [[setVariable]] [ "BIS_RscRespawnControls_skipBlackOut", [[nil]], [[true]] ];//Reset to original timeout}}
 
*'''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  [[EG_Spectator_Mode|Spectator Mode documentation]].
**Mission designer needs to use the '''Spectator''' respawn template, the camera is disabled otherwise.
 


== AI Behaviour ==
A group's [[behaviour]] determines how it's units move from one point to another, behave when idle, and how they engage an enemy. This setting can override [[2D_Editor:_Waypoints#Combat_Mode|Combat Mode]], [[2D_Editor:_Waypoints#Formation|Formation]], and [[2D_Editor:_Waypoints#Speed|Speed]]. As with those three modes, this setting also takes effect as the waypoint becomes active. Behaviour effects are most obvious in infantry groups.


The [[setBehaviour]] & [[setWaypointBehaviour]] commands can be used to change group behaviour.  
== Custom Respawn Templates ==
New templates can be defined in global [[Config.cpp]] or in mission and campaign [[Description.ext]] files.<br>
'''Example''':<br>
<spoiler>
class CfgRespawnTemplates
{
{{codecomment|// Class used in respawnTemplates entry}}
class myTag_beacon
{
{{codecomment|// Function or script executed upon death. Parameters passed into it are the same as are passed into onPlayerKilled.sqf file}}
onPlayerKilled = "\myAddon\scripts\respawnBeacon.sqf";
{{codecomment|// Function or script executed upon respawn. Parameters passed into it are the same as are passed into onPlayerRespawn.sqf file}}
onPlayerRespawn = "\myAddon\scripts\respawnBeacon.sqf";
{{codecomment|// Default respawn delay (can be overwitten by description.ext entry of the same name)}}
respawnDelay = 20;
{{codecomment|// 1 to respawn player when he joins the game. Available only for INSTANT and BASE respawn types}}
{{codecomment|// Can be overridden by description.ext attribute of the same name}}
respawnOnStart = 1;
};
class Spectator
{
onPlayerRespawn = "BIS_fnc_respawnSpectator";
};
};
</spoiler>


*'''No Change''' - The group will continue to behave in it's current state.
== Loadouts and Roles ==
*'''Careless''' -  Careless behaviour will cause the group move and behave in a very non-combat manner. The group will form into a ''Compact Column''-like formation, where each unit will directly follow the man in front rather than moving in a formation. Soldiers will carry their weapons in a safe, lowered position (rifles across body, pistols holstered) and walk slowly. Infantry will not fire on enemy targets (unless they have wounded legs), but vehicles will still fire on enemies. Vehicle occupants will be turned out when able. Groups in careless mode do not switch to a more alert mode if enemies are encountered. All unit types show preference moving along roads whenever possible.
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.<br>
*'''Safe''' - Similar to ''Careless'', except the group will change behaviour to ''Aware'' upon detecting an enemy unit.
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.<br>
*'''Aware''' - This is the default behaviour mode. The group will move at moderate speed, with soldiers generally standing upright and making some occasional efforts to use cover when available. Most unit types still prefer to travel along roads and vehicles will travel in convoy irrespective of their current formation type. Tracked vehicles will not use headlights, and will drive across any surface with no preference given to staying on roads. Air units will not use lights. When enemies are known to be in the area, troops will disembark from any of their group's wheeled transport vehicles and the group will move on foot while carrying out "[http://en.wikipedia.org/wiki/Bounding_Overwatch bounding]" maneuvers, making stronger use of available cover. As of Arma 3 v1.36, AI Infantry appear to avoid being on the road directly, but will usually stay somewhat close to the road if possible.
'''Loadout config example:'''<br>
*'''Combat''' - This behaviour mode will result in a much higher combat performance than ''Aware''. Infantry groups will always move using bounding maneuvers, and will normally keep crouched or prone unless moving. They will make some use of available cover, choosing to spend some time crawling when in cover. They will call out contact reports more frequently. They seem to occasionally send out one unit ahead of the group as a scout. No vehicles will use headlights at night. If enemy units are known to be in the area, infantry groups will move is a more cautious manner. The "DISMISS" waypoint is cancelled. All lights are turned off. The limited speed waypoint parameter gets ignored. AI will eject from damaged vehicles. As of Arma 3 v1.36, AI seem to take about a full minute to get across roads.
<spoiler>
*'''Stealth''' - Stealth mode will cause a group to behave in a very cautious manner. Infantry groups will move via cover whenever possible, spending much of their time prone or moving along cover. When they need to cross open ground, they appear to occasionally choose to send scouts running ahead to reach the cover ahead as quickly as possible. A stealthy infantry formation can tend to end up quite fractured. Wheeled vehicles will still follow roads if available, but no longer convoy. Tanks will avoid knocking down trees. If enemy units are known to be in the area, infantry groups will move more closely together and spend even more time prone.
<syntaxhighlight lang="cpp">
<br/>
class CfgRoles
[[Image:Behaviour paths.gif|600px]]
{
    class Assault//Class name used in CfgRespawnInventory
    {
        displayName = $STR_A3_Role_Assault;//Name of the role, displayed in the respawn menu
        icon = "a3\missions_f_exp\data\img\classes\assault_ca.paa";//Icon shown next to the role name in the respawn screen
    };
};
class CfgRespawnInventory
{
    class B_SquadLeader//Class of the respawn inventory, used by BIS_fnc_addRespawnInventory
    {
        displayName = $STR_b_soldier_sl_f0;//Name of the respawn inventory
        role = "Assault";Role the respawn inventory is assigned to
        icon = "\A3\ui_f\data\map\VehicleIcons\iconManLeader_ca.paa";//Icon shown next to the role
        show = "side group _this == west";//Condition used to make specific respawn inventories only avaiable for specfic sides, must return [[Boolean]]
        weapons[] = {//Weapons
            "arifle_SPAR_01_khk_F",
            "Rangefinder",
            "hgun_P07_khk_F"
        };
        magazines[] = {//Magazines
            "SmokeShell",
            "SmokeShell",
            "16Rnd_9x21_Mag",
            "16Rnd_9x21_Mag",
            "16Rnd_9x21_Mag",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "HandGrenade",
            "HandGrenade"
        };
        items[] = {//Useable items
            "FirstAidKit"
        };
        linkedItems[] = {//Linked items, also weapon items, helmet etc.
            "V_PlateCarrierSpec_tna_F",
            "H_HelmetB_Enh_tna_F",
            "optic_ERCO_blk_F",
            "acc_pointer_IR",
            "NVGoggles_tna_F",
            "ItemGPS",
            "ItemMap",
            "ItemCompass",
            "ItemWatch",
            "ItemRadio"
        };
        uniformClass = "U_B_T_Soldier_SL_F";//uniform
    };
</syntaxhighlight>
</spoiler>
'''Export Function''':
*The following function will copy a complete respawn inventory to your clipboard, see function header for more information, contact [[User:R3vo]] if you have questions.<br>
<spoiler>
<syntaxhighlight lang="cpp">
/*
Author: Revo


==AI Morale==
Description:
{{Stub}}
Retrieves loadout of unit and formats it for CfgRespawnLoadouts. Content is copied to clipboard and returned by function.


In addition to [[AI Behaviour|behaviour]] and [[Combat Modes|combat modes]], there are other factors they may affect the overall activity of AI.  
Parameter(s):
0: Object - Object to take the loadout from
1: String - Class name of the respawn loadout
2: String - Display name of the respawn loadout
3: String - Icon path displayed next to display name
4: String - Loadouts are assigned to a role, possible values:
"Assistant"
"CombatLifeSaver"
"Crewman"
"Default"
"Grenadier"
"MachineGunner"
"Marksman"
"MissileSpecialist"
"Rifleman"
"Sapper"
"SpecialOperative"
"Unarmed"
5: String - Condition for the respawn loadout to be shown. Code inside string has to return boolean. _this refers to the unit inside the respawn screen


===Suppression===
Can also be custom one, needs to be defined in CfgRoles, visit https://community.bistudio.com/wiki/Arma_3_Respawn:_New_Respawn_Screen for more information
* AI which is under fire becomes suppressed and its aim deteriorates. The speed of AI's recovery from the suppression is based on AI's Courage skill. AI with final skill close to 1.0 recovers almost immediately (doesn't suffer much suppression). Conversely just few shots around a 0.2 skilled AI should disturb it's aiming for longer period (up to ~ 12s).
* When planning a path, the AI will try to avoid beaten zones and areas that are visibly within enemy's fire sectors


===Fleeing===
Returns:
* Can be disabled by [[allowFleeing]]
String - Exports formatted loadout
*/


Courage of an AI group is based on the group's leader Courage skill. Each group has an initial strength (sum of undamaged armor and health of all units).  
params
If the group losses are higher than the initial strength multiplied by leader's Courage then the group will start fleeing. Primarily it goes to a supply point, secondarily it will try to find a safe position within a 600m radius from the initial waypoint (danger, distance, amount of cover positions are taken into account). After the fleeing has been finished the group's initial strength is reset.
[
["_object",player,[objNull]],
["_class","REPLACE",[""]],
["_displayName","REPLACE",[""]],
["_icon","\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa",[""]],
["_role","Default",[""]],
["_conditionShow","true",[""]]
];


== AI Detection ==
private _indent = "    ";
{{Stub}}
private _class = format ["class %1",_class];
private _displayName = format ["displayName = ""%1"";",_displayName];
private _icon = format ["icon = ""%1"";",_icon];
private _role = format ["role = ""%1"";",_role];
private _conditionShow = format ["show = ""%1"";",_conditionShow];
private _uniformClass = format ["uniformClass = ""%1"";",uniform _object];
private _backpack = format ["backpack = ""%1"";",backpack _object];
private _export = _class + endl + "{" + endl + _indent + _displayName + endl + _indent + _icon + endl + _indent + _role + endl + _indent + _conditionShow + endl + _indent + _uniformClass + endl + _indent + _backpack + endl;
private _weapons = weapons _object;
private _primWeaponItems = primaryWeaponItems _object;
private _secWeaponItems = secondaryWeaponItems _object;
private _assignedItems = assigneditems _object;
//From BIS_fnc_exportLoadout START
private _fnc_addArray =
{
params ["_name","_array"];
_export = _export + format [_indent + "%1[] = {",_name];
{
if (_foreachindex > 0) then {_export = _export + ",";};
_export = _export + format ["""%1""",_x];
} foreach _array;
_export = _export + "};" + endl;
};


== AI FSM ==
["weapons",_weapons + ["Throw","Put"]] call _fnc_addArray;
{{Stub}}
["magazines",magazines _object] call _fnc_addArray;
*See Also: [[Arma 2: FSM Danger Causes]], [[Arma 2: Operation Arrowhead: AI FSM]]
["items",items _object] call _fnc_addArray;
["linkedItems",[vest _object,headgear _object,goggles _object] + _assignedItems - _weapons + _primWeaponItems + _secWeaponItems] call _fnc_addArray;
//From BIS_fnc_exportLoadout END
_export = _export + "};" + endl + "//Visit https://community.bistudio.com/wiki/Arma_3_Respawn for detailed information";


== AI Pathfinding ==
copyToClipboard _export;
{{Stub}}
_export
</syntaxhighlight>
</spoiler>
{{Important|To add any loadout as available in your mission, you need to use the [[BIS_fnc_addRespawnInventory]] function!}}


== AI Shooting ==
===Decision making===
Weapon vs. fire mode vs. target selection and prioritization
===Fire modes===
===Aiming===
===Aiming Error===
===PGMs===
===Reloading===
===Suppressive fire===
===Artillery fire===
{{Stub}}


==See Also==
*[[:Category:AI|AI]]
*[[ArmA:_Difficulty#Adjusting_Accuracy_Separately|ArmA Difficulty]]
*[[Combat Modes]]
*[[skill]]
*[[setSkill]]
*[[setUnitAbility]]
*[[skillFinal]]
*[[setUnitAbility]]


[[Category:Arma 3: Editing]]
<br>
[[Category:AI]]
[[Category:Arma 3: Editing|Respawn]]

Revision as of 23:53, 27 June 2018

Template:SideTOC A3 RespawnScreen.jpg

Description.ext

A wide range of Description.ext entries let you configure respawn settings for your mission. See Description.ext - Respawn for a detailed documentation

Eden Editor

Eden Editor offers alot of settings to customise your respawn system, however not all functionalities are available. Furthermore settings made in the description.ext will overwrite settings made in Eden Editor. A3 EdenEditor Respawn.jpg

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 - Template:task/ Template:task
1 "BIRD" Respawn to a seagull Spectator, EndMission Template:task Template:task/
2 "INSTANT" Respawn on spot where player died Instant, Counter Template:task/ Template:task/
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 Template:task/ Template:task/
4 "GROUP" Respawn to the next available playable unit in a group. When none is left, BIRD respawn is used instead. Group, EndMission Template:task Template:task/
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 Template:task Template:task/

Respawn Templates

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 missions
When the respawnTemplates entry is missing, default templates based on the respawn type are used


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 OFP-style seagull respawn
Wave Adjusts respawn counter so players spawns together (wave delay is based on respawnDelay)
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 CfgRole, see (ADD LINK TO EXAMPLE).

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
    • Mission designer can disable the timeout used between death of a unit and opening of the respawn screen.

missionNamespace setVariable [ "BIS_RscRespawnControls_skipBlackOut", true, true ];//Disable timout
missionNamespace setVariable [ "BIS_RscRespawnControls_skipBlackOut", nil, true ];//Reset to original timeout

  • 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:

class CfgRespawnTemplates
{
	// Class used in respawnTemplates entry
	class myTag_beacon
	{
		// Function or script executed upon death. Parameters passed into it are the same as are passed into onPlayerKilled.sqf file
		onPlayerKilled = "\myAddon\scripts\respawnBeacon.sqf";
		// Function or script executed upon respawn. Parameters passed into it are the same as are passed into onPlayerRespawn.sqf file
		onPlayerRespawn = "\myAddon\scripts\respawnBeacon.sqf";
		// Default respawn delay (can be overwitten by description.ext entry of the same name)
		respawnDelay = 20;
		// 1 to respawn player when he joins the game. Available only for INSTANT and BASE respawn types
		// Can be overridden by description.ext attribute of the same name
		respawnOnStart = 1;
	};
	class Spectator
	{
		onPlayerRespawn = "BIS_fnc_respawnSpectator";
	};
};

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:

class CfgRoles
{
    class Assault//Class name used in CfgRespawnInventory
    {
        displayName = $STR_A3_Role_Assault;//Name of the role, displayed in the respawn menu
        icon = "a3\missions_f_exp\data\img\classes\assault_ca.paa";//Icon shown next to the role name in the respawn screen
    };
};
 
class CfgRespawnInventory
{
    class B_SquadLeader//Class of the respawn inventory, used by BIS_fnc_addRespawnInventory
    {
        displayName = $STR_b_soldier_sl_f0;//Name of the respawn inventory
        role = "Assault";Role the respawn inventory is assigned to
        icon = "\A3\ui_f\data\map\VehicleIcons\iconManLeader_ca.paa";//Icon shown next to the role
        show = "side group _this == west";//Condition used to make specific respawn inventories only avaiable for specfic sides, must return [[Boolean]]
        weapons[] = {//Weapons
            "arifle_SPAR_01_khk_F",
            "Rangefinder",
            "hgun_P07_khk_F"
        };
        magazines[] = {//Magazines
            "SmokeShell",
            "SmokeShell",
            "16Rnd_9x21_Mag",
            "16Rnd_9x21_Mag",
            "16Rnd_9x21_Mag",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "30Rnd_556x45_Stanag_Tracer_Red",
            "HandGrenade",
            "HandGrenade"
        };
        items[] = {//Useable items
            "FirstAidKit"
        };
        linkedItems[] = {//Linked items, also weapon items, helmet etc.
            "V_PlateCarrierSpec_tna_F",
            "H_HelmetB_Enh_tna_F",
            "optic_ERCO_blk_F",
            "acc_pointer_IR",
            "NVGoggles_tna_F",
            "ItemGPS",
            "ItemMap",
            "ItemCompass",
            "ItemWatch",
            "ItemRadio"
        };
        uniformClass = "U_B_T_Soldier_SL_F";//uniform
    };
↑ Back to spoiler's top

Export Function:

  • The following function will copy a complete respawn inventory to your clipboard, see function header for more information, contact User:R3vo if you have questions.

/*
	Author: Revo

	Description:
	Retrieves loadout of unit and formats it for CfgRespawnLoadouts. Content is copied to clipboard and returned by function.

	Parameter(s):
	0: Object - Object to take the loadout from
	1: String - Class name of the respawn loadout
	2: String - Display name of the respawn loadout
	3: String - Icon path displayed next to display name
	4: String - Loadouts are assigned to a role, possible values:
		"Assistant"
		"CombatLifeSaver"
		"Crewman"
		"Default"
		"Grenadier"
		"MachineGunner"
		"Marksman"
		"MissileSpecialist"
		"Rifleman"
		"Sapper"
		"SpecialOperative"
		"Unarmed"
	5: String - Condition for the respawn loadout to be shown. Code inside string has to return boolean. _this refers to the unit inside the respawn screen

	Can also be custom one, needs to be defined in CfgRoles, visit https://community.bistudio.com/wiki/Arma_3_Respawn:_New_Respawn_Screen for more information

	Returns:
	String - Exports formatted loadout
*/

params
[
	["_object",player,[objNull]],
	["_class","REPLACE",[""]],
	["_displayName","REPLACE",[""]],
	["_icon","\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa",[""]],
	["_role","Default",[""]],
	["_conditionShow","true",[""]]
];

private _indent = "    ";
private _class = format ["class %1",_class];
private _displayName = format ["displayName = ""%1"";",_displayName];
private _icon = format ["icon = ""%1"";",_icon];
private _role = format ["role = ""%1"";",_role];
private _conditionShow = format ["show = ""%1"";",_conditionShow];
private _uniformClass = format ["uniformClass = ""%1"";",uniform _object];
private _backpack = format ["backpack = ""%1"";",backpack _object];
private _export = _class + endl + "{" + endl + _indent + _displayName + endl + _indent + _icon + endl + _indent + _role + endl + _indent + _conditionShow + endl + _indent + _uniformClass + endl + _indent + _backpack + endl;
private _weapons = weapons _object;
private _primWeaponItems = primaryWeaponItems _object;
private _secWeaponItems = secondaryWeaponItems _object;
private _assignedItems = assigneditems _object;
//From BIS_fnc_exportLoadout START
private _fnc_addArray =
{
	params ["_name","_array"];
	_export = _export + format [_indent + "%1[] = {",_name];
	{
		if (_foreachindex > 0) then {_export = _export + ",";};
		_export = _export + format ["""%1""",_x];
	} foreach _array;
	_export = _export + "};" + endl;
};

["weapons",_weapons + ["Throw","Put"]] call _fnc_addArray;
["magazines",magazines _object] call _fnc_addArray;
["items",items _object] call _fnc_addArray;
["linkedItems",[vest _object,headgear _object,goggles _object] + _assignedItems - _weapons + _primWeaponItems + _secWeaponItems] call _fnc_addArray;
//From BIS_fnc_exportLoadout END
_export = _export + "};" + endl + "//Visit https://community.bistudio.com/wiki/Arma_3_Respawn for detailed information";

copyToClipboard _export;
_export
↑ Back to spoiler's top

To add any loadout as available in your mission, you need to use the BIS_fnc_addRespawnInventory function!