Events
Events allow the CON programmer to change the processing on an event.
Events are defined in enhance.con
Event blocks are started with 'onevent' and ended by 'endevent'
So,
onevent EVENT_INIT
{
}
endevent
Events are:
Called when game is initialized, just after script is parsed.
Only called once per game.
Called when a level is being entered
'LEVEL' is level number
'VOLUME' is volume number
Called when player's weapons are reset. This happens when they enter a level, and each time they 'come to life'
Called when player's inventory is reset.
The player has pressed the 'holster' key.
Set 'RETURN' to zero to allow default processing (the default is to allow processing).
You can also execute any code in the event handler (such as changing weapon flags, etc)
The player hit the 'look left' key.
Set 'RETURN' to zero to allow default processing
The player hit the 'look right' key.
Set 'RETURN' to zero to allow default processing
The player hit the 'JUMP' key while the jetpack is active.
Set 'RETURN' to zero to allow default processing
The player hit the 'Crouch' key while the jetpack is active.
Set 'RETURN' to zero to allow default processing
The player hit the 'crouch' key.
Set 'RETURN' to zero to allow default processing
The player hit the 'Jump' key.
Set 'RETURN' to zero to allow default processing
The player hit the 'Return to center' key.
Set 'RETURN' to zero to allow default processing
The player hit the 'look up' key.
Set 'RETURN' to zero to allow default processing
The player hit the 'look down' key.
Set 'RETURN' to zero to allow default processing
The player hit the 'aim up' key.
Set 'RETURN' to zero to allow default processing
The player hit the 'aim down' key.
Set 'RETURN' to zero to allow default processing
The player hit the 'Fire' key.
'WEAPON' is set to the weapon ID that is firing.
'WORKSLIKE' is set to the weapon's WorkLike setting.
So,
onevent WEAPON_FIRE
{
ifvare WOKSLIKE PISTOL_WEAPON
{
ifvare PISTOLJAMMED 1
{
setvar RETURN 1 // don't fire if jammed
setvar PISTOLJAMMED 0 // unjam it for next time
}
}
}
endevent
Set 'RETURN' to zero to allow default processing
The player is changing weapons.
The new weapon is in 'WEAPON' and 'WORKSLIKE'
-1 means 'no weapon'
There is no return value.
Called when the player is shooting.
The current weapon is in 'WEAPON' and 'WORKSLIKE'
Return the shot random distribution in 'ANGRANGE' and 'ZRANGE'.
Default is '32', and '256'. Numbers must be a power of two.
onevent EVENT_GETSHOTRANGE
{
addlogvar WORKSLIKE // log the current value (debugging)
ifvare WORKSLIKE PISTOL_WEAPON
{
// dump the defaults...(debugging)
addlogvar ANGRANGE
addlogvar ZRANGE
// set the values... setvar ANGRANGE 2 // very accurate setvar ZRANGE 16 } } endevent
Called when the auto aim angle is desired for the weapon.
Set 'AUTOAIMANGLE' to zero to disable auto-aim for the weapon.
Default value for AUTOAIMANGLE is 48.
onevent EVENT_GETAUTOAIMANGLE
{
// default is 48
ifvare WORKSLIKE PISTOL_WEAPON
{
setvar AUTOAIMANGLE 64 // a 'wider' auto-aim angle.
}
}
endevent
Get the tile to display as background when starting a level.
Set value into 'RETURN'. Default is LOADSCREEN (3281)
Player has entered a cheat to get steroids.
Set RETURN to amount of steroids to get.
On entry, RETURN is set to default.
Player has entered a cheat to get night vision.
Set RETURN to amount of night vision to get.
On entry, RETURN is set to default.
Player has entered a cheat to get inventory item.
Set RETURN to amount of item to get.
On entry, RETURN is set to default.
Player has entered a cheat to get inventory item.
Set RETURN to amount of item to get.
On entry, RETURN is set to default.
Player has entered a cheat to get inventory item.
Set RETURN to amount of item to get.
On entry, RETURN is set to default.
Player has entered a cheat to get inventory item.
Set RETURN to amount of item to get.
On entry, RETURN is set to default.
Player has entered a cheat to get inventory item.
Set RETURN to amount of item to get.
On entry, RETURN is set to default.
Player has entered a cheat to get inventory item.
Set RETURN to amount of item to get.
On entry, RETURN is set to default.
Player has hit the button (key).
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.
Player has hit the button (key).
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.
Player has hit the button (key).
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.
Player has hit the button (key).
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.
Player has hit the button (key).
On entry, RETURN is set to the next inventory item.
Set RETURN to zero to select no inventory item
Player has hit the button (key).
On entry, RETURN is set to the next inventory item.
Set RETURN to zero to select no inventory item
Player has hit the button (key) and Holoduke is turning on.
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.
Player has hit the button (key) and Holoduke is turning off
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.
Player has hit the button (key).
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.
Player has hit the button (key).
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.
Player has hit the button (key).
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.