Respawn – Arma 3
Lou Montana (talk | contribs) m (Text replacement - "<syntaxhighlight lang=cpp>" to "<syntaxhighlight lang="cpp">") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
(14 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{TOC|side}} | {{TOC|side}} | ||
<gallery mode="packed-overlay" heights=200px> | <gallery mode="packed-overlay" heights="200px"> | ||
File:A3 RespawnScreen.jpg|Respawn screen | File:A3 RespawnScreen.jpg|Respawn screen | ||
File:A3 EdenEditor Respawn.jpg|Respawn settings in [[Eden Editor]] | File:A3 EdenEditor Respawn.jpg|Respawn settings in [[:Category:Eden Editor|Eden Editor]] | ||
</gallery> | </gallery> | ||
= Scripting = | == Settings == | ||
* Some basic settings can be set up in [[:Category:Eden Editor|Eden Editor]] | |||
* The [[Description.ext|description.ext]] allows for full control over all available respawn settings | |||
== Scripting == | |||
; Scripting Commands | |||
* [[playerRespawnTime]] | * [[playerRespawnTime]] | ||
* [[setPlayerRespawnTime]] | * [[setPlayerRespawnTime]] | ||
* [[respawnVehicle]] | * [[respawnVehicle]] | ||
; Scripting Functions | |||
* [[:Category:Function Group: Respawn|Respawn Functions]] | * [[:Category:Function Group: Respawn|Respawn Functions]] | ||
; Event Scripts | |||
* [[Event Scripts|onPlayerRespawn.sqf]] | * [[Event Scripts|onPlayerRespawn.sqf]] | ||
* [[Event Scripts|onPlayerKilled.sqf]] | * [[Event Scripts|onPlayerKilled.sqf]] | ||
= Respawn Types = | |||
== Respawn Types == | |||
Type is represented either by respawn ID, or by its name. | Type is represented either by respawn ID, or by its name. | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
Line 30: | Line 36: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{| class="wikitable" | {| class="wikitable align-center-col-2 align-center-col-4 align-center-col-5 align-center-col-6" | ||
! ID | ! ID | ||
! Name | ! Name | ||
Line 42: | Line 48: | ||
| Show singleplayer death screen | | Show singleplayer death screen | ||
| {{n/a}} | | {{n/a}} | ||
| {{Icon|checked}} | |||
| {{Icon|unchecked}} | |||
|- | |- | ||
Line 50: | Line 56: | ||
| Respawn to a seagull | | Respawn to a seagull | ||
| Spectator, EndMission | | Spectator, EndMission | ||
| {{Icon|unchecked}} | |||
| {{Icon|checked}} | |||
|- | |- | ||
Line 58: | Line 64: | ||
| Respawn on spot where player died | | Respawn on spot where player died | ||
| Instant, Counter | | Instant, Counter | ||
| {{Icon|checked}} | |||
| {{Icon|checked}} | |||
|- | |- | ||
Line 65: | Line 71: | ||
| "BASE" | | "BASE" | ||
| Respawn on a marker(s) start by following strings: | | Respawn on a marker(s) start by following strings: | ||
'''Unit respawn''' | '''Unit respawn''' | ||
* ''respawn'' (used only when side variant is not found) | * ''respawn'' (used only when side variant is not found) | ||
Line 71: | Line 78: | ||
* ''respawn_guerrila'' | * ''respawn_guerrila'' | ||
* ''respawn_civilian'' | * ''respawn_civilian'' | ||
'''Vehicle respawn''' | '''Vehicle respawn''' | ||
* ''respawn'' (used only when side variant is not found) | * ''respawn'' (used only when side variant is not found) | ||
Line 77: | Line 85: | ||
* ''respawn_vehicle_guerrila'' | * ''respawn_vehicle_guerrila'' | ||
* ''respawn_vehicle_civilian'' | * ''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 | 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 {{Link|http://killzonekid.com/arma-scripting-tutorials-respawn-on-marker/|here}}. Alternatively you can also use the ''Respawn Position'' module. | ||
| Base, Counter | | Base, Counter | ||
| {{Icon|checked}} | |||
| {{Icon|checked}} | |||
|- | |- | ||
Line 87: | Line 95: | ||
| 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 | ||
| {{Icon|unchecked}} | |||
| {{Icon|checked}} | |||
|- | |- | ||
Line 95: | Line 103: | ||
| 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 | ||
| {{Icon|unchecked}} | |||
| {{Icon|checked}} | |||
|} | |} | ||
= Respawn Templates = | |||
{{Feature | | == Respawn Templates == | ||
{{Feature|warning|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. | Templates are pre-defined scripts called when player dies and respawns. They are defined in an array and can be combined together. | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
respawnTemplates[] = { "MenuInventory", "MenuPosition" }; | respawnTemplates[] = { "MenuInventory", "MenuPosition" }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Additionally, you can define side specific templates. When a side has no unique templates, it will use general ''respawnTemplates'' instead. | Additionally, you can define side specific templates. When a side has no unique templates, it will use general ''respawnTemplates'' instead. | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
respawnTemplatesWest[] = { "MenuInventory" }; | |||
respawnTemplatesEast[] = { "Counter" }; | |||
respawnTemplatesGuer[] = { "Tickets" }; | |||
respawnTemplatesCiv[] = { "Spectator" }; | |||
respawnTemplatesVirtual[] = {}; // Virtual players, used mainly in Curator (Zeus) missions | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{Feature | important | When the | {{Feature|important|When the {{hl|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: | 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: | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
Line 122: | Line 134: | ||
respawnTemplates[] = { "MenuPosition", "Spectator" }; | respawnTemplates[] = { "MenuPosition", "Spectator" }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
< | <sqf> | ||
// initPlayerLocal.sqf | |||
// --- Enable full spectator in respawn screen | |||
{ | { | ||
missionNamespace setVariable [_x, true]; | |||
} | } forEach [ | ||
" | "BIS_respSpecAI", // Allow spectating of AI | ||
"BIS_respSpecAllowFreeCamera", | "BIS_respSpecAllowFreeCamera", // Allow moving the camera independent from units (players) | ||
"BIS_respSpecAllow3PPCamera", | "BIS_respSpecAllow3PPCamera", // Allow 3rd person camera | ||
"BIS_respSpecShowFocus", | "BIS_respSpecShowFocus", // Show info about the selected unit (dissapears behind the respawn UI) | ||
"BIS_respSpecShowCameraButtons", | "BIS_respSpecShowCameraButtons", // Show buttons for switching between free camera, 1st and 3rd person view (partially overlayed by respawn UI) | ||
"BIS_respSpecShowControlsHelper", | "BIS_respSpecShowControlsHelper", // Show the controls tutorial box | ||
"BIS_respSpecShowHeader", | "BIS_respSpecShowHeader", // Top bar of the spectator UI including mission time | ||
"BIS_respSpecLists" | "BIS_respSpecLists" // Show list of available units and locations on the left hand side | ||
]; | ]; | ||
</ | </sqf> | ||
=== Official Templates === | |||
{| class="wikitable" | {| class="wikitable" | ||
! Class | ! Class | ||
Line 181: | Line 195: | ||
|- | |- | ||
| '''Wave''' | | '''Wave''' | ||
| Adjusts respawn counter so players spawns together | | Adjusts respawn counter so players spawns together. Wave delay is based on ''respawnDelay'' and [[playerRespawnTime|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. | ||
| | |||
|- | |||
| '''SwitchPlayer''' | |||
| ? | |||
| | | | ||
Line 189: | Line 208: | ||
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. | 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. | ||
| | |||
|- | |||
| '''TicketsSpawn''' | |||
| ? | |||
| | | | ||
Line 206: | Line 230: | ||
'''Item disabling''' | '''Item disabling''' | ||
* Respawn positions can be disabled automatically (e.g., unit used as respawn point is dead) or manually by calling [[BIS_fnc_showRespawnMenuDisableItem]] | * Respawn positions can be disabled automatically (e.g., unit used as respawn point is dead) or manually by calling [[BIS_fnc_showRespawnMenuDisableItem]] | ||
| [[File:A3 respawnSelectPosition.jpg|200px]] | | [[File:A3 respawnSelectPosition.jpg|200px]] | ||
Line 218: | Line 242: | ||
'''Item disabling''' | '''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]]. | * 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''' | '''Limits''' | ||
Line 227: | Line 251: | ||
'''Options shared by ''MenuInventory'' and ''MenuPosition'''''<br> | '''Options shared by ''MenuInventory'' and ''MenuPosition'''''<br> | ||
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> | ||
< | missionNamespace setVariable ["BIS_RscRespawnControls_skipBlackOut", true, true]; // disable timout | ||
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. | ||
* '''Spectator Camera''' | * '''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]]. | ** 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. | ** 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.<br> | New templates can be defined in global [[Config.cpp]] or in mission and campaign [[Description.ext]] files.<br> | ||
'''Example''': | '''Example''': | ||
Line 253: | Line 275: | ||
// Function or script executed upon death. Parameters passed into it are the same as are passed into onPlayerKilled.sqf file | // 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"; | 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 | // 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"; | onPlayerRespawn = "\myAddon\scripts\respawnBeacon.sqf"; | ||
// Default respawn delay (can be overwitten by description.ext entry of the same name) | // Default respawn delay (can be overwitten by description.ext entry of the same name) | ||
respawnDelay = 20; | respawnDelay = 20; | ||
// 1 to respawn player when he joins the game. Available only for INSTANT and BASE respawn types | // 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 | // Can be overridden by description.ext attribute of the same name | ||
respawnOnStart = 1; | respawnOnStart = 1; | ||
// By default onPlayerKilled and onPlayerRespawn function are spawned | // By default onPlayerKilled and onPlayerRespawn function are spawned | ||
// set to 1 to run in unscheduled, called functions MUST NOT return an assignment or respawn will break | // set to 1 to run in unscheduled, called functions MUST NOT return an assignment or respawn will break | ||
isCall = 0; | isCall = 0; | ||
}; | }; | ||
class Spectator | class Spectator | ||
{ | { | ||
Line 271: | Line 298: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</spoiler> | </spoiler> | ||
{{Feature|important| | |||
For a template's {{hl|respawnDelay}} to be considered, [[Description.ext]]'s {{hl|respawnDelay}} '''must''' be defined and have a negative value due to [[BIS_fnc_selectRespawnTemplate]] code. | |||
<syntaxhighlight lang="cpp"> | |||
respawnDelay = -1; | |||
</syntaxhighlight> | |||
}} | |||
= Loadouts and Roles = | == 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.<br> | 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> | ||
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> | 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> | ||
'''Loadout config example:''' | '''Loadout config example:''' | ||
<spoiler> | <spoiler> | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
Line 283: | Line 317: | ||
class Assault // Class name used in CfgRespawnInventory | class Assault // Class name used in CfgRespawnInventory | ||
{ | { | ||
displayName = $STR_A3_Role_Assault; // Name of the role, displayed in the respawn menu | 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 | icon = "a3\missions_f_exp\data\img\classes\assault_ca.paa"; // Icon shown next to the role name in the respawn screen | ||
}; | }; | ||
Line 292: | Line 326: | ||
class B_SquadLeader // Class of the respawn inventory, used by BIS_fnc_addRespawnInventory | class B_SquadLeader // Class of the respawn inventory, used by BIS_fnc_addRespawnInventory | ||
{ | { | ||
displayName = $STR_b_soldier_sl_f0; // Name of the respawn inventory | displayName = "$STR_b_soldier_sl_f0"; // Name of the respawn inventory | ||
role = "Assault"; // Role the respawn inventory is assigned to | 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 | icon = "\A3\ui_f\data\map\VehicleIcons\iconManLeader_ca.paa"; // Icon shown next to the role | ||
Line 301: | Line 335: | ||
"hgun_P07_khk_F" | "hgun_P07_khk_F" | ||
}; | }; | ||
magazines[] = { // Magazines | magazines[] = { // Magazines | ||
"SmokeShell", | "SmokeShell", | ||
Line 318: | Line 353: | ||
"HandGrenade" | "HandGrenade" | ||
}; | }; | ||
items[] = { // Useable items | items[] = { // Useable items | ||
"FirstAidKit" | "FirstAidKit" | ||
}; | }; | ||
linkedItems[] = { // Linked items, also weapon items, helmet etc. | linkedItems[] = { // Linked items, also weapon items, helmet etc. | ||
"V_PlateCarrierSpec_tna_F", | "V_PlateCarrierSpec_tna_F", | ||
Line 333: | Line 370: | ||
"ItemRadio" | "ItemRadio" | ||
}; | }; | ||
uniformClass = "U_B_T_Soldier_SL_F"; // uniform | uniformClass = "U_B_T_Soldier_SL_F"; // uniform | ||
}; | }; | ||
Line 338: | Line 376: | ||
</spoiler> | </spoiler> | ||
'''Export Function''': | '''Export Function''': | ||
* The following function will copy a complete respawn inventory to your clipboard, see function header for more information | * The following function will copy a complete respawn inventory to your clipboard, see function header for more information.<br> | ||
'''Author:''' {{User|R3vo}}<br> | |||
<spoiler> | <spoiler> | ||
< | <sqf> | ||
/* | /* | ||
Author: R3vo | Author: R3vo | ||
Line 373: | Line 412: | ||
params | params | ||
[ | [ | ||
["_object",player,[objNull]], | ["_object", player, [objNull]], | ||
["_class","REPLACE",[""]], | ["_class", "REPLACE", [""]], | ||
["_displayName","REPLACE",[""]], | ["_displayName", "REPLACE", [""]], | ||
["_icon","\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa",[""]], | ["_icon", "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa", [""]], | ||
["_role","Default",[""]], | ["_role", "Default", [""]], | ||
["_conditionShow","true",[""]] | ["_conditionShow", "true", [""]] | ||
]; | ]; | ||
private _indent = " "; | private _indent = " "; | ||
private _class = format ["class %1",_class]; | private _class = format ["class %1", _class]; | ||
private _displayName = format ["displayName = ""%1"";",_displayName]; | private _displayName = format ["displayName = ""%1"";", _displayName]; | ||
private _icon = format ["icon = ""%1"";",_icon]; | private _icon = format ["icon = ""%1"";", _icon]; | ||
private _role = format ["role = ""%1"";",_role]; | private _role = format ["role = ""%1"";", _role]; | ||
private _conditionShow = format ["show = ""%1"";",_conditionShow]; | private _conditionShow = format ["show = ""%1"";", _conditionShow]; | ||
private _uniformClass = format ["uniformClass = ""%1"";",uniform _object]; | private _uniformClass = format ["uniformClass = ""%1"";", uniform _object]; | ||
private _backpack = format ["backpack = ""%1"";",backpack _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 _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 _weapons = weapons _object; | ||
private _primWeaponItems = primaryWeaponItems _object; | private _primWeaponItems = primaryWeaponItems _object; | ||
private _secWeaponItems = secondaryWeaponItems _object; | private _secWeaponItems = secondaryWeaponItems _object; | ||
private _assignedItems = | private _assignedItems = assignedItems _object; | ||
// From BIS_fnc_exportLoadout START | // From BIS_fnc_exportLoadout START | ||
private _fnc_addArray = | private _fnc_addArray = | ||
{ | { | ||
params ["_name","_array"]; | params ["_name", "_array"]; | ||
_export = _export + format [_indent + "%1[] = {",_name]; | _export = _export + format [_indent + "%1[] = {", _name]; | ||
{ | { | ||
if (_foreachindex > 0) then {_export = _export + ",";}; | if (_foreachindex > 0) then {_export = _export + ", ";}; | ||
_export = _export + format ["""%1""",_x]; | _export = _export + format ["""%1""", _x]; | ||
} foreach _array; | } foreach _array; | ||
_export = _export + "};" + endl; | _export = _export + "};" + endl; | ||
}; | }; | ||
["weapons",_weapons + ["Throw","Put"]] call _fnc_addArray; | ["weapons", _weapons + ["Throw", "Put"]] call _fnc_addArray; | ||
["magazines",magazines _object] call _fnc_addArray; | ["magazines", magazines _object] call _fnc_addArray; | ||
["items",items _object] call _fnc_addArray; | ["items", items _object] call _fnc_addArray; | ||
["linkedItems",[vest _object,headgear _object,goggles _object] + _assignedItems - _weapons + _primWeaponItems + _secWeaponItems] call _fnc_addArray; | ["linkedItems", [vest _object, headgear _object, goggles _object] + _assignedItems - _weapons + _primWeaponItems + _secWeaponItems] call _fnc_addArray; | ||
// From BIS_fnc_exportLoadout END | // From BIS_fnc_exportLoadout END | ||
_export = _export + "};" + endl + "// | _export = _export + "};" + endl + "// visit https://community.bistudio.com/wiki/Arma_3:_Respawn for detailed information"; | ||
copyToClipboard _export; | copyToClipboard _export; | ||
_export | _export; | ||
</ | </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!}} | ||
== Restore Loadout on Respawn == | |||
=== Respawn with Original Loadout === | |||
In order to let players respawn with the gear with which they started the mission, create an [[Event Scripts|initPlayerLocal.sqf]] file in the mission directory (if it does not exist already) and add the following code: | |||
{{hl|[[Event Scripts#initPlayerLocal.sqf|initPlayerLocal.sqf]]}} | |||
<sqf> | |||
player setVariable ["TAG_StartLoadout", getUnitLoadout player]; | |||
player addEventHandler ["Respawn", { private _loadout = player getVariable "TAG_StartLoadout"; if (!isNil "_loadout") then { player setUnitLoadout _loadout; }; }]; | |||
</sqf> | |||
=== Respawn with Death Loadout === | |||
The following code makes the player respawn with the loadout they had on death: | |||
{{hl|[[Event Scripts#initPlayerLocal.sqf|initPlayerLocal.sqf]]}} | |||
<sqf> | |||
player addEventHandler ["Killed", { player setVariable ["TAG_DeathLoadout", getUnitLoadout player]; }]; | |||
player addEventHandler ["Respawn", { private _loadout = player getVariable "TAG_DeathLoadout"; if (!isNil "_loadout") then { player setUnitLoadout _loadout; }; }]; | |||
</sqf> | |||
{{GameCategory|arma3|Editing}} | {{GameCategory|arma3|Editing}} |
Latest revision as of 16:01, 10 September 2023
Settings
- Some basic settings can be set up in Eden Editor
- The description.ext allows for full control over all available respawn 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 | ||
1 | "BIRD" | Respawn to a seagull | Spectator, EndMission | ||
2 | "INSTANT" | Respawn on spot where player died | Instant, Counter | ||
3 | "BASE" | Respawn on a marker(s) start by following strings:
Unit respawn
Vehicle respawn
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 | ||
4 | "GROUP" | Respawn to the next available playable unit in a group. When none is left, BIRD respawn is used instead. | Group, EndMission | ||
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 |
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 (Zeus) missions
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" };
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. | |
SwitchPlayer | ? | |
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. |
|
TicketsSpawn | ? | |
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 1.60 and brings new functionalities together with a new design.
Item disabling
|
|
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 1.60 and brings new functionalities together with a new design. Role selection
Item disabling
Limits
|
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
- Mission designer can disable the timeout used between death of a unit and opening of the respawn screen:
- 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;
// By default onPlayerKilled and onPlayerRespawn function are spawned
// set to 1 to run in unscheduled, called functions MUST NOT return an assignment or respawn will break
isCall = 0;
};
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
};
Export Function:
- The following function will copy a complete respawn inventory to your clipboard, see function header for more information.
Author: R3vo
Restore Loadout on Respawn
Respawn with Original Loadout
In order to let players respawn with the gear with which they started the mission, create an initPlayerLocal.sqf file in the mission directory (if it does not exist already) and add the following code:
Respawn with Death Loadout
The following code makes the player respawn with the loadout they had on death: