Event Scripts: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(added some discoveries about limitations about the event handlers.)
(Having wasted a day experimenting, I learned more about what scripts get executed when!)
Line 26: Line 26:


; onPlayerKilled
; onPlayerKilled
: Launched when the player is killed.
: Launched when the player dies permanently, and does not become a [[seagull]].
:
:
: 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.


== Limitations ==
; onPlayerRespawnAsSeagull
: Launched when the player dies and becomes a [[seagull]].
:
: 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 BIRD(1), or to GROUP (4) and all the group is dead.


At least some of these scripts are only fired in the mission has a [[Description.ext]] file present; for example, [[onPlayerKilled]].sqs is not executed unless the mission contains a [[Description.ext]] file.
; onPlayerRespawnOtherUnit
: Launched when the player dies and respawns into another unit member.
:
: This script replaces the default death 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.


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

Revision as of 13:56, 6 April 2007

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 the onPlayerKilled script must be in sqs syntax - if you write an onPlayerKilled.sqf, it won't be executed - the default onPlayerKilled.sqs contained in the ca.pbo file will get executed instead.

Available Scripts

init
Launched when mission is started (before briefing screen).
initIntro (since version 1.50)
Launched when intro is started .
exit (since version 1.50)
Launched when mission is finished (before debriefing screen).
One argument of type Number is passed to the script: The number of game end.
onFlare (since version 1.45)
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
onPlayerKilled
Launched when the player dies permanently, and does not become a seagull.
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.
onPlayerRespawnAsSeagull
Launched when the player dies and becomes a seagull.
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 BIRD(1), or to GROUP (4) and all the group is dead.
onPlayerRespawnOtherUnit
Launched when the player dies and respawns into another unit member.
This script replaces the default death 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.

See also