Page tree
Skip to end of metadata
Go to start of metadata

Event scripts are Script (Handle) which are fired by the game engine upon specific events. These scripts can be written in SQS Syntax or SQF Syntax.

The file extensions of the script depend on the used syntax. If using SQS Syntax, the file extension is .sqs, otherwise it's .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 will get executed instead.

Available Scripts

init

Launched when mission is started. (after briefing)


init_briefing

Launched when briefing is started.

initIntro

Launched when intro is started.

There is no intro feature in VBS4.

exit

Launched when mission is terminated via an end trigger (not if the player dies in a SP mission). Script is activated before debriefing screen. (If the debriefing has been disabled via a debriefing, this script will not run!)
One argument is passed to the script: [gameend]
gameend: Number - The number of game ending (as defined in the end trigger).

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

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.
This script is only executed if Respawn in 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 seagull 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 is only executed if Respawn in 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.
This script is only executed if Respawn in Respawn in description.ext is set to GROUP (4) and there is another group member still alive.