Event Scripts: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(added onPauseScript)
m (→‎Available Scripts: adding display param + some GGG corrections)
Line 15: Line 15:


; initIntro
; initIntro
: Launched when intro is started .
: Launched when intro is started.


; exit
; exit
Line 25: Line 25:
: Launched when illuminating shell is lit.
: Launched when illuminating shell is lit.
:
:
: An array is passed to the script: [[r, g, b], gunner]
: An [[Array|array]] is passed to the script: [[r, g, b], gunner]
:: r, g, b: [[Number]] - the light color
:: r, g, b: [[Number]] - the light color
:: gunner: [[Object]] - the unit who fired the flare shell
:: gunner: [[Object]] - the unit who fired the flare shell
Line 33: Line 33:
: Launched when pause menu is activated.
: Launched when pause menu is activated.
: To make it work in MP, use ''onPauseScript = "myScript.sqf"'' in [[description.ext]]
: To make it work in MP, use ''onPauseScript = "myScript.sqf"'' in [[description.ext]]
:
: An [[Array|array]] is passed to the script: [display]
: [http://forums.bistudio.com/showthread.php?108466-Detect-load-game-or-ESC-menu&p=1763523&viewfull=1#post1763523 Topic reference]
: [http://forums.bistudio.com/showthread.php?108466-Detect-load-game-or-ESC-menu&p=1763523&viewfull=1#post1763523 Topic reference]


Line 38: Line 40:
: Launched when the player dies permanently, and does not become a [http://community.bistudio.com/wikidata/images/archive/e/ed/20070308214324!Seagull.jpg seagull].
: Launched when the player dies permanently, and does not become a [http://community.bistudio.com/wikidata/images/archive/e/ed/20070308214324!Seagull.jpg seagull].
:
:
: Passed an array: [player, killer]
: Passed an [[Array|array]]: [player, killer]
::player: [[object]] - the player killed
::player: [[Object|object]] - the player killed
::killer: [[object]] - the unit that killed player - is the player in suicide/collision case
::killer: [[Object|object]] - the unit that killed player - is the player in suicide/collision case
:
:
: This script replaces the default death sequence. Make sure you place the command [[enableEndDialog]] somewhere in your script, as this will then cause the dialog that allows you to load, retry, or quit to appear.  
: This script replaces the default death sequence. Make sure you place the command [[enableEndDialog]] somewhere in your script, as this will then cause the dialog that allows you to load, retry, or quit to appear.
: In Armed Assault, this script is only executed if ''respawn'' in [[Description.ext]] is set to NONE (0).  If respawn is set to some other value, then the onPlayerKilled script is not executed.
: Since ArmA this script is only executed if ''respawn'' in [[Description.ext]] is set to NONE (0).  If respawn is set to some other value, then the onPlayerKilled script is not executed.


; onPlayerRespawnAsSeagull
; onPlayerRespawnAsSeagull
: Launched when the player dies and becomes a [http://community.bistudio.com/wikidata/images/archive/e/ed/20070308214324!Seagull.jpg seagull].
: Launched when the player dies and becomes a [http://community.bistudio.com/wikidata/images/archive/e/ed/20070308214324!Seagull.jpg seagull].
:
:
: Passed an array: [player, killer, seagull]
: Passed an [[Array|array]]: [player, killer, seagull]
::player: [[object]] - the player killed
::player: [[Object|object]] - the player killed
::killer: [[object]] - the unit that killed player - is the player in suicide/collision case
::killer: [[Object|object]] - the unit that killed player - is the player in suicide/collision case
::seagull: [[object]] - the seagull the player is about to possess.
::seagull: [[Object|object]] - the seagull the player is about to possess.
:
:
: This script will replace the default seagulling sequence. Make sure you place the command [[enableEndDialog]] somewhere in your script, as this will then cause the dialog that allows you to load, retry, or quit to appear.  
: This script will replace the default seagulling sequence. Make sure you place the command [[enableEndDialog]] somewhere in your script, as this will then cause the dialog that allows you to load, retry, or quit to appear.
: In Armed Assault, this script is only executed if ''respawn'' in [[Description.ext]] is set to BIRD(1), or to GROUP (4) and all the group is dead.  
: Since ArmA this script is only executed if ''respawn'' in [[Description.ext]] is set to BIRD(1), or to GROUP (4) and all the group is dead.


; onPlayerRespawnOtherUnit
; onPlayerRespawnOtherUnit
Line 64: Line 66:
::new: [[object]] - the new unit the player is about to possess.
::new: [[object]] - the new unit the player is about to possess.
:
:
: This script will replace the default respawn sequence.  
: This script will replace the default respawn sequence.
: In Armed Assault, this script is only executed if ''respawn'' in [[Description.ext]] is set to GROUP (4) and there is another group member still alive.
: Since ArmA, this script is only executed if ''respawn'' in [[Description.ext]] is set to GROUP (4) and there is another group member still alive.


== See also ==
== See also ==

Revision as of 01:14, 1 March 2012

Event scripts are scripts which are fired by the game engine upon specific events. These scripts can be written in SQS syntax or SQF syntax (Armed Assault only, recommended).

The file extensions of the script depend on the used syntax. If you are using SQS syntax, the file extension is .sqs, else .sqf.

Note that these scripts must be in sqs syntax - if you write an onPlayer*.sqf, it won't be executed - the default onPlayer*.sqs contained in the ca.pbo file will get executed instead. One easy way around this is to create both the .sqf and .sqs files, inside the .sqs files you can just put this piece of code

_this execVM onPlayer*.sqf

Remember to replace the * with the appropriate type.

Available Scripts

init
Launched when mission is started (before briefing screen).
initIntro
Launched when intro is started.
exit
Launched when mission is finished (before debriefing screen).
One argument of type Number is passed to the script: The number of game end.
onFlare
Launched when illuminating shell is lit.
An array is passed to the script: [[r, g, b], gunner]
r, g, b: Number - the light color
gunner: Object - the unit who fired the flare shell
onPauseScript
launches pauseOnLoad.sqf
Launched when pause menu is activated.
To make it work in MP, use onPauseScript = "myScript.sqf" in description.ext
An array is passed to the script: [display]
Topic reference
onPlayerKilled
Launched when the player dies permanently, and does not become a seagull.
Passed an array: [player, killer]
player: object - the player killed
killer: object - the unit that killed player - is the player in suicide/collision case
This script replaces the default death sequence. Make sure you place the command enableEndDialog somewhere in your script, as this will then cause the dialog that allows you to load, retry, or quit to appear.
Since ArmA this script is only executed if respawn in Description.ext is set to NONE (0). If respawn is set to some other value, then the onPlayerKilled script is not executed.
onPlayerRespawnAsSeagull
Launched when the player dies and becomes a seagull.
Passed an array: [player, killer, seagull]
player: object - the player killed
killer: object - the unit that killed player - is the player in suicide/collision case
seagull: object - the seagull the player is about to possess.
This script will replace the default seagulling sequence. Make sure you place the command enableEndDialog somewhere in your script, as this will then cause the dialog that allows you to load, retry, or quit to appear.
Since ArmA this script is only executed if respawn in Description.ext is set to BIRD(1), or to GROUP (4) and all the group is dead.
onPlayerRespawnOtherUnit
Launched when the player dies and respawns into another unit member.
Passed an array: [player, killer, new]
player: object - the player killed
killer: object - the unit that killed player
new: object - the new unit the player is about to possess.
This script will replace the default respawn sequence.
Since ArmA, this script is only executed if respawn in Description.ext is set to GROUP (4) and there is another group member still alive.

See also