Event Scripts: Difference between revisions
Jump to navigation
Jump to search
m (added init3den.sqf) |
Lou Montana (talk | contribs) (Add parameters syntax, adjust column width, fix global presentation) |
||
Line 5: | Line 5: | ||
== Available Scripts == | == Available Scripts == | ||
{| class="bikitable" | {| class="bikitable" style="text-align: center" | ||
! File | ! rowspan="2" | File | ||
! Description | ! rowspan="2" | Description | ||
! Arguments | ! rowspan="2" | Arguments | ||
! colspan="7" | Present in | |||
|- | |||
! {{GVI|ofp|1.00}} | ! {{GVI|ofp|1.00}} | ||
! {{GVI|ofpr|1.75}} | ! {{GVI|ofpr|1.75}} | ||
! {{GVI|arma|1.00}} | ! {{GVI|arma|1.00}} | ||
! {{GVI|arma2|1.00}} | ! {{GVI|arma2|1.00}} | ||
! {{GVI|arma2oa|1. | ! {{GVI|arma2oa|1.50}} | ||
! {{GVI|arma3|1.00}} | ! {{GVI|arma3|1.00}} | ||
! {{GVI|TKOH|1.00}} | ! {{GVI|TKOH|1.00}} | ||
Line 19: | Line 21: | ||
|- | |- | ||
| ''init.sqs'' | | ''init.sqs'' | ||
| Executed when mission is started (before briefing screen) | | style="text-align: left" | Executed when mission is started (before briefing screen) | ||
| | | | ||
| ✔ <!-- OFP --> | | ✔ <!-- OFP --> | ||
Line 31: | Line 33: | ||
|- | |- | ||
| ''init.sqf'' | | ''init.sqf'' | ||
| Executed when mission is started (before briefing screen) | | style="text-align: left" | Executed when mission is started (before briefing screen) | ||
| | | | ||
| <!-- OFP --> | | <!-- OFP --> | ||
Line 43: | Line 45: | ||
|- | |- | ||
| ''initIntro.sqs'' | | ''initIntro.sqs'' | ||
| Executed when intro, outro win or outro lose is started. | | style="text-align: left" | Executed when intro, outro win or outro lose is started. | ||
| | | | ||
| <!-- OFP --> | | <!-- OFP --> | ||
Line 55: | Line 57: | ||
|- | |- | ||
| ''initIntro.sqf'' | | ''initIntro.sqf'' | ||
| Executed when intro, outro win or outro lose is started. | | style="text-align: left" | Executed when intro, outro win or outro lose is started. | ||
| | | | ||
| <!-- OFP --> | | <!-- OFP --> | ||
Line 67: | Line 69: | ||
|- | |- | ||
| ''exit.sqs'' | | ''exit.sqs'' | ||
| Executed when mission is finished (before debriefing screen). In Arma 3, "ended" [[addMissionEventHandler|mission event handler]] has the same functionality. | | style="text-align: left" | Executed when mission is finished (before debriefing screen). In Arma 3, "ended" [[addMissionEventHandler|mission event handler]] has the same functionality. | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params ["_endType"];</syntaxhighlight> | ||
* endType: [[String]] | |||
| <!-- OFP --> | | <!-- OFP --> | ||
| ✔ <!-- OFPR --> | | ✔ <!-- OFPR --> | ||
Line 79: | Line 82: | ||
|- | |- | ||
| ''exit.sqf'' | | ''exit.sqf'' | ||
| Executed when mission is finished (before debriefing screen). In Arma 3, "ended" [[addMissionEventHandler|mission event handler]] has the same functionality. | | style="text-align: left" | Executed when mission is finished (before debriefing screen). In Arma 3, "ended" [[addMissionEventHandler|mission event handler]] has the same functionality. | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params ["_endType"];</syntaxhighlight> | ||
* endType: [[String]] | |||
| <!-- OFP --> | | <!-- OFP --> | ||
| <!-- OFPR --> | | <!-- OFPR --> | ||
Line 91: | Line 95: | ||
|- | |- | ||
| ''onFlare.sqs'' | | ''onFlare.sqs'' | ||
| Executed when a flare is lit after being fired from grenade launcher. | | style="text-align: left" | Executed when a flare is lit after being fired from grenade launcher. | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params ["_colorRGB", "_shooter"];</syntaxhighlight> | ||
* colorRGB: [[Color]] | |||
* shooter: [[Object]] | |||
| <!-- OFP --> | | <!-- OFP --> | ||
| ✔ <!-- OFPR --> | | ✔ <!-- OFPR --> | ||
Line 103: | Line 109: | ||
|- | |- | ||
| ''pauseOnLoad.sqf'' | | ''pauseOnLoad.sqf'' | ||
| Executed when pause menu is activated. | | style="text-align: left" | Executed when pause menu is activated. | ||
To make it work in MP or Arma 3, use | To make it work in MP or Arma 3, use <syntaxhighlight lang="cpp">onPauseScript = "pauseOnLoad.sqf";</syntaxhighlight> in [[Description.ext#onPauseScript|Description.ext]] | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params ["_pauseMenuDisplay"];</syntaxhighlight> | ||
* pauseMenuDisplay: [[Display]] | |||
| <!-- OFP --> | | <!-- OFP --> | ||
| <!-- OFPR --> | | <!-- OFPR --> | ||
Line 117: | Line 124: | ||
|- | |- | ||
| ''onPlayerKilled.sqs'' | | ''onPlayerKilled.sqs'' | ||
| Executed when player is killed in singleplayer or in multiplayer mission with "NONE" [[ | | style="text-align: left" | Executed when player is killed in singleplayer or in multiplayer mission with "NONE" [[Description.ext#respawn|respawn type]]. | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params ["_player", "_killer"];</syntaxhighlight> | ||
* player: [[Object]] | |||
* killer: [[Object]] | |||
| ✔ <!-- OFP --> | | ✔ <!-- OFP --> | ||
| ✔ <!-- OFPR --> | | ✔ <!-- OFPR --> | ||
Line 129: | Line 138: | ||
|- | |- | ||
| ''onPlayerRespawnAsSeagull.sqs'' | | ''onPlayerRespawnAsSeagull.sqs'' | ||
| Executed when player is killed in multiplayer mission with "SEAGULL" [[ | | style="text-align: left" | Executed when player is killed in multiplayer mission with "SEAGULL" [[Description.ext#respawn|respawn type]], or when the type is "GROUP" or "SIDE", but no remaining respawn slots are left. This script will replace the default respawn sequence. | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params [ | ||
"_player", | |||
"_killer", | |||
"_seagull" | |||
];</syntaxhighlight> | |||
* player: [[Object]] | |||
* killer: [[Object]] | |||
* seagull: [[Object]] | |||
| ✔ <!-- OFP --> | | ✔ <!-- OFP --> | ||
| ✔ <!-- OFPR --> | | ✔ <!-- OFPR --> | ||
Line 141: | Line 157: | ||
|- | |- | ||
| ''onPlayerRespawnOtherUnit.sqs'' | | ''onPlayerRespawnOtherUnit.sqs'' | ||
| Executed when player is killed in multiplayer mission with "GROUP" or "SIDE" [[ | | style="text-align: left" | Executed when player is killed in multiplayer mission with "GROUP" or "SIDE" [[Description.ext#respawn|respawn type]]. This script will replace the default respawn sequence. | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params [ | ||
"_player", | |||
"_killer", | |||
"_newUnit" | |||
];</syntaxhighlight> | |||
* player: [[Object]] | |||
* killer: [[Object]] | |||
* newUnit: [[Object]] | |||
| ✔ <!-- OFP --> | | ✔ <!-- OFP --> | ||
| ✔ <!-- OFPR --> | | ✔ <!-- OFPR --> | ||
Line 153: | Line 176: | ||
|- | |- | ||
| ''onPlayerRespawn.sqs'' | | ''onPlayerRespawn.sqs'' | ||
| Executed when player is killed in multiplayer mission with "INSTANT" or "BASE" [[ | | style="text-align: left" | Executed when player is killed in multiplayer mission with "INSTANT" or "BASE" [[Description.ext#respawn|respawn type]]. It will not work if ''dta\scripts\onPlayerRespawn.sqs'' does not exist. | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params [ | ||
"_player", | |||
"_killer", | |||
"_respawnDelay" | |||
];</syntaxhighlight> | |||
* player: [[Object]] | |||
* killer: [[Object]] | |||
* respawnDelay: [[Number]] | |||
| <!-- OFP --> | | <!-- OFP --> | ||
| ✔ <!-- OFPR --> | | ✔ <!-- OFPR --> | ||
Line 165: | Line 195: | ||
|- | |- | ||
| ''onPlayerResurrect.sqs'' | | ''onPlayerResurrect.sqs'' | ||
| Executed when player is respawned in multiplayer mission with "INSTANT" or "BASE" [[ | | style="text-align: left" | Executed when player is respawned in multiplayer mission with "INSTANT" or "BASE" [[Description.ext#respawn|respawn type]]. It will not work if ''dta\scripts\onPlayerResurrect.sqs'' does not exist. | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params ["_player"];</syntaxhighlight> | ||
* player: [[Object]] | |||
| <!-- OFP --> | | <!-- OFP --> | ||
| ✔ <!-- OFPR --> | | ✔ <!-- OFPR --> | ||
Line 177: | Line 208: | ||
|- | |- | ||
| ''initJIPcompatible.sqf'' | | ''initJIPcompatible.sqf'' | ||
| Executed locally by [[Multiplayer framework]] when a player joins mission (includes both mission start and JIP). Also executed locally on server at mission start. | | style="text-align: left" | Executed locally by [[Multiplayer framework]] when a player joins mission (includes both mission start and JIP). Also executed locally on server at mission start. | ||
| | | | ||
| <!-- OFP --> | | <!-- OFP --> | ||
Line 189: | Line 220: | ||
|- | |- | ||
| ''initServer.sqf'' | | ''initServer.sqf'' | ||
| Executed only on server when mission is started. See [[Initialization Order]] for details about when the script is exactly executed. | | style="text-align: left" | Executed only on server when mission is started. See [[Initialization Order]] for details about when the script is exactly executed. | ||
| | | | ||
| <!-- OFP --> | | <!-- OFP --> | ||
Line 201: | Line 232: | ||
|- | |- | ||
| ''initPlayerServer.sqf'' | | ''initPlayerServer.sqf'' | ||
| Executed only on server when a player joins mission (includes both mission start and JIP). See [[Initialization Order]] for details about when the script is exactly executed.<br/> | | style="text-align: left" | Executed only on server when a player joins mission (includes both mission start and JIP). See [[Initialization Order]] for details about when the script is exactly executed.<br/> | ||
This script relies on [[BIS_fnc_execVM]] and [[remoteExec]]. If [[CfgRemoteExec]]'s <tt>class Functions</tt> is set to mode = 0 or 1, the script will never be executed. Therefore, initPlayerServer.sqf should be avoided. | This script relies on [[BIS_fnc_execVM]] and [[remoteExec]]. If [[CfgRemoteExec]]'s <tt>class Functions</tt> is set to mode = 0 or 1, the script will never be executed. Therefore, initPlayerServer.sqf should be avoided. | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params ["_playerUnit", "_didJIP"];</syntaxhighlight> | ||
* playerUnit: [[Object]] | |||
* didJIP: [[Boolean]] | |||
| <!-- OFP --> | | <!-- OFP --> | ||
| <!-- OFPR --> | | <!-- OFPR --> | ||
Line 214: | Line 247: | ||
|- | |- | ||
| ''init3DEN.sqf'' | | ''init3DEN.sqf'' | ||
| | | style="text-align: left" | Executed when loading a scenario in [[Eden Editor]] if the file is present. Useful for executing scenario-specific editor functionality. | ||
| | | | ||
| <!-- OFP --> | | <!-- OFP --> | ||
Line 226: | Line 259: | ||
|- | |- | ||
| ''initPlayerLocal.sqf'' | | ''initPlayerLocal.sqf'' | ||
| Executed locally when player joins mission (includes both mission start and JIP). See [[Functions_Library_(Arma_3)#Initialization_Order|initialization order]] for details about when the script is exactly executed. | | style="text-align: left" | Executed locally when player joins mission (includes both mission start and JIP). See [[Functions_Library_(Arma_3)#Initialization_Order|initialization order]] for details about when the script is exactly executed. | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params ["_player", "_didJIP"];</syntaxhighlight> | ||
* player: [[Object]] | |||
* didJIP: [[Boolean]] | |||
| <!-- OFP --> | | <!-- OFP --> | ||
| <!-- OFPR --> | | <!-- OFPR --> | ||
Line 238: | Line 273: | ||
|- | |- | ||
| ''onPlayerKilled.sqf'' | | ''onPlayerKilled.sqf'' | ||
| Executed when player is [[Arma_3_Respawn#Files|killed]] in singleplayer or in multiplayer mission. | | style="text-align: left" | Executed when player is [[Arma_3_Respawn#Files|killed]] in singleplayer or in multiplayer mission. | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params [ | ||
"_oldUnit", | |||
"_killer", | |||
"_respawn", | |||
"_respawnDelay" | |||
];</syntaxhighlight> | |||
* oldUnit: [[Object]] | |||
* killer: [[Object]] | |||
* respawn: ''[[String]]?'' | |||
* respawnDelay: [[Number]] | |||
| <!-- OFP --> | | <!-- OFP --> | ||
| <!-- OFPR --> | | <!-- OFPR --> | ||
Line 250: | Line 294: | ||
|- | |- | ||
| ''onPlayerRespawn.sqf'' | | ''onPlayerRespawn.sqf'' | ||
| Executed locally when player [[Arma_3_Respawn#Files|respawns]] in a multiplayer mission. This event script will also fire at the beginning of a mission if [[Description.ext#respawnOnStart|respawnOnStart]] is 0 or 1, oldUnit will be [[objNull]] in this instance. This script will not fire at mission start if [[Description.ext#respawnOnStart|respawnOnStart]] equals -1. | | style="text-align: left" | Executed locally when player [[Arma_3_Respawn#Files|respawns]] in a multiplayer mission. This event script will also fire at the beginning of a mission if [[Description.ext#respawnOnStart|respawnOnStart]] is 0 or 1, oldUnit will be [[objNull]] in this instance. This script will not fire at mission start if [[Description.ext#respawnOnStart|respawnOnStart]] equals -1. | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params [ | ||
"_newUnit", | |||
"_oldUnit", | |||
"_respawn", | |||
"_respawnDelay" | |||
];</syntaxhighlight> | |||
* newUnit: [[Object]] | |||
* oldUnit: [[Object]] | |||
* respawn: ''[[String]]?'' | |||
* respawnDelay: [[Number]] | |||
| <!-- OFP --> | | <!-- OFP --> | ||
| <!-- OFPR --> | | <!-- OFPR --> | ||
Line 259: | Line 312: | ||
| ✔ <!-- A3 --> | | ✔ <!-- A3 --> | ||
| <!-- TKOH --> | | <!-- TKOH --> | ||
|- | |- | ||
| ''playerKilledScript.sqs'' | | ''playerKilledScript.sqs'' | ||
| Executed locally when player is killed in singleplayer or in multiplayer mission with "NONE" [[ | | style="text-align: left" | Executed locally when player is killed in singleplayer or in multiplayer mission with "NONE" [[Description.ext#respawn|respawn type]]. Overrides default behavior of mission death screen in single player. Game may become unplayable if not scripted correctly. Avoid use if not experienced with this script. | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params ["_player", "_killer"];</syntaxhighlight> | ||
| | * player: [[Object]] | ||
| | * killer: [[Object]] | ||
| | | ? <!-- OFP --><!-- Untested --> | ||
| | | ? <!-- OFPR --><!-- Untested --> | ||
| | | ? <!-- A1 --><!-- Untested --> | ||
| ? <!-- A2 --><!-- Untested --> | |||
| ? <!-- A2OA --><!-- Untested --> | |||
| ✔ <!-- A3 --> | | ✔ <!-- A3 --> | ||
| | | ? <!-- TKOH --><!-- Untested --> | ||
|- | |- | ||
| ''playerRespawnScript.sqs'' | | ''playerRespawnScript.sqs'' | ||
| Executed locally and immediately when player is killed in multiplayer mission with "BASE" or "INSTANT" [[ | | style="text-align: left" | Executed locally and immediately when player is killed in multiplayer mission with "BASE" or "INSTANT" [[Description.ext#respawn|respawn type]]. Overrides default behavior of multiplayer respawn. Game may become unplayable if not scripted correctly. Avoid use if not experienced with this script. | ||
| | | style="text-align: left" | <syntaxhighlight lang="cpp">params [ | ||
| | "_player", | ||
| | "_killer", | ||
| | "_respawnDelay" | ||
| | ];</syntaxhighlight> | ||
| | * player: [[Object]] | ||
* killer: [[Object]] | |||
* respawnDelay: [[Number]] | |||
| ? <!-- OFP --><!-- Untested --> | |||
| ? <!-- OFPR --><!-- Untested --> | |||
| ? <!-- A1 --><!-- Untested --> | |||
| ? <!-- A2 --><!-- Untested --> | |||
| ? <!-- A2OA --><!-- Untested --> | |||
| ✔ <!-- A3 --> | | ✔ <!-- A3 --> | ||
| | | ? <!-- TKOH --><!-- Untested --> | ||
|} | |} | ||
{{Informative | Additional init scripts can be executed using functions with [[Functions_Library_(Arma_3)#Attributes|preInit or postInit]] attribute.}} | |||
== See also == | == See also == | ||
Line 293: | Line 354: | ||
* [[SQF syntax]] | * [[SQF syntax]] | ||
* [[Initialization Order]] | * [[Initialization Order]] | ||
[[Category: Event Handlers]] | [[Category: Event Handlers]] |
Revision as of 18:42, 6 September 2019
Event scripts are scripts which are executed by the game engine upon specific events.
To use an event script, create a file of given name in the mission directory.
Available Scripts
File | Description | Arguments | Present in | ||||||
---|---|---|---|---|---|---|---|---|---|
1.00 | 1.75 | -wrong parameter ("Arma") defined!-1.00 | 1.00 | 1.50 | 1.00 | 1.00 | |||
init.sqs | Executed when mission is started (before briefing screen) | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
init.sqf | Executed when mission is started (before briefing screen) | ✔ | ✔ | ✔ | ✔ | ✔ | |||
initIntro.sqs | Executed when intro, outro win or outro lose is started. | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ||
initIntro.sqf | Executed when intro, outro win or outro lose is started. | ✔ | ✔ | ✔ | |||||
exit.sqs | Executed when mission is finished (before debriefing screen). In Arma 3, "ended" mission event handler has the same functionality. | params ["_endType"];
|
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
exit.sqf | Executed when mission is finished (before debriefing screen). In Arma 3, "ended" mission event handler has the same functionality. | params ["_endType"];
|
✔ | ✔ | ✔ | ✔ | |||
onFlare.sqs | Executed when a flare is lit after being fired from grenade launcher. | params ["_colorRGB", "_shooter"];
|
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
pauseOnLoad.sqf | Executed when pause menu is activated.
To make it work in MP or Arma 3, use onPauseScript = "pauseOnLoad.sqf";
|
params ["_pauseMenuDisplay"];
|
✔ | ✔ | ✔ | ||||
onPlayerKilled.sqs | Executed when player is killed in singleplayer or in multiplayer mission with "NONE" respawn type. | params ["_player", "_killer"];
|
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
onPlayerRespawnAsSeagull.sqs | Executed when player is killed in multiplayer mission with "SEAGULL" respawn type, or when the type is "GROUP" or "SIDE", but no remaining respawn slots are left. This script will replace the default respawn sequence. | params [
"_player",
"_killer",
"_seagull"
];
|
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
onPlayerRespawnOtherUnit.sqs | Executed when player is killed in multiplayer mission with "GROUP" or "SIDE" respawn type. This script will replace the default respawn sequence. | params [
"_player",
"_killer",
"_newUnit"
];
|
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
onPlayerRespawn.sqs | Executed when player is killed in multiplayer mission with "INSTANT" or "BASE" respawn type. It will not work if dta\scripts\onPlayerRespawn.sqs does not exist. | params [
"_player",
"_killer",
"_respawnDelay"
];
|
✔ | ||||||
onPlayerResurrect.sqs | Executed when player is respawned in multiplayer mission with "INSTANT" or "BASE" respawn type. It will not work if dta\scripts\onPlayerResurrect.sqs does not exist. | params ["_player"];
|
✔ | ||||||
initJIPcompatible.sqf | Executed locally by Multiplayer framework when a player joins mission (includes both mission start and JIP). Also executed locally on server at mission start. | ✔ | ✔ | ||||||
initServer.sqf | Executed only on server when mission is started. See Initialization Order for details about when the script is exactly executed. | ✔ | |||||||
initPlayerServer.sqf | Executed only on server when a player joins mission (includes both mission start and JIP). See Initialization Order for details about when the script is exactly executed. This script relies on BIS_fnc_execVM and remoteExec. If CfgRemoteExec's class Functions is set to mode = 0 or 1, the script will never be executed. Therefore, initPlayerServer.sqf should be avoided. |
params ["_playerUnit", "_didJIP"];
|
✔ | ||||||
init3DEN.sqf | Executed when loading a scenario in Eden Editor if the file is present. Useful for executing scenario-specific editor functionality. | ✔ | |||||||
initPlayerLocal.sqf | Executed locally when player joins mission (includes both mission start and JIP). See initialization order for details about when the script is exactly executed. | params ["_player", "_didJIP"];
|
✔ | ||||||
onPlayerKilled.sqf | Executed when player is killed in singleplayer or in multiplayer mission. | params [
"_oldUnit",
"_killer",
"_respawn",
"_respawnDelay"
];
|
✔ | ||||||
onPlayerRespawn.sqf | Executed locally when player respawns in a multiplayer mission. This event script will also fire at the beginning of a mission if respawnOnStart is 0 or 1, oldUnit will be objNull in this instance. This script will not fire at mission start if respawnOnStart equals -1. | params [
"_newUnit",
"_oldUnit",
"_respawn",
"_respawnDelay"
];
|
✔ | ||||||
playerKilledScript.sqs | Executed locally when player is killed in singleplayer or in multiplayer mission with "NONE" respawn type. Overrides default behavior of mission death screen in single player. Game may become unplayable if not scripted correctly. Avoid use if not experienced with this script. | params ["_player", "_killer"];
|
? | ? | ? | ? | ? | ✔ | ? |
playerRespawnScript.sqs | Executed locally and immediately when player is killed in multiplayer mission with "BASE" or "INSTANT" respawn type. Overrides default behavior of multiplayer respawn. Game may become unplayable if not scripted correctly. Avoid use if not experienced with this script. | params [
"_player",
"_killer",
"_respawnDelay"
];
|
? | ? | ? | ? | ? | ✔ | ? |