• Work continues

General Info
Main Page
Latest News
Schedule
What is it?
About Matt
About This Site

Duke Enhancements
Latest Features
Older Features
Cheat Codes

Duke Insider
Language Basics
Compile Time
Room over Room
Player Structures
UserDef Explanations

More Information
Features Database
E Duke Forum

WW2GI Enhancements
Variables
Weapon Changes
Weapon Settings
System Variables
Events
All

All


Variables


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.

Here's the additions to the CON language:

gamevar <name> <value> <flags>
Defines and sets the initial value for a variable. 
Valid flags are:
0 Global (default)
1 PERPLAYER Variable is per-player
2 PERACTOR Variable is per-actor

ifvarg <varname> <value>
ifvarl <varname> <value>
ifvare <varname> <value>
ifvarvarg <varname1> <varname2>
ifvarvarl <varname1> <varname2>
ifvarvare <varname1> <varname2>

Does the usual 'if' processing on the variable (g=greater than, l=less than, e=equal)

setvar <varname> <value>
Sets the value of the variable

addvar <varname> <value>
add <value> to variable.  <value> can be negative

addvarvar <varname1> <varname2>
adds <varname2> to <varname1> with the result in <varname1>

setvarvar <varname1> <varname2>
sets <varname1> equal to <varname2>

There are also pre-defined 'system' variables that can be overridden. See below for a list of these.

Example of definitions:

gamevar FAVORITE_WEAPON 0 1
gamevar GOTBIGCLIP 0 1
gamevar ALIENSKILLED 0 0
gamevar MYTARGET 0 2

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
}


Weapon Changes

Most weapons now work exactly the same.  Exceptions are: HANDBOMB_WEAPON and HANDREMOTE_WEAPON.

Note that the weapon DISPLAY is still the same (it DOES use WORKSLIKE). This means that tile numbers, weapon movement, etc is still the same way...

The variables work together like this:

Player presses 'fire'
'initialsound' is played (if set to non-zero)
Animation is started  

During animation, frames are counted off. At each frame, the following is the psuedo code that is processed for all weapons except HANDBOMB_WEAPON and HANDREMOTE_WEAPON:

At 'spawntime', spawn the item (if set)
At 'sound2time', make the sound (if set)
At 'firedelay', shoot the item(s)
if currentframe > 'firedelay' currentframe and < 'totaltime'
	if 'automatic'
	   if 'fireeveryother'
		if <everyother>
			shoot
	    else if 'fireeverythird'
		if <everythird>
			shoot
else if currentframe >= 'totaltime'
	if "clip reload in progress"
		at 'totaltime' +1 make EJECT_CLIP sound
		at "2/3 way through reload" make INSERT_CLIP sound
		at 'reload' end animation
	else
		if 'automatic' and "still firing"
			repeat animation
		else
			stop animation




  

Weapon Settings

Certain combinations of settings may (can) cause the program to crash....

The weapon system currently uses 'worklike' to control how the weapon works.

Many things in the code are still hard-coded (such as weapon position, etc).

Not all settings are supported by all weapon 'modes'.  For example, Sound2Time is only supported by the 'SHOTGUN_WEAPON'.

SHOOTS   what the weapons shoots (RPG, SHOTSPARK1, etc)
FIREDELAY   delay (in animation frames) before 'shot'
HOLDDELAY   delay (in animation frames from start) for between
'shoot' and 'reload clip'
TOTALTIME   delay after 'fire' before recycle to ready to fire again
SPAWN   item to spawn (if non-zero).  Use for SHELLS,
SHOTGUNSHELL, etc
SPAWNTIME   frame for when to spawn
FLAGS   holds flags to control wepon operation (AUTOMATIC
FIRE, BURSTS (like devistator), etc)
CLIP   Number of ammo in a 'clip' (zero means no clip)
SPAWNTIME   the frame at which to spawn an item
SPAWN   the item to spawn
SHOTSPERBURST   number of shots per 'burst' (one ammo per 'burst'
WORKSLIKE   What original the weapon works like
INITIALSOUND   Sound made when initialy firing. zero for no sound
FIRESOUND   Sound made when firing (each time for automatic)
SOUND2TIME   Alternate sound time (ie, shotgun cocking)
SOUND2SOUND   Alternate sound sound ID

//Weapon Flags:
(all defined in enhance.con)

WEAPON_FLAG_HOLSTER_CLEARS_CLIP   1   'holstering' clears the current clip
WEAPON_FLAG_GLOWS   2   weapon 'glows' (shrinker
and grower)
WEAPON_FLAG_AUTOMATIC   4   automatic fire (continues
while 'fire' is held
down
WEAPON_FLAG_FIREEVERYOTHER   8   during 'hold time' fire
every frame
WEAPON_FLAG_FIREEVERYTHIRD   16   during 'hold time' fire
every third frame.
WEAPON_FLAG_RANDOMRESTART   32   restart for automatic
is 'randomized' by RND 3
WEAPON_FLAG_AMMOPERSHOT   64   uses ammo for each shot
(for automatic)
WEAPON_FLAG_BOMB_TRIGGER   28   weapon is the 'bomb'
trigger
WEAPON_FLAG_NOVISIBLE   256   weapon use does not
cause user to become
'visible'
WEAPON_FLAG_THROWIT   512   weapon 'throws' the
'shoots' item...
WEAPON_FLAG_CHECKATRELOAD   1024   check weapon availability
at 'reload' time
WEAPON_FLAG_STANDSTILL   2048   Player stops jumping
(like old Trip
bomb)
The defaults (makes things work like they do now...):

gamedef WEAPON0_WORKSLIKE 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_RELOAD 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_FIREDELAY 7 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_TOTALTIME 14 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_HOLDDELAY 14 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_FLAGS 36 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_SHOOTS 2521 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_WORKSLIKE 1 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_CLIP 20 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_RELOAD 50 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_FIREDELAY 2 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_TOTALTIME 5 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_FLAGS 5 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_SHOOTS 2595 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_SPAWNTIME 2 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_SPAWN 2533 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_FIRESOUND 3 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_WORKSLIKE 2 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_RELOAD 13 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_FIREDELAY 4 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_TOTALTIME 31 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_FLAGS 1024 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_SHOOTS 2613 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_SPAWNTIME 24 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_SPAWN 2535 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_SHOTSPERBURST 7 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_FIRESOUND 109 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_SOUND2TIME 15 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_SOUND2SOUND 169 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_WORKSLIKE 3 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_RELOAD 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_FIREDELAY 1 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_TOTALTIME 12 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_HOLDDELAY 10 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_FLAGS 84 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_SHOOTS 2536 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_SPAWN 2533 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_FIRESOUND 6 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_WORKSLIKE 4 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_RELOAD 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_FIREDELAY 4 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_TOTALTIME 20 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_FLAGS 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_SHOOTS 2605 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_WORKSLIKE 5 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_RELOAD 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_FIREDELAY 6 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_TOTALTIME 19 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_HOLDDELAY 12 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_FLAGS 512 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_SHOOTS 26 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_WORKSLIKE 6 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_RELOAD 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_FIREDELAY 10 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_TOTALTIME 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_FLAGS 2 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_SHOOTS 2556 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_INITIALSOUND 11 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_WORKSLIKE 7 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_RELOAD 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_FIREDELAY 2 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_TOTALTIME 5 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_HOLDDELAY 5 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_FLAGS 8 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_SHOOTS 2605 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_INITIALSOUND 10 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_WORKSLIKE 8 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_RELOAD 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_FIREDELAY 3 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_TOTALTIME 16 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_FLAGS 2048 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_SHOOTS 2563 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_WORKSLIKE 9 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_RELOAD 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_FIREDELAY 3 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_TOTALTIME 5 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_FLAGS 8 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_SHOOTS 1641 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_INITIALSOUND 10 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_FIRESOUND 10 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_WORKSLIKE 10 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_RELOAD 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_FIREDELAY 2 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_TOTALTIME 10 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_FLAGS 384 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_SHOOTS 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_WORKSLIKE 11 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_RELOAD 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_FIREDELAY 3 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_TOTALTIME 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_FLAGS 2 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_SHOOTS 2448 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_INITIALSOUND 388 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_FIRESOUND 388 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef GRENADE_LIFETIME 120 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef GRENADE_LIFETIME_VAR 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef RESPAWN_MONSTERS  0 0 //  (system)
gamedef RESPAWN_ITEMS  0 0 //  (system)
gamedef RESPAWN_INVENTORY  0 0 //  (system)
gamedef MONSTERS_OFF  0 0 //  (system)
gamedef MARKER  0 0 //  (system)
gamedef FFIRE  0 0 //  (system)
gamedef LEVEL  0 0 //  (system) (read only)
gamedef VOLUME  0 0 //  (system) (read only)
gamedef COOP  0 0 //  (system)
gamedef MULTIMODE  0 0 //  (system)
gamedef WEAPON 0 0 //  (system) (read only)
gamedef WORKSLIKE 0 0 //  (system) (read only)
gamedef RETURN 0 0 //  (system)
gamedef ZRANGE 0 0 //  (system)
gamedef ANGRANGE 0 0 //  (system)
gamedef AUTOAIMANGLE 0 0 //  (system)  

Weapon setting defaults can be set in the CON for all players by defining the var with a new default (flags are ignored).  For instance:

	gamevar WEAPON1_CLIP 12 0
  

Sets the 'clip' for the PISTOL_WEAPON to 12 (note that the flags are ignored)


System Variables

These variables allow the CON programmer to take action and modify system performance.

They are:

RESPAWN_MONSTERS
RESPAWN_ITEMS
RESPAWN_INVENTORY
MONSTERS_OFF
COOP
MARKER
FFIRE
LEVEL	Read-only.  The current level number
VOLUME	Read-only.  The current volume number
TRIPBOMB_CONTROL
	1 for a Trip wire (default)
	2 for a timer
	3 for both (not tested)
  

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.