EDuke CON Guide2 v9-01-2003 Release 1
© RTCM Cyborg
Introduction
| Basics |
Variables and
Operators | Events |
Weapons
Sector, Sprite and Wall
Structures | Miscellaneous Commands
Many people are gonna find the
information on the official Eduke site impenetrable. This guide is
designed for you. It gives an explanation of the features with possible
uses and examples. This section will be constantly
updated.
Basics
First things first, all the old stuff
from Duke Nukem Atomic has pretty much remained intact (although the
properties of some primitives may change later). Thus, it would be a
pretty good idea to know about the Duke Nukem Atomic CONs before you get
started with EDuke. The article I'm writing on standard CON effects will
not cover this: that's an article for experienced people who are looking
to spice up their CONs. No, what you want is a CON FAQ written for
beginners. You might find the one at MapFAQ Central a good start, I learnt all the commands
pretty quickly using it. Once you've absorbed the basics of the CON
language and tried out some of the stuff in my other article you are ready
to start here.
New stuff
The new stuff added so
far: -CON
additions from WWII GI, including Events, Weapon Changes, Weapon
Settings. -Global
variables and mathematical operators -Texture
detection for floors (not quite walls yet) -System
Variables -Acess
to the tags -Acess
to sector, sprite and wall structures
There are also a few other
miscellaneous things like being able to change the MIDI track and
such.
Variables and
operators
Useage
Variables and operators open up
a whole load of new possibilities for Eduke. With previous versions of
Duke Nukem keeping track of variables for things like the score in a CTF
game required the use of inventory items or other methods. Now we can
simply define a variable for the score and do any operation with it we
wish, quickly and easily. Variables are numbers which vary. They are
assigned tags so that you can keep track of their values. Operators are
devices which alter the numbers stored by a variable. The end result of
using variables and operators is to perform a mathematical function of
some sort. How complex or how simple that is depends entirely on the
programmer.
Syntax
gamevar <name> <value>
<flag> operatorvar <var1> <value> operatorvarvar
<var1> <var2>
Eh?
Gamevar tells Eduke to
set up a new variable with a name and value you give it. The flag value
tells it how to use the variable. It can either be a global variable, i.e.
used everywhere, per-player, for multiplayer values etc, or per actor, for
individual enemy settings etc... Performing an operation either occurs
with a variable and a value or another variable. They all take the form of
the operator's name then var for a variable and number operation or varvar
for variable and variable operation. See the appendix for information on
these operators.
Examples
Here is the code to perform
a 'bitstrip'. A bitstrip is a way of obtaining the values of the
individual bits of a variable which is being used as a flag. That is to
say, the value of the flag has no meaning in its decimal form, only the
binary form gives us useful information. You'll need this code later
on.
gamevar FLAGVAR 0 Create a global variable called FLAGVAR, this
is where store decimal form of the flag we want to look gamevar
BIT 0 0
In the actor code...
getactor[THISACTOR].cstat
FLAGVAR // Get the cstat flag for this actor setvar BIT 1 // Set the
first bit of the variable BIT andvarvar BIT FLAGVAR // Check to see if
bit 1 is set in FLAGVAR too ifvare BIT 1 { ...rest of code, you know
that bit one is set } else { ...do something else or... } setvar BIT 2
// Set the second bit of the variable BIT andvarvar BIT FLAGVAR //
Check to see if bit 2 is set in FLAGVAR too ifvare BIT 2 { ...bit 2 is
set, do something } else { ...it's not set... } setvar BIT 4 // Ser the
third bit of the variable BIT andvarvar BIT FLAGVAR // Check to see if
bit 3 is set in FLAGVAR too
and so on... using values of 8, 16, 32,
64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 to check all the
bits of a 16 bit variable. You will not need to use all these values for
cstat however, not all the bits contain usefull informaiton. The code
above works by performing an AND operator on the variable BIT that stores
the value you want to check for. The AND function works by checking each
of the bits in both variables and the result returned will only have the
bits that are set in both. In the first line the BIT variable has bit 1
set by the decimal number 1. If the FLAGVAR variable also has bit 1 set
then on performing an AND operation the value returned for BIT will be the
same as it was before, otherwise it will be
zero.
Appendix
Gamevar flags
0 - Global
variable 1 - Perplayer variable 2 - Peractor
variable
Operators
Note that the variable that is altered is
always the first one written. The second variable for varvar operations is
never altered. The arguement is either a variable or a value. set - set
the value of the variable with the arguement add - add the value of the
variable with the arguement if...e - returns true if the arguement is
equal if...l - returns true if the variable is less than the
arguement if...g - returns true if the variable is greater than the
arguement mul - multiplies the value of the variable with the
arguement div - divides the value of the variable with the
arguement mod - gives the remainder of a division of the variable with
the arguement and - gives the result of an AND function of the variable
with the arguement. An AND function checks the bits of each of the two
values being compared and the bits in the result are set only if they were
set in both of the values being operated on. or - gives the result of
an OR function of the variable with the arguement. An OR function checks
the bits of each of the two values being compared and the bits in the
result are set if they were set in either of the values being operated
on. rand - gives a random number from 0 to the arguement. Does not have
a varvar yet, only numbers are valid arguements.
Addendum
Note on System Variables: System
variables are variables which you can alter like other variables above but
are not defined by gamevar. They are used internally for several settings.
The easiest way to explain is to tell you what they are and what they
do.
RESPAWN_MONSTERS, RESPAWN_ITEMS, RESPAWN_INVENTORY,
MONSTERS_OFF, COOP, MARKER and FFIRE are all variables associated with
multiplay. They are the respawn times for monsters, items and inventory,
monsters on or off, co-op play or not, respawn markers on or off and
friendly fire on or off. You can change these dynamically in game. It's
hard to see how some of them may be used but there you are... LEVEL and
VOLUME refer to the current map you are playing. They cannot be altered,
only read. TRIPBOMB_CONTROL changes the action of the tripbomb using 1
for a Trip wire (default), 2 for a timer and 3 for both (it's another flag
system).
Events
Usage
Events are,
well, events that happen in the game. Just read the stuff below to get an
idea of what to use them for.
Syntax
onevent
EVENT_NAME { ...do something...
} endevent
Eh?
Basically if the event with
EVENT_NAME occurs the code in the curly brackets is executed. Many events
have system variables associated with them that can alter their effects,
maybe disable an effect or change its use. Look in the appendix for the
full list.
Examples
Don't like using the current load
tile?
onevent EVENT_GETLOADTILE // The entry tile for a
level setvar RETURN 1 // The entry tile will be set to tile
1 endevent // That's all
folks...
Appendix
Events
EVENT_INIT - called
just when the game is initiated, only called once. EVENT_ENTERLEVEL -
called upon entering a level. The system variables LEVEL and VOLUME return
the map being used. EVENT_RESETWEAPONS - called when the player's
weapons are reset when they enter a level or die. EVENT_RESETINVENTORY
- similar to RESETWEAPONS but for inventory instead. EVENT_HOLSTER -
the player has pressed the key for holster as defined in the setup file.
Set the system variable RETURN to zero to allow default
processing. EVENT_LOOKLEFT - similar to HOLSTER but the player has
pressed the look left key. EVENT_LOOKRIGHT - similar to HOLSTER but the
player has pressed the look right key. EVENT_SOARUP - similar to
HOLSTER but the player has pressed the jump key whilst using the
jetpack. EVENT_SOARDOWN - similar to HOLSTER but the player has pressed
the crouch key whilst using the jetpack. EVENT_CROUCH - similar to
HOLSTER but the player has pressed the crouch key. EVENT_JUMP - similar
to HOLSTER but the player has pressed the jump
key. EVENT_RETURNTOCENTER - similar to HOLSTER but the player has
pressed the center view key. EVENT_LOOKUP - similar to HOLSTER but the
player has pressed the look up key. EVENT_LOOKDOWN - similar to HOLSTER
but the player has pressed the look down key. EVENT_AIMUP - similar to
HOLSTER but the player has pressed the aim up key. EVENT_AIMDOWN -
similar to HOLSTER but the player has pressed the aim down
key. EVENT_FIRE - called when the player has pressed the fire key. The
system variable WEAPON gives the weapon ID of the weapon being fired and
the system variable WORKSLIKE is the weapon's works like setting. See the
Weapons section. Set RETURN to zero to allow default
processing. EVENT_CHANGEWEAPON - called when the player is changing
their weapon. The system variables WEAPON and WORKSLIKE give the same
results as for the event FIRE. A value -1 means no weapon and there is no
system variable RETURN. EVENT_GETSHOTRANGE - called when the player is
shooting. Again the system variables WEAPON and WORKSLIKE act the same as
for the FIRE event. The system variables ANGRANGE and ZRANGE alter the
spread of fire using polar co-ordinates. That is an angle and a distance
from the center of the shot. A ZRANGE of 0 would always produce a shot on
target. The numbers must be in powers of 2
however. EVENT_GETAUTOAIMANGLE - called when weapon autoaim is being
used. The system variable AUTOAIMANGLE sets the aim tracking, 0 would
disable it, 48 is the default. EVENT_GETLOADTILE - the tile to be used
as the loading background. The value is set in the system variable
RETURN. EVENT_CHEATGETSTEROIDS - the player has used a cheat to get
steroids. Set RETURN to the amount of steroids to
give. EVENT_CHEATGETHEAT - the player has used a cheat to get
nightvision. Set RETURN to the amount of nightvision to
give. EVENT_CHEATGETBOOT - the player has used a cheat to get boots.
Set RETURN to the amount of boots to give. EVENT_CHEATGETSHEILD - the
player has used a cheat to get armour. Set RETURN to the amount of armour
to give. EVENT_CHEATGETSCUBA - the player has used a cheat to get SCUBA
gear. Set RETURN to the amount of SCUBA gear to
give.
Weapons
Useage
The weapon
controls for Eduke have been vastly improved and gives a lot more freedom
over what you can do. I'm sure you don't need me to give you ideas about
new weapons...
Syntax
gamevar WEAPONx_PROPERTY
<value> 1
Eh?
Set the weapon property for
weapon x with the value, x will be in the range 0-11, valid values are
variable. See the appendix for the list of properties
possible.
Examples
How many times has it been asked
to change the pistol clip amount? Well now it's simple as:
gamedef
WEAPON1_CLIP 30 0
Appendix
Properties
SHOOTS -
what the weapon shoots, i.e., what tile number. FIREDELAY - the number
of animation frames before a shot actually takes place. HOLDDELAY - the
number of animation frames between shooting and reloading. TOTALTIME -
delay after firing before the weapon can be refired. SPAWN - item to
spawn, like bullet shells. If zero nothing is spawned. SPAWNTIME - the
number of frames before the item is spawned. CLIP - the amount of ammo
in the weapon's clip. 0 means there is no clip. SHOTSPERBURST - number
of shots per press of the fire button. WORKSLIKE - how the weapon
works, e.g. 9 would mean the weapon works like a trip
bomb. INITIALSOUND - the sound made initially. 0 means nothing is
sounded. FIRESOUND - sound made on the firing frame. 0 means nothing is
sounded. SOUND2TIME - as used in the shotgun for reloading sound. This
is the time before it is heard. SOUND2SOUND - sound made when
SOUND2TIME is reached. 0 means nothing is sounded. FLAGS - controls
weapon operation using a flag system. From the list below add up all the
values of the flags you want set to get the value to set FLAGS to. 1 -
'holstering' clears the current clip and gives you a fresh one. 2 - the
weapon 'glows', like the shrinker and expander. 4 - automatic
fire. 8 - during 'hold time' fire every frame. 16 - during 'hold
time' fire every third frame. 32 - restart for automatic is
'randomized' by RND 3. 64 - uses ammo for each shot. 128 - weapon is
the bomb trigger for the pipebomb. 256 - weapon use does not cause user
to become 'visible'. 512 - weapon throws the shot item, like the
pipebomb. 1024 - check weapon availability at 'reload' time. 2048 -
player stops jumping.
Addendum
Most weapons work
exactly the same. The pipebomb and tripbomb being the major exceptions.
The weapon display for the moment is still the same so the tile numbers
and the way the tiles are used is still the same. Certain combinations of
settings may cause the program to crash. The weapon system currently uses
'worklike' to control how the weapon works so there is not a major change
from the old weapon system there. Not all settings are supported by all
weapon 'modes'. For example, SOUND2TIME is only supported by the shotgun.
Sector, sprite and wall
structures
Useage
With these commands you can
alter a whole plethora of properties related to actors, walls and sectors.
I can't possibly begin to list what can be done, instead I will write some
example code for you to try with some of the ideas I have come up with.
When the first version of Eduke is released I will have a level pack
availible to show off these
CONs.
Syntax
getthing[<var>].member
<var2> setthing[<var>].member
<var2>
Eh?
Get/set the property member for the
thing with number var and place its value in var2. Note that many of the
possible .members already have CON control, whereas a few certainly
don't.
Examples
This example creates an actor for the
first tile which will increase the floor height of the sector with number
0 by one every game cycle.
gamevar SECTOR 0 2 // Create a per actor
variable called SECTOR (first value is amount to set second is a flag to
set the variable as a per actor variable.) gamevar PROPERTY 0 2 //
Create a per actor variable called PROPERTY
useractor notenemy 0 0
// Create the useractor getsector[SECTOR].floorz PROPERTY // Get the
floor height of the sector with number set in SECTOR and place the value
in PROPERTY addvar PROPERTY 1 // Increase the value of PROPERTY by 1,
experiment with this bit to get different effects for the sectors rate of
rise. A negative fall will make it fall, multiplying the value causes an
exponential increase. setsector[SECTOR].floorz PROPERTY // Set the
floor height of the sector with number set in SECTOR with
PROPERTY enda
Why cycle through only two colours?
gamevar
SECTOR 0 2 gamevar PAL 1 2 define TIME 30 useractor notenemy 0
0 setsector[THISACTOR].ceilingpal PAL setsector[THISACTOR].floorpal
PAL ifcount TIME { addvar PAL 1 } // Set the speed of colour change to
TIME ifvarg PAL 8 { setvar PAL 1 } // If the palette is green set back
to blue ifvarg PAL 2 { setvar PAL 8 } // Palette goes from
blue-red-green enda
More examples to come as I think of them...
possible ones to thing about include Doom style falling pillars that drop
underwater...
Appendix
There are a few gaps here,
some of the .members I could not work out their functions. If you know
what any of these missing .members do then e-mail
me.
getactor/setactor .member values.
x - the x position of
the actor y - the y position of the actor z - the z position of the
actor cstat - the properties of the actor, the same for the cstat CON
command. picnum - the actor's texture shade - the shade of the
actor pal - the palette of the actor clipdist - the clipping
distance of the actor filler - un-used bytes used to pad the next
member variable out to an even alignment - Matteus. xrepeat - the x
size of the actor yrepeat - the y size of the actor xoffset - the x
orientation of the actor texture yoffset - the y orientation of the
actor texture sectnum - the number of the sector the actor is
in statnum - internal list that the actor is on (active, inactive,
etc). - Matteus ang - the direction the sprite faces owner - 'owner'
for actor is used to determine who shot something. This is used to give
proper credit when a pipebomb blows somebody up, for instance. -
Matteus. xvel - the x velocity of the actor yvel - the y velocity of
the actor zvel - the z velocity of the actor lotag - the actor's
lotag hitag - the actor's hitag extra - extra is used for actors to
point to the offset in the compiled code for the start of the 'actor' or
'useractor'. - Matteus.
getsector/setsector .member
values.
wallptr - the number for the first wall, i.e. the one used
for slopes wallnum - the number of walls in the sector ceilingz -
the height of the ceiling floorz - the height of the
floor ceilingstat - miscellaneous information on the sector see
addendum after this section floorstat - miscellaneous information on
the sector see addendum after this section ceilingpicnum - the texture
for the ceiling ceilingheinum - the slope of the
ceiling ceilingshade - the shade for the ceiling ceilingpal - the
pallete for the ceiling ceilingxpanning - the x panning for the ceiling
texture ceilingypanning - the y panning for the ceiling
texture floorpicnum - the texture for the floor floorheinum - the
slope for the floor floorshade - the shade for the floor floorpal -
the pallete for the floor floorxpanning - the x panning for the floor
texture floorypanning - the y panning for the floor
texture visibility - the sector visibility filler - un-used bytes
used to pad the next member variable out to an even alignment -
Matteus. lotag - the sector lotag hitag - the sector hitag extra
- something Silverman left open to the game programmer, according to
TerminX
getwall/setwall .member values.
x - the x co-ord of
the first point of the wall y - the y co-orf of the first point of the
wall point2 - the wall number that gives the second point's co-ords in
it's x and y members nextwall - for double sided walls, the wall number
assigned to the other side, else -1 nextsector - for double sided
walls, the sector number assigned to the other side, else -1 cstat -
the propeties for the wall, as with the cstat for sprites. Note that some
have no effect unless the wall is a red line wall. picnum - the texture
used for the normal wall overpicnum - the texture used for the top
wall shade - the wall shade pal - the wall palette xrepeat - the
x size of the texture yrepeat - the y size of the texture xpanning -
the x panning of the texture ypanning - the y panning of the
texture lotag - the wall lotag hitag - the wall hitag extra -
something Silverman left open to the game programmer, according to
TerminX
Addendum
Note on [THISACTOR]: A very
useful little flag, this will get the .member value for the current actor
or the sector which the actor is in. It's use is very simple,
getactor[THISACTOR].x XPOS, will get the current actor's X position.
getsector[THISACTOR].floorz FLOOR is a faster way of
writing:
getactor[THISACTOR].sectnum
SECTOR getsector[SECTOR].floorz FLOORZ
Which would have the same
effect.
Note on floorstat/ceilingstat: bit 0: 1 = parallaxing, 0
= not bit 1: 1 = sloped, 0 = not bit 2: 1 = swap x&y, 0 =
not bit 3: 1 = double smooshiness, i.e. change the size of the floor
textures bit 4: 1 = x-flip bit 5: 1 = y-flip bit 6: 1 = Align
texture to first wall of sector bits 7-15: reserved Thus the numbers
stored in the stat's are binary flags. To read them you'll need to do a
'bitstrip', which is mentioned in the variables
section.
Miscellaneous commands
Audio
commands: ifsound <sound> - returns true if the current sound
with number given by <sound> is playing. starttrack <value>
- start the midi track with the number value defined sequentially by the
music command.
Texture commands: gettexturefloor - get the
current sector's floor texture in the variable
TEXTURE gettextureceiling - get the current sector's ceiling texture in
the variable TEXTURE gettexturewall - not yet implemented Note :-
these commands are achievable using member
structures.
lowtag/httag commands: spgetlotag - get the current
actor's lotag in the variable LOTAG spgethitag - get the current
actor's hitag in the variable HITAG sectgetlotag - get the current
sector's lotag in the variable LOTAG sectgethitag - get the current
sector's hitag in the variable HITAG Note :- these commands are
achievable using member structures.
Movement
commands: getplayerangle <var> - get the player's current angle
in the variable var setplayerangle <var> - set the player's
current angle with the variable var lockplayer <var> - lock the
player's movement for a count of var. getangletotarget <var> -
get the angle to face the nearest or current player in the variable
var setactorangle <var> - set the actor's angle with the variable
var getactorangle <var> - get the actor's angle in the variable
var
|