These will be usable by the CON as well as special variables will be used
by the weapon system.
These variables are CASE SENSITIVE. (FOOBAR is NOT the same as FooBar)
There are 'system' variables that allow you to change the way the weapon
(and other) systems work.
In addition, you can add your own variables in your code. Take a
look at what Tuco has done in these CONs: there's some pretty amazing stuff.
I'm sure that you can come up with more.
There are also pre-defined 'system' variables that can be overridden. See
below for a list of these.
Defines a new variable of 'FAVORITE_WEAPON' per-player.
Defines a per-player variable of 'GOTBIGCLIP' with the initial value of zero
Defines a global variable of 'ALIENSKILLED' with an initial value of zero
Defines a per-actor variable of 'MYTARGET' with an initial value of zero
In the code (for example, in a state or actor), the following could be
executed:
// use GOTBIGCLIP as a 'boolean' >0
mean 'true'
ifvarg GOTBIGCLIP 0
{
setvar WEAPON1_CLIP 30
setvar GOTBIGCLIP 0 // so we don't keep executing
}
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:
EVENT_INIT
Called when game is initialized, just after script is parsed.
Only called once per game.
EVENT_ENTERLEVEL
Called when a level is being entered
'LEVEL' is level number
'VOLUME' is volume number
EVENT_RESETWEAPONS
Called when player's weapons are reset. This happens when they enter
a level, and each time they 'come to life'
EVENT_RESETINVENTORY
Called when player's inventory is reset.
EVENT_HOLSTER
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)
EVENT_LOOKLEFT
The player hit the 'look left' key.
Set 'RETURN' to zero to allow default processing
EVENT_LOOKRIGHT
The player hit the 'look right' key.
Set 'RETURN' to zero to allow default processing
EVENT_SOARUP
The player hit the 'JUMP' key while the jetpack is active.
Set 'RETURN' to zero to allow default processing
EVENT_SOARDOWN
The player hit the 'Crouch' key while the jetpack is active.
Set 'RETURN' to zero to allow default processing
EVENT_CROUCH
The player hit the 'crouch' key.
Set 'RETURN' to zero to allow default processing
EVENT_JUMP
The player hit the 'Jump' key.
Set 'RETURN' to zero to allow default processing
EVENT_RETURNTOCENTER
The player hit the 'Return to center' key.
Set 'RETURN' to zero to allow default processing
EVENT_LOOKUP
The player hit the 'look up' key.
Set 'RETURN' to zero to allow default processing
EVENT_LOOKDOWN
The player hit the 'look down' key.
Set 'RETURN' to zero to allow default processing
EVENT_AIMUP
The player hit the 'aim up' key.
Set 'RETURN' to zero to allow default processing
EVENT_AIMDOWN
The player hit the 'aim down' key.
Set 'RETURN' to zero to allow default processing
EVENT_FIRE
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
EVENT_CHANGEWEAPON
The player is changing weapons.
The new weapon is in 'WEAPON' and 'WORKSLIKE'
-1 means 'no weapon'
There is no return value.
EVENT_GETSHOTRANGE
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
EVENT_GETAUTOAIMANGLE
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
EVENT_GETLOADTILE
Get the tile to display as background when starting a level.
Set value into 'RETURN'. Default is LOADSCREEN (3281)
EVENT_CHEATGETSTEROIDS
Player has entered a cheat to get steroids.
Set RETURN to amount of steroids to get.
On entry, RETURN is set to default.
EVENT_CHEATGETHEAT
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.
EVENT_CHEATGETBOOT
Player has entered a cheat to get inventory item.
Set RETURN to amount of item to get.
On entry, RETURN is set to default.
EVENT_CHEATGETSHIELD
Player has entered a cheat to get inventory item.
Set RETURN to amount of item to get.
On entry, RETURN is set to default.
EVENT_CHEATGETSCUBA
Player has entered a cheat to get inventory item.
Set RETURN to amount of item to get.
On entry, RETURN is set to default.
EVENT_CHEATGETHOLODUKE
Player has entered a cheat to get inventory item.
Set RETURN to amount of item to get.
On entry, RETURN is set to default.
EVENT_CHEATGETJETPACK
Player has entered a cheat to get inventory item.
Set RETURN to amount of item to get.
On entry, RETURN is set to default.
EVENT_CHEATGETFIRSTAID
Player has entered a cheat to get inventory item.
Set RETURN to amount of item to get.
On entry, RETURN is set to default.
EVENT_QUICKKICK
Player has hit the button (key).
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.
EVENT_INVENTORY
Player has hit the button (key).
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.
EVENT_USENIGHTVISION
Player has hit the button (key).
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.
EVENT_USESTEROIDS
Player has hit the button (key).
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.
EVENT_INVENTORYLEFT
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
EVENT_INVENTORYRIGHT
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
EVENT_HOLODUKEON
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.
EVENT_HOLODUKEOFF
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.
EVENT_USEMEDKIT
Player has hit the button (key).
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.
EVENT_USEJETPACK
Player has hit the button (key).
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.
EVENT_TURNAROUND
Player has hit the button (key).
On entry, RETURN is set to 0
Set RETURN to non-zero to prevent use of key.