Respawn – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 14: Line 14:
  {{codecomment|// Respawn templates from CfgRespawnTemplates. You can combine any number of them together.}}
  {{codecomment|// Respawn templates from CfgRespawnTemplates. You can combine any number of them together.}}
  respawnTemplates[] = {"Counter","Wave"};
  respawnTemplates[] = {"Counter","Wave"};
  {{codecomment|// 1 to execute respawn templates when a player joins the game.}}
  {{codecomment|// 1 to execute respawn templates when a player joins the game. Available only for INSTANT and BASE respawn types.}}
  respawnOnStart = 1;
  respawnOnStart = 1;
  {{codecomment|// When 1, the score table contains score of all playable units as opposed to players only.}}
  {{codecomment|// When 1, the score table contains score of all playable units as opposed to players only.}}
Line 21: Line 21:


=== Files ===
=== Files ===
Create a file called ''initRespawn.sqf'' in your [[Mission_Editor:_External|mission directory]]. It will be automatically executed on player's computer either when he dies, when he respawns or in both cases.
Create files called ''onPlayerKilled.sqf'' and ''onPlayerRespawn.sqf'' in your [[Mission_Editor:_External|mission directory]]. They will be automatically executed on player's computer when he dies and respawns.


Following parameters are passed into it in both cases:
Following parameters are passed into it in both cases:


'''Death'''<br />
'''onPlayerKilled'''<br />
:''(first 2 params are the same as are passed into [[ArmA_2:_Event_Handlers#Killed|Killed]] event handler)''
:''(first 2 params are the same as are passed into [[ArmA_2:_Event_Handlers#Killed|Killed]] event handler)''
:<code>[<unit>,<killer>,<isRespawn>,<respawn>,<respawnDelay>]</code>
:<code>[<unit>,<killer>,<respawn>,<respawnDelay>]</code>


'''Respawn'''<br />
'''onPlayerRespawn.sqf'''<br />
:''(first 2 params are the same as are passed into [[ArmA_2:_Event_Handlers#Respawn|Respawn]] event handler)''
:''(first 2 params are the same as are passed into [[ArmA_2:_Event_Handlers#Respawn|Respawn]] event handler)''
:<code>[<newUnit>,<oldUnit>,<isRespawn>,<respawn>,<respawnDelay>]</code>
:<code>[<newUnit>,<oldUnit>,<respawn>,<respawnDelay>]</code>


'''Parameters:'''
'''Parameters:'''
Line 37: Line 37:
:*newUnit: [[Object]] - newly respawned player.
:*newUnit: [[Object]] - newly respawned player.
:*killer: [[Object]] - a unit who killed player. [[objNull]] when executed on start.
:*killer: [[Object]] - a unit who killed player. [[objNull]] when executed on start.
:*isDeath: [[Boolean]]- true when script is executed after death, false when after respawn.
:*respawnDelay: [[Number]] - respawn delay defined either in respawn type or in Description.ext.
:*respawnDelay: [[Number]] - respawn delay defined either in respawn type or in Description.ext.


Line 133: Line 132:
  {{codecomment|// Template name}}
  {{codecomment|// Template name}}
  displayName = "Beacon";
  displayName = "Beacon";
  {{codecomment|// Function or script execute upon death and respawn. Parameters passed into it are the same as are passed into initRespawn.sqf file}}
  {{codecomment|// Function or script executed upon death. Parameters passed into it are the same as are passed into onPlayerKilled.sqf file}}
  init = "\myAddon\scripts\respawnBeacon.sqf";
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)}}
  {{codecomment|// Default respawn delay (can be overwitten by description.ext entry of the same name)}}
  respawnDelay = 20;
  respawnDelay = 20;

Revision as of 10:24, 20 May 2013


Mission Configuration

Description.ext

A wide range of Description.ext entries lets you to configure respawn settings for your mission.

// Respawn type, see the table below
respawn = 2;
// Delay in seconds before playable unit respawns.
respawnDelay = 10;
// Delay in seconds before vehicle respawns.
respawnVehicleDelay = 60;
// 0 to disable the score table (it can still be opened manually by pressing 'P' key).
respawnDialog = 0;
// Respawn templates from CfgRespawnTemplates. You can combine any number of them together.
respawnTemplates[] = {"Counter","Wave"};
// 1 to execute respawn templates when a player joins the game. Available only for INSTANT and BASE respawn types.
respawnOnStart = 1;
// When 1, the score table contains score of all playable units as opposed to players only.
aikills = 1;


Files

Create files called onPlayerKilled.sqf and onPlayerRespawn.sqf in your mission directory. They will be automatically executed on player's computer when he dies and respawns.

Following parameters are passed into it in both cases:

onPlayerKilled

(first 2 params are the same as are passed into Killed event handler)
[<unit>,<killer>,<respawn>,<respawnDelay>]

onPlayerRespawn.sqf

(first 2 params are the same as are passed into Respawn event handler)
[<newUnit>,<oldUnit>,<respawn>,<respawnDelay>]

Parameters:

  • oldUnit: Object - killed player. objNull when executed on start.
  • newUnit: Object - newly respawned player.
  • killer: Object - a unit who killed player. objNull when executed on start.
  • respawnDelay: Number - respawn delay defined either in respawn type or in Description.ext.
File name and arguments may change during Alpha / Beta development


Respawn Types

ID Name Description initRespawn.sqf
on death
initRespawn.sqf
on respawn
0 "NONE" Show singleplayer death screen Template:task/ Template:task
1 "BIRD" Respawn to a seagull Template:task Template:task/
2 "INSTANT" Respawn on spot where player died Template:task/ Template:task/
3 "BASE" Respawn on a marker(s) start by following strings:
  • Unit respawn
    • respawn_west
    • respawn_east
    • respawn_guerrila
    • respawn_civilian
  • Vehicle respawn
    • 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.

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. 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. Template:task Template:task/


Respawn Templates

Default templates in the vanilla game:

  • None - singleplayer death screen. Default for NONE respawn type and in singleplayer.
  • Spectator - Spectator Mode. Default for BIRD respawn type.
  • Instant - Currently empty. Default for INSTANT respawn type.
  • Base - Currently empty. Default for BASE respawn type.
  • Group - Cutscene showing a newly controlled unit. Default for GROUP respawn type.
  • Side - Cutscene showing a newly controlled unit. Default for SIDE respawn type.
  • Seagull - OFP-style seagull respawn
  • Wave - adjusts respawn counter so players spawns together (wave delay is based on respawnDelay)
  • Counter - show a simple respawn countdown


Scripting Commands

System Configuration

Respawn Templates

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

class CfgRespawnTemplates
{
	// Class used in respawnTemplates entry
	class myTag_beacon
	{
		// Template name
		displayName = "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;
	};
	class Spectator
	{
		displayName = "Spectator";
		init = "BIS_fnc_respawnSpectator";
	};
};