The Con Editing FAQ for Duke Nukem
3D |
This FAQ Is Authored and Copyright © 1999 By: Jonah Bishop |
Are you new to con file editing? If so, read section 1.2 right now.
Section 2 - Con Building Blocks
Section 3 - A Complete Primitive Listing
Section 6 - A General Con Overview
|
- |
Section 1 - FAQ Information | ||
Table of Contents | ||
1.1 About the Authors and General Information This FAQ was written by Joris Weimar, an avid Duke Nukem 3D FAQ, and a talented con file programmer. Also working on this FAQ is myself, Jonah Bishop. I also run the Map Editing FAQ for Duke Nukem 3D and Shadow Warrior. If you have any questions, tips, corrections or comments about con files or this FAQ, visit the Duke Nukem 3D Editing and Hacking forum at Dukeworld. Dukeworld --- 1.2 Con File Editing - An Introduction Con file editing is one of the coolest aspects of Duke Nukem 3D, and can be very productive in making Total Conversions and other game add-ons. Although it can look very difficult at first, editing con files is very easy and a fun way to make one of the coolest games in history even cooler. How does one edit con files you ask? Any text editor will do. I personally use Microsoft Wordpad (not Word) to edit con files (this program comes with Windows 95), but you can use any text editor you wish. The Microsoft Notepad program is not large enough to edit con files (the files are too big for notepad to handle), but the DOS editing program works quite well. Simply open up your favorite text editor and open the con file that you wish to edit. OK - You've opened a con file, but what do I do now? Well, if you're really serious about con file programming, you need to read through this FAQ. Even if you're not so serious about editing con files, quickly skim through this FAQ to find out how to edit some of the easiest parameters and settings in Duke Nukem 3D. You can do some very cool stuff with con files, so stick with it if you don't get it right away. If you have ever done any programming, you will instantly be able to edit con files. The most important instruction, however, for editing con files is simply - Have fun! This stuff shouldn't make you frustrated - if you aren't getting something, take a look through this FAQ, or visit the editing and hacking forum at Dukeworld. I personally hope you enjoy your con editing experience. 1.3 Revision History Version 0.1
Version 0.2
Version 0.3
Version 0.4
Version 0.5
Version 0.6
Version 0.7
Version 0.8
Versions 0.9 - 1.9
Version 2.0
Versions 2.1 - 2.9
Version 3.0
Version 3.1
Version 3.2
Version 3.3
Version 4.0
Version 4.1
Version 4.2
1.4 Credits and Contributors This FAQ would not be what it is today without the following people (who made suggestions and pointed out various errors):
1.5 Printing Information For the best printing, the entire font of this FAQ should be set to the following: COURIER NEW. The font on this online version is currently Arial. |
Section 2 - Con Building Blocks | ||
Table of Contents | ||
2.1 What is an action? An action is used to give a group of sprites, usually which are animated (as in an enemy movement or other such animated examples), a name. The structure for this primitive is: action <name> <startframe> <frames> <viewtype> <incvalue> <delay>
2.2 What is an actor? An actor is a sprite that will perform some function (spawn another sprite, give the player ammo, etc.) by performing several lines of code. The structure for this primitive is: actor <name> <strength> <action> <speed> <aifunction> {actor code} enda
Notes: In version 1.3D of Duke Nukem 3D, new actors cannot be added. The name of an existing actor, its corresponding code, and the artwork itself can be changed to add new actors (if you want to go to all of this trouble). In versions 1.4 or 1.5, however, you can create your own actors (without having to replace existing ones). See the section on "useractor" for more information on this. 2.3 What is an ai? An ai is an "artificial intelligence" routine. This is basically a set of code that an actor follows when said actor is instructed to do so. The structure for this primitive is: ai <name> <action> <speed> <type>
You can use more than one ai at the same time by listing them in order in the code that you write. For example: randomangle dodgebullet fleeenemy 2.4 What is a state? A state is a set of code that you will use several times (this is very useful in that you don't have to write the same code over and over). The usage for this primitive is as follows: state <name> {code} ends
Here is an example of a state:
To call a state from your code, simply type the following: state <name> 2.5 What is a useractor? [This function only works with versions 1.4 and 1.5] The useractor command is a new addition to versions 1.4 and 1.5. It allows people to create their own actors without having to replace old ones. It's usage is almost exactly like regular actors. The structure of the useractor command is as follows: useractor <type> <name> <strength> {actor code}
2.6 What is an if construction? If statements are perhaps the most powerful aspect of CON file editing. If statements evaluate the specified condition, and run code based on the returned value of the evaluation. Here is an example:
This simple example simply says this:
|
Section 3 - A Complete Primitive Listing | ||
Table of Contents | ||
3.1 The Complete Primitive List The following is a complete listing of all the "primitives" that can be placed into Duke Nukem 3D CON files. Primitives are simply commands and syntax in code that can control and test the items in the game. If you find any errors in this section, e-mail me at: jonahb //
/* and */
{ and }
action <name> <startframe> <frames> <viewtype> <incvalue> <delay>
action <name>
actor <name> <strength> <action> <speed> <aifunction> {actor code} enda
addammo <weapon> <amount>
addinventory <item> <amount>
addkill
addphealth <amount>
addstrength <value>
addweapon <weapon> <ammo>
ai <name> <action> <speed> <type>
ai <name>
break
cactor <actor>
clipdist <value>
count <number>
cstat <mask>
cstator <mask> (Used in Versions 1.4 and 1.5 Only)
debris <type> <amount>
debug <parameter>
define <string> <value>
definelevelname <eps> <lvl> <mapname> <par time> <3drealms>
definequote <value> <string>
defineskillname <skill> <string> (Used in Versions 1.4 and 1.5 Only)
definesound <value> <file> <pitch1> <pitch2> <priority> <type> <volume>
definevolumename <episode> <name> (Used in Versions 1.4 and 1.5 Only)
else
enda
endofgame <number>
ends
fall
gamestartup
getlastpal
globalsound <sound>
guts <type> <amount>
hitradius <radius> <1> <2> <3> <4>
ifaction <action>
ifactioncount <number>
ifactor <actorid>
ifactornotstayput
ifai <ainame>
ifangdiffl <angle> (Used in Versions 1.4 and 1.5 Only)
ifangdiffg <angle> (Used in Versions 1.4 and 1.5 Only)
ifawayfromwall
ifbulletnear
ifcansee
ifcanseetarget
ifcanshoottarget
ifceilingdistl <number>
ifcount <number>
ifdead
iffloordistl <number>
ifgapzl <number>
ifgotweaponce <number>
ifhitspace
ifhitweapon
ifinouterspace
ifinspace
ifinwater
ifmove <name>
ifmultiplayer
ifnosounds
ifnotmoving
ifonwater
ifoutside
ifp <type>
ifpdistg <number>
ifpdistl <number>
ifphealthl <number>
ifphealthg <number>
ifpinventory <item> <amount>
ifrespawn
ifrnd <number>
ifspawnedby <actor>
ifspritepal <number>
ifsquished
ifstrength <number>
ifwasweapon <weapon>
include <filename>
killit
lotsofglass <amount>
mail <number> (Used in Versions 1.4 and 1.5 Only)
mikesnd
money <number>
move <name> <horizontal> <vertical> <directions>
music <episode> <m1> <m2> ...
nullop
operate
palfrom <intensity> <red> <green> <blue>
paper <number> (Used in Versions 1.4 and 1.5 Only)
pkick
pstomp
quote <number>
resetactioncount
resetcount
resetplayer
respawnhitag
shoot <weapon>
sizeat <x> <y> (Used in Versions 1.4 and 1.5 Only)
sizeto <x> <y>
sleeptime <time>
sound <sound>
soundonce <sound>
spawn <actor>
spritepal <number>
state <statename> {code} ends
state <statename>
stopsound <sound>
strength <number>
tip
tossweapon
wackplayer
3.2 Predefined State Functions The following is a listing of (most) state functions that already exist in the GAME.CON file. You can alter these to your liking, but the default functions are described here. The states are listed in order of appearance (at least in the 1.4/1.5 CON files). state jib_sounds
state standard_jibs
state genericshrunkcode
state genericgrowcode (Versions 1.4/1.5 Only)
state blimphitstate
state rats
state toughgalspeech (Versions 1.4/1.5 Only)
state jibfood (Versions 1.4/1.5 Only)
state breakobject (Versions 1.4/1.5 Only)
state headhitstate
state burningstate
state steamcode
state random_ooz (Versions 1.4/1.5 Only)
state burningbarrelcode
state getcode
state randgetweapsnds
state getweaponcode
state respawnit
state quikget
state quikweaponget
state firestate
state drop_ammo
state drop_battery
state drop_sgshells
state drop_shotgun
state drop_chaingun
state random_wall_jibs
state femcode
state killme
state tipme
state toughgaltalk (Versions 1.4/1.5 Only)
state troop_body_jibs
state liz_body_jibs
state standard_pjibs
state handle_dead_dukes
state check p_standard
state rf
There are too many enemy states to put here, but they all cover the basic artificial intelligence routines for each enemy. 3.3 Known Bugs and Problems
3.4 Special Notes
|
Section 4 - Legal Values | ||
Table of Contents | ||
4.1 Values for addammo
4.2 Values for addinventory and ifpinventory
4.3 Values for addweapon
4.4 Values for cstat and cstator
Note: To use more than one setting add the values together (264 = solid (256) + upside-down (8). 256 + 8 = 264). 4.5 Values for guts
4.6 Values for ifp
4.7 Values for ifwasweapon
4.8 Values for shoot
4.9 Values for spritepal The following is a listing of all the legal values for the spritepal primitive. Palettes can effect 3 different 'layers' of a tile. The easiest way to understand these 3 different 'layers' is by using the stripper sprite. The 3 'layers' are: Background (her skin), Foreground (her clothes), and Minor Foreground (money, accessories, etc).
4.10 Legal Direction Values
|
Section 5 - Examples | ||
Table of Contents | ||
5.1 Example 1: Increase Duke Nukem's Health Difficulty Level: Easy To start out on the CON editing path, let's do something extremely easy. We are going to increase Duke Nukem's maximum health from 100 to 200. We also need to increase his Atomic Health (we'll take it to 400) so that picking up Atomic Health actually does something! First, open up the user.con file, and scroll down until you see the following line: define MAXPLAYERHEALTH 100 Now change that number, so that the line looks like this: define MAXPLAYERHEALTH 200 Now look for the line that looks like this: define MAXPLAYERATOMICHEALTH 200 And change it to this: define MAXPLAYERATOMICHEALTH 400 Now you are finished! Easy huh? Well, we'll now move on to something a little more difficult. 5.2 Example 2: Rubber Trash Cans Spawn Health When Destroyed Difficulty Level: Easy In this example, we will make the rubber trash can spawn health, but only 50% of the time, when it is destroyed by an explosion. Open the game.con file and scroll down to these lines of code: actor RUBBERCAN WEAK We need to add the following lines to the code in order to make the health spawn 50% of the time (instead of the rats).
But where do we put this set of code? Well, we first have to find where the code checks to see if the trash can has been hit by an explosion. You see that line that says ifwasweapon? That line of code checks to see if the trashcan was hit by the weapon stated there; the RADIUSEXPLOSION. So we need to place the weapon right in that section of code. The finshed product will look like this:
NOTE #1: Notice that we changed the ifrnd statement from 48 to 128. Why did we do that? Well, when you stack ifrnd statements up like they are, the chances of something happening are very small. For example: ifrnd 128 This statement tells the sub-code to happen only 25% of the time. How did I get that number? Well, the value of 256 is 100%, so the value of 128 is 50%. Then 50% of 50% is 25%. If it sounds confusing, just work through it again and you should pick it up. 5.3 Example 3: Booby-trapped Ammunition Difficulty Level: Intermediate In this example, we will make chaingun ammo turn deadly - but only for 25% of the time. Let's take a look at the chaingun ammo code, which can be found in the GAME.CON file:
You see all those if statements there under the second else? That is the area that we want to add our code to. We need to add the following lines to the code, so that 25% of the time, the chaingun ammo explodes.
So let's add our code to the ammunition. This is what the final product will look like:
Now, when you go into the game, every 25% (or roughly) of the time you should get hurt by an explosion. Cool way to make booby-traps, huh? 5.4 Example 4: Break the "Unbreakable" Plate (Versions 1.4/1.5 Only) Difficulty Level: Intermediate If you have ever played through Duke Nukem, you should hopefully have noticed the "unbreakable" plate in the sushi bar (episode 3, level 1). There is one plate the 3D Realms forgot about coding, and so it cannot be broken like the others can. What better a mistake for us to fix! This coding session will only work with versions 1.4 or 1.5 of Duke Nukem 3D, because we will need to make use of the "useractor" function. The plate that is in question is in slot #851 (you can take a look at it in Build or Editart). To make this slot an actor, we first need to define it in the defs.con file. Open up the defs.con file, and place the following line somewhere in this file:
I prefer putting these types of lines in order of appearance by tile number, much like 3D Realms did. Scroll down to the lines that say:
and put our define statement between the two lines that are there (because 851 is between 830 and 859). Now save your work and close this file. Now open the game.con file and place the following lines of code anywhere in the file:
Now, when you enter into the game, you can shoot the plate and it will break! Yay! We just fixed a bug in Duke Nukem 3D! 5.5 Example 5: Make Duke eat some food (Versions 1.4/1.5 only) Difficulty Level: Intermediate In this example, we are going to make use of the food that appears in a few of the levels in Episode 4 (Versions 1.4 and 1.5 only). We will make Duke eat the food when he is near enough to it, and we will add 10 health points to his health when he eats it. We also will make him say "Oooh, I needed that!" when his health is below 20. First, open up the user.con file, and scroll down to the line that says:
This is the last quote defined by 3D Realms, so we will make 2 new quotes to print. Add these lines right below the definequote 124:
We will use these quotes when we add code to the game.con file. Save your work and close user.con. First we need to make a state function. Open the game.con file and put the following lines of code at the top of the file:
Now we need to find where the actors are located. Scroll down to the line that says:
and change it to look like this:
This now allows our state function to work on FOODOBJECT11. But we want to change 12 through 20 as well. So just make each useractor that we want to change look just like the useractor above. Example:
Save your work, and when you go into the game, you will find that you can now press space near the food and you will gain 10 health points if you are below 100! |
Section 6 - A General Con Overview | ||
Table of Contents | ||
6.1 Defs.con This con file is the file where all basic definitions are made. Definitions for sounds, actors (sprites), and some other miscellaneous items can be found in this file. This file is included by the game.con at compile time (when the game is run). 6.2 User.con This con file is one of the easiest to edit. Parameters such as weapon strengths, health values, ammo values, level names, quotes, names of sounds, names of episodes (version 1.4 and 1.5 only), names of difficulty levels (version 1.4 and 1.5 only), and more exist in this con file. This is a fun con to edit, especially if you never wish to get deeply involved into con editing and hacking. This file is also included by the game.con at compile time (when the game is run). 6.3 Game.con This con file is the largest and the most complicated con file to edit. This file holds all the code for most actors in the game (some of the actors are hard coded). Most of the primitives available are used in this con file, and things can get quite complicated if you don't know where to start. This file gets compiled first at compile time, and includes (#include) the other two con files provided by 3D Realms. This is the con file to work with if you seriously want to get into con editing and hacking. |
Section 7 - Appendix | ||
Table of Contents | ||
7.1 Updates and Other Information Updates to this FAQ can be found at Dukeworld and at Map FAQ Central (see the following section for the URLs to these sites). If you find errors in this FAQ, if you find something that isn't in here, or you just have a suggestion let me know by filling out the Map FAQ Central Feedback Form. 7.2 Where to get this FAQ This FAQ can be found at Dukeworld and at Map FAQ Central.
|
||
Copyright © 1999 By: Jonah Bishop |