home *** CD-ROM | disk | FTP | other *** search
/ Total Meltdown / dukenukemtotalmeltdown.img / doco / cons / d3dcn025.txt
Text File  |  1996-06-26  |  28KB  |  817 lines

  1. THE UNOFFICIAL DUKE NUKEM 3D .CON FILE HACKER'S GUIDE (v .025)
  2. By Ben Cantrick (cantrick@rintintin.colorado.edu)
  3.  
  4.  
  5. Obnoxious but possible important mumbo-jumbo:
  6.  
  7.   This document is perpetually under revision. Please e-mail corrections,
  8. comments, additions, clarifications, etc... to the author! In particular, 
  9. I'd love info and WELL COMMENTED example code for AI routines and anything
  10. else you can think of related to .CON file hacking. 
  11.  
  12.   All permissions are given to copy and reproduce this document provided
  13. no profit is made from such. The author disclaims all responsibility
  14. for the information contained herein and makes no express or implied
  15. warranty for it's fitness for any particular use. If playing with your
  16. .CON files makes your computer crash, it's not my fault!
  17.  
  18.  
  19. -----
  20.  
  21. What's new since version .021?
  22.  
  23.   - Restructuring of the primitives and "where to find" sections.
  24.   - Restructuring of the thank you's section.
  25.   - Some primitives clarified.
  26.   - New primitive discovered. (operate)
  27.   - Yet another web page added.
  28.   - No more examples yet. (Argh!)
  29.  
  30. -----
  31.  
  32.  
  33. INDEX/TABLE OF CONTENTS:
  34.  
  35.   A. What are .CON files?
  36.   B. Can I alter .CON files?
  37.   C. How do I alter .CON files?
  38.     * What is all this strange C-programming language-like junk?
  39.      ***** DEFS.CON: define
  40.      ***** USER.CON: definequote, definelevelname, music, definesound
  41.      ***** GAME.CON: comments, include, primitives
  42.       - Listing of primitives + their uses (if known)
  43.   D. Examples
  44.     * Trampoline trash cans
  45.     * Hollow-point pistol bullets    (Unfinished)
  46.     * Kamikaze enemies            (Unfinished)
  47.   E. So now what?
  48.   F. Appendix
  49.     * Where can I get this document?
  50.     * Contributors/Thank You's.
  51.  
  52. -----
  53.  
  54.  
  55. A. What are Duke Nukem 3D .CON files?
  56.  
  57.   .CON files are text files that "CON"trol certain aspects of the DOOM-
  58. like game Duke Nukem 3D (DN3D). There are three of them that come with
  59. the Shareware version of DN3D: DEFS.CON, USER.CON, and GAME.CON. (The full
  60. version of DN3D is has not been released as of the writing of this
  61. document, and so I can't say anything about it.) When DN3D starts up,
  62. it loads GAME.CON, checks it for errors, and if there are none keeps the
  63. instructions contained in it for use later on in the game. (GAME.CON is
  64. in charge of loading up any supplemental files, like DEFS.CON and USER.CON,
  65. that it may want to use) The instructions currently known to be usable in
  66. GAME.CON control things as mundane as how much damage each kind of weapon
  67. does to things as exotic as how enemies behave.
  68.  
  69.  
  70.  
  71. B. Can I alter .CON files?
  72.  
  73.   Yes, you most certanly can. This is one of the nicer features of the
  74. Build engine, or at least Duke3D's implementation of the Build Engine.
  75.  
  76.  But, before you start playing with them, you should definitly MAKE A
  77. BACKUP OF ALL YOUR .CON FILES!!!!! This is not only to prevent you from
  78. having to re-install DN3D if you mess up your existing .CON files, but
  79. also so that you can have the original .CON files as reference material
  80. when you start altering them. Once you've got backups made, altering
  81. the .CON files couldn't be easier: just open them up with your favorite
  82. text editor and edit away.
  83.  
  84.  
  85.  
  86. C. How do I alter .CON files?
  87.  
  88.   * What does all this weird, C-like junk in my .CON files mean??
  89.  
  90.   A lot of things, depending on which .CON file you edited. Let's take
  91. the .CON files from least complex to most complex:
  92.  
  93.  
  94.   ***** DEFS.CON:
  95.  
  96.   Most of the lines in DEFS.CON look something like:
  97.  
  98.     define SOMETHING SOMENUMBER 
  99.  
  100.   What they do is basically simple substitution: If you have a line
  101. somewhere in your DEFS.CON that said:
  102.  
  103.     define THEANSWER 42
  104.  
  105.   Then any time after that, if the word "THEANSWER" appears, "42" is
  106. substituted in it's place.
  107.  
  108.   By themselves, these lines aren't very interesting. They become helpful
  109. later on, when you're writing actor code and don't want to remember that
  110. an enemy who is TOUGH happens to have a strength of 1 with are really numbers.
  111.  
  112.  
  113.  ***** USER.CON:
  114.  
  115.   USER.CON is somewhat like DEFS.CON in that it mostly just defines things.
  116. However, USER.CON usually defines things that might be interesting to the
  117. game player, whereas DEFS.CON usually defines things that a DN3D player
  118. could care less about. USER.CON also contains nice technical notes written
  119. by the 3D Realms .CON programmer, Tod Replogle, that tell you all about how
  120. to modify it. Almost all of the info below is basically a rehash of the notes
  121. you can find in USER.CON
  122.  
  123.   There are 5 major kinds of lines in USER.CON: defines, definequotes, 
  124. definelevelnames, musics and definesounds.
  125.  
  126.   "define" lines are no different than they were in DEFS.CON; they define
  127. stuff. Most of the stuff you can define here is emminantly useful, tho.
  128. Examples abound: You can define Duke's starting and maximum health and
  129. armor values here. You can define how much ammo Duke gets per clip picked up,
  130. how much ammo is allowed for each weapon, how much damage each weapon does
  131. per hit, etc, etc...
  132.  
  133.  
  134.   "definequote" lines define the different things that will pop up on the
  135. screen in response to certain game events. You can define what words
  136. appear on the screen when you get an some ammo or an inventory item, what
  137. words appear on the screen when you use the various cheat codes, what
  138. words will appear when you adjust game options, etc, etc...
  139.  
  140.  "definequote" lines have two arguments: a number and a quote. The number
  141. is what you use to refer to the quote by later on. For example, the line:
  142.  
  143.     definequote 101     NIGHT VISION GOGGLES!
  144.  
  145.  Defines quote number 101 is "NIGHT VISION GOGGLES!" (This is pretty
  146. obvious, isn't it?) One other thing to keep in mind while making quotes;
  147. Todd Replogle, the Duke3D .CON file programmer, cautions:
  148.  
  149. >// Maximum quote size is 64 characters.
  150.  
  151.  
  152.   "definelevelname" lines are used to define the episode and level number,
  153. floor-plan file, par and record times, and level names for each level. The
  154. format of a definelevelname line is:
  155.  
  156.     definelevelname #LEVEL #EPSIODE MAPFILE PARTIME RECORDTIME LEVELNAME
  157.  
  158.   For example, Episode 1, Level 5 is "The Abyss." The floor-plan of this
  159. level is in the file E1L5.map. (which is actually contained in DUKE3D.GRP)
  160. The par time is 9 minutes, 10 seconds, and the record time is 5 minutes
  161. flat. It's definelevelname entry looks like this:
  162.  
  163.     definelevelname 0 4 E1L5.map 09:10 05:00 THE ABYSS
  164.  
  165.   As you can see, you must subtract one from the actual episode and level
  166. numbers before you put them on the definelevelname line. We're in Episode 1,
  167. but the #EPISODE is 0. We're in level 5, but the #LEVEL is 4. Notice also
  168. that you should (I don't think it's actually required) pad the par and
  169. record times with a leading 0 if necessary. There are also some comments
  170. from Todd Replogle, taken from USER.CON:
  171.  
  172. >  - Level file names cannot excede 13 characters.
  173. >  - Level par cannot excede 5 characters (min:sec)
  174. >  - Level titles cannot excede 32 characters.
  175.  
  176.  
  177.   "music" lines (as far as I can tell) define which .MID files to play for
  178. each level. Beyond that I'm not entirely sure how "music" lines specify
  179. exactally which file to play for which level; if someone can enlighten
  180. me I'd be appreciative.
  181.  
  182.  
  183.   "definesound" lines define various names that correspond to ways to
  184. play a VOC file. The format of a definesound line is:
  185.  
  186.     definesound SOUNDNAME VOCFILENAME.voc    #1  #2  #3  #4  #5
  187.  
  188.   Once again, Todd Replogle has provided .CON file hackers with a helpful
  189. technical note in USER.CON:
  190.  
  191. >    -----------------------------------------------------------------
  192. >    ABOUT CHANGING SOUND FX
  193. >    The sound fx section follows this explanation. 
  194. >
  195. >    1. The program expects to find a .VOC file
  196. >    2. You can either change the VOC name listed below to match your new
  197. >       sound, or you can rename yoariation range.
  198. >             They can be positive or negative numbers.
  199. >       - The 3rd number is a priority flag.
  200. >       - The 4th number is a bit parsed set of technical variables
  201. >             that identify the type of sound it is in the game.
  202. >       - The 5th number is a volume adjustment flag.
  203. >    -----------------------------------------------------------------
  204.  
  205.   The explanation seems pretty self-evident, so I won't go into a detailed
  206. explanation of each field of the definesound line.
  207.  
  208.  
  209.  
  210.  ***** GAME.CON:
  211.  
  212.   The BIGGIE! Lots of stuff in this one, and most of it rather difficult to
  213. explain... let's start out with the first couple of lines, which are:
  214.  
  215.     /*
  216.     -------------------------------------------------------------------
  217.         Duke Nukem 3D Script Code.
  218.     Todd Replogle.
  219.     -------------------------------------------------------------------
  220.         */
  221.  
  222.   If you're a C programmer, this stuff is immediatly obvious: everything
  223. between /* and */ is considered a "comment" and Duke3D will almost always
  224. ignore it when reading in GAME.CON. (I say "almost always" because it appears
  225. that Duke still counts the curly braces, { and }, inside comments. This can
  226. lead to some interesting effects; comment out some bad code that has non-
  227. matching curly braces and the game might refuse to load up, even though the
  228. bad code is inside a comment, and supposedly never even seen.) 
  229.  
  230.   There are two kinds of comments: the double-slash or "//" comment and the
  231. "/* */" comment. A "//" comment starts at the double-slash and extends to the
  232. end of the line. A "//" comment ends at the end of the line.
  233.  
  234.   The "/* */" comment can span several lines, but "//" comments only "null
  235. out" one line, at most. Many // and /* */ comments can be found all over
  236. DEFS.CON, USER.CON, and GAME.CON.
  237.  
  238.   Forewarned: you must put a space after "//" before typing the text of
  239. the comment. The comment: "//This is a comment" will cause Duke3D to error
  240. out. Changing the comment to "// This is a comment" will fix the problem.
  241. I assume the same holds for "/* */" comments. Things like: "/*C*/" are
  242. a no-no. Things like "/* C */" are OK.
  243.  
  244.  
  245.   The next few lines in GAME.CON are "include" lines which basically 
  246. cause Duke3D to process the specified file. The line:
  247.  
  248.     include defs.con
  249.  
  250.   Makes DN3D go process DEFS.CON before it moves along to the next line.
  251.  
  252.  
  253.   And now, the really big, confusing ones: states, actions, and actors.
  254.  
  255.   Apogee hasn't said anything about states, actions, or actors yet, so the
  256. things I'm about to tell you are pure conjecture based on observation and
  257. experimentation:
  258.  
  259.  
  260.   *****STATEs
  261.  
  262.   As far as I can tell, "states" can be thought of as something like
  263. subroutines. You go into a state, do something, and then come back to
  264. wherever you were. The first state in GAME.CON is the "rats" state, which
  265. randomly makes some rats whenever it's called.
  266.  
  267.   The format of a state is:
  268.  
  269. state #STATENAME
  270.  ...
  271. ends
  272.  
  273.   STATENAME is a unique number that is usually DEFINEd to be the name of 
  274. the state. No two states should have the same number. "ends," of course,
  275. is short for "End State." Be sure that your states are defined before you
  276. try and use them. If you try and use a state (in an actor, perhaps) that
  277. hasn't been defined earlier in the file, DN3D will error.
  278.  
  279.  
  280.   *****ACTIONs
  281.  
  282.   As far as I can tell, an "action" specifies a sequence of sprites
  283. (pictures) to draw onto the screen. The format of an action is still
  284. not quite entirely known, but it seems to be something like this:
  285.  
  286.     action #SPRITEGROUP #FIRSTFRAME #LASTFRAME #?? #?? #DELAY
  287.  
  288.   Each action has a set of pictures, or "frames" associated with it.
  289. The number first number, #SPRITEGROUP, defines this bunch of picures, or
  290. a "sprite group." #SPRITEGROUP is usually a DEFINEd number, so you can
  291. type "action BURNING_FRAMES" instelling it.)
  292.  
  293.  The #DELAY number determines the delay between frame changes. That is,
  294. how rapidly the frames are animated on-screen. 1 = small delay and fast
  295. animation, bigger numbers = bigger delays and slower animation. (I think?)
  296.  
  297.  The two remaining numbers are a mystery. If anybody knows what they mean
  298. and how they're used, please mail me at cantrick@rintintin.colorado.edu so
  299. I can add them to the guide.
  300.  
  301.  
  302.   *****ACTORs
  303.  
  304.   As far as I can tell, an "actor" is any (freestanding?) object in the
  305. game that does something. Obviously, Duke and the enemies are actors.
  306. However, the rubber-maid trash cans in the movie-theater lobby are also
  307. actors, because they dent and then bounce back when you shoot them. The
  308. items and weapons and clips are also actors, because they also do something
  309. when you run over them: they give you an item, a weapon, or more ammo.
  310.  
  311.   Walls are not actors, because they don't 'do' anything except sit there.
  312. (Bullet-holes being an exception, I guess. Perhaps the bullets themseves are
  313. some kind of actor that effect the surface they hit.) Doors and lifts are
  314. borderline; I suppose the game might treat them as actors internally, but I
  315. don't know if you can/how you would alter their behavior in the .CON file. 
  316.  
  317.   The format of an actor is something like:
  318.  
  319.     actor #ACTORNUMBER #ACTORSTRENGTH #ACTION #SPEED #AI_FUNCTION
  320.      ...
  321.     enda
  322.  
  323.   #ACTORNUMBER is (I think?) a unique number that identifies this actor.
  324. No two actors should have the same number. Usually #ACTORNUMBER is
  325. DEFINEd to be something easier to remember than a number.
  326.  
  327.   #ACTORSTRENGTH is a number that determines how much damage this actor
  328. can take before it breaks, dies, etc... (I think?) Putting a value of 0
  329. for this field makes the object invincible. Usually, #ACTORSTRENGTH is
  330. DEFINEd to be something easy to remember. (See 'define TOUGH' above.)
  331.  
  332.   #ACTION is (I think?) the number of an action (that is, the identifying
  333. number of a series of frames) to cycle through for this actor, if this
  334. actor is animated. Patches of fire actors use this to maintian an image-
  335. loop so they look like they're constantly burning. The HoloDuke recharge
  336. also uses an action to make the shimmer propagate across it's surface.
  337.  
  338.   #SPEED is (I think?) how fast this actor moves, if it moves. I don't know
  339. if "move" is always interpreted in the traditional sense; it appears from
  340. the gun-turret actor code that turrets that spin in place are considered to
  341. be "moving." 
  342.  
  343.   #AI_FUNCTION is (I think?) a number, as defined in DEFS.CON, that
  344. specifies what this actor's initial AI is if it has an initial AI. The AI
  345. routines are: face_player (1), geth (2), getv (4), random_angle (8),
  346. face_player_smart (64), fleeenemy (128), seekplayer (512), fleeplayer (1024),
  347. looking (2048) and dodgebullet (4096). As to what these mean or how they
  348. work, I haven't any idea.
  349.  
  350.   The last three parameters of actor seem to be optional. Things that aren't
  351. animated, don't "move" and have no AI don't seem to include those parameters.
  352. You can make a perfectly sensible actor without them; as a matter of fact
  353. the majority of non-enemy actors in Duke3D (ammo and items) do not use them
  354. at all.
  355.  
  356.  
  357. * You keep putting "..." inside states and actors as if we already know
  358.   what's supposed to go inside there; but we don't!
  359.  
  360.   Well, this is kind of sticky; there are quite a few things inside there,
  361. most of them vaguely reminiscent of the C programming language with a
  362. virtual environment twist. The things that go inside actors and actually
  363. make up the actor "code" are what I'll call "primitives." Primitives are
  364. simple operations that the Build Engine will perform for you. For instance,
  365. one primitive is "ifrnd" which will tell you if a random number between
  366. 0 and 256 was less than the number you gave it. For instance, if you
  367. wanf the time.
  368.  
  369.   There are a bunch of other primitives, too. I'll list them each here,
  370. along with their arguments and what they do. After that, I'll give some
  371. (hopefully) illustrative examples on how to use them.
  372.  
  373.   Note: Primitives marked with a "?" instead of a "-" are still mysteries
  374. to me. As usual, mail me (cantrick@rintintin.colorado.edu) if you know how
  375. they work or if I've forgotten any primitives.
  376.  
  377.   Note: Most "add" primitives are subject to some kind of limit. These
  378. limits are usually explained in the explanation of the primitive.
  379.  
  380.  Note: All (?) 'ifXXXXX' primitives can have an (optional) else clause
  381. that gets executed if the condition being tested is false. For instance:
  382.  
  383.     ifphealthl 45 {
  384.       quote OK              // Print "You're OK."
  385.     }
  386.     else {
  387.       quote BUMMER          // Print "Find some health!"
  388.     }
  389.  
  390.  
  391.  *****PRIMITIVES:
  392.  
  393. addammo #WEAPON #AMT            - Adds #AMT ammo to #WEAPON weapon,
  394.                                         Subject to max ammo constraint for
  395.     that weapon. Does not give player #WEAPON, only gives them ammo.
  396.     Ex: "addammo PISTOL_WEAPON PISTOLAMMOAMOUNT"
  397.  
  398.  
  399. addinventory #ITEM #AMT            - Adds #AMT of #ITEM to player's
  400.                     inventory, subject to #ITEM's max
  401.     amount limit.  
  402.  
  403.  
  404. addkills #NUM                - Adds #NUM to number of kills
  405.                     player has made.
  406.  
  407.  
  408. addphealth #NUM                - Adds #NUM points to player's
  409.                     health. (#NUM may be negative.)
  410.  
  411.  
  412. addweapon #WEAPON #INITIALAMT        - Gives player weapon #WEAPON that
  413.                     has #INITIALAMT of ammo in it.
  414.     Ex: "addweapon SHOTGUN_WEAPON 10"
  415.  
  416.  
  417. ai AINAME #ACTION #SPEED #AITYPE    ? Defines an AI routine for enemies
  418.                     to use. AINAME is any string, 
  419.     #ACTION is the series of frames to cycle through when the enemy
  420.     is using this AI, #SPEED is how fast the enemy moves when using this
  421.     AI and #AITYPE is what the enemy does when it's using this AI. (For
  422.     a list of AITYPEs, see #AI_FUNCTION under ACTORs.)
  423.                     
  424.  
  425. break                    - Stops whatever you're doing and
  426.                     immediatly exits the currently
  427.     running actor or state. 
  428.  
  429.  
  430. cactor #ACTORNUM            ? As far as I can tell, this
  431.                     primitive "c"alls another "actor"
  432.     to do something for you. 
  433.  
  434.  
  435. cstat #NUM                ? Allows setting of the attribute
  436.                     bit(s) of the current actor. #NUM
  437.     is the sum of the attributes you want this object to have. The values
  438.     of the attributes are as follows:
  439.         
  440.         1 - ?
  441.         2 - Translucent (With black as the transparent color?)
  442.         4 - Moving?
  443.         8 - Upside-Down
  444.         16 - Background (If looked at from above, this object
  445.     will appear blended in with the background.  Viewed any other way,
  446.     it will look normal.)
  447.         32 - Floor Texture (Draws object as a flat square on the
  448.     ground)
  449.         64 - ?
  450.         128 - Half submerged (Maybe for floating things?)
  451.         256 - Solid. (You can shoot it, you can stand on it, etc...)
  452.         32768 - Invisible.
  453.  
  454.     Ex. "cstat 10     // Turn upside-down and translucent. (10 = 8 + 2)"
  455.  
  456.  
  457. debris #??? #AMT            - Causes some debris to fly. (Whose
  458.                         action or spritegroup is defined
  459.     by #??? ?). Larger values of #AMT make more junk fly. Acceptable
  460.     values of #??? seem to be "SCRAP1" and "SCRAP2." 
  461.     Ex. "debris SCRAP2 5  // Lots!"
  462.  
  463.  
  464. define                     - Defines various things. See other
  465. definesound                sections of document.
  466. definelevelname
  467.  
  468.  
  469. fall                    - Causes the current actor to "fall"
  470.     until it hits a surface it can come to rest on. Good to do right after
  471.     you "spawn" something small from inside something larger.
  472.  
  473.  
  474. globalsound #SOUND             ? Plays the sound associated with
  475.                     #SOUND at (which?) Duke's location.
  476.  
  477.  
  478. guts #??? #AMT                - Like debris, but causes different
  479.                     kinds of body parts to fly instead
  480.     of debris. Acceptable values for #??? seem to be JIBS1 to JIBS5 (Misc
  481.     body parts) as well as HEADJIB1, LEGJIB1, ARMJIB1 (Trooper parts),
  482.     LIZMANARM1 and LIZMANLEG1 (Captain).  Also DUKETORSO, DUKELEG and
  483.     DUKEGUN.  Ex. "guts JIBS1 1   // A spine."
  484.  
  485.  
  486. hitradius #RADIUS #1 #2 #3 #4        ? Defines the effective distance and
  487.                     strenghts of area-effectors like
  488.     explosions and  suffer no damage at all.
  489.     Ex: "hitradius 1024 WEAKEST WEAK MEDIUMSTRENGTH TOUGH"
  490.  
  491.  
  492. ifactor    #NUM                ? Tells you if the currently
  493.                     executing code was called by
  494.     the given actor?
  495.  
  496.  
  497. ifactornotstayput            ?
  498.  
  499.  
  500. ifaction #ACTION { ... }        - Tests if the current actor is
  501.                     executing the given action, and
  502.     executes the appropriate code.
  503.  
  504.  
  505. ifactioncount #NUM { ... }        - Tests if the current actor is
  506.                               displaying the given frame of an
  507.     action, and exectes the appropriate code.
  508.                     
  509.  
  510. ifbulletnear                ? Checks to see if a bullet has
  511.                     passed near the current actor?
  512.  
  513.  
  514. ifcansee                - Returns true if Duke can
  515.                     see the current actor.
  516.  
  517.  
  518. ifcanseetarget                ? Enemy AI routine?
  519.  
  520.  
  521. ifcanshoottarget            ? Enemy AI routine?
  522.  
  523.  
  524. ifceilingdistg #NUM             - Returns true if the distance to
  525. ifceilingdistl #NUM            the ceiling is greater/less than
  526.                     the given number.
  527.  
  528.  
  529. ifcount                    ? Like ifactioncount, but counts
  530.                     the number of frames total that
  531.     have been used since the last call to ifcount?
  532.  
  533.  
  534. ifdead                    - True if the current actor has
  535.                     taken as much damage as they can
  536.     given their strength and should be pushing up daisies.
  537.  
  538.  
  539. iffloordistg #NUM            - True if the distance from the
  540. iffloordistl #NUM            current actor to the floor is 
  541.                     greater/less than #NUM.
  542.  
  543.  
  544. ifgapzl    #NUM                ? True if the distance between the
  545.                     floor and the ceiling at the actor's
  546.     location is less than #NUM.
  547.  
  548.  
  549. ifhitweapon                ? True if the current actor was
  550.                     hit with a weapon recently. (How
  551.     recently? Since the last call to ifhitweapon?)
  552.  
  553.  
  554. ifinwater                - True if the current actor is
  555. ifonwater                in/on water.
  556.                     
  557.  
  558. ifmove #NUM                ? True if the value of variable
  559.                     #NUM is not false?
  560.  
  561.  
  562. ifnotmoving                ? True if the current actor is
  563.                     not moving?
  564.  
  565.  
  566. ifp #COND                ? True if a player (the last one
  567.                     that affected this actor?) satisfies
  568.     #COND, when #COND can be one of the defined (in DEFS.CON) numbers:
  569.     pstanding, pwalking, prunning, pducking, pfalling, pjumping,
  570.     phigher, pwalkingback, prunningback, pkicking, pshrunk, pjetpack,
  571.     ponsteroids, ponground, palive, pdead, pfacing.
  572.  
  573.  
  574. ifpdistg #NUM                ? True if a(?) player's distance
  575. ifpdistl #NUM                from the current actor is greater/
  576.                     less than #NUM.
  577.  
  578.  
  579. ifphealthg #NUM                ? True if (which?) player's health
  580. ifphealthl #NUM                is greater/less than #NUM.
  581.  
  582.  
  583. ifpinventory #ITEM #AMT            ? True if less than #AMT of #ITEM
  584.                     is in (which?) player's inventory.
  585.  
  586.  
  587. ifrespawn                - True if monsters should respawn.
  588.  
  589.  
  590. ifrnd #NUM                - True if #NUM is less than a
  591.                     randomly selected number between
  592.     0 and 256. Ex. "ifrnd 128 {...}        // 50% chance."
  593.  
  594.  
  595. ifhitspace                ? True if a(?) player hit space.
  596.  
  597.  
  598. ifplayersg #NUM                ? True if (which?) player has
  599. ifplayersl #NUM                greater/less than #NUM Dukes left.
  600.  
  601.  
  602. ifspawnedby #ACTOR            - True if the current actor was
  603.                     SPAWNed by the given type of actor.
  604.  
  605.  
  606. ifspritepal #NUM            ? True if the current actor's
  607.                     sprite palette is #NUM. (See
  608.     spritepal for a listing of palette numbers and their meanings.)
  609.  
  610.  
  611. ifsquished                ? True if the current actor was
  612.                     hit by the shrink ray and then
  613.     stepped on. Ex. "ifsquished sound SPLURT    // Yummy!"
  614.  
  615.  
  616. ifwasweapon #WEAPON            ? True if the current actor was
  617.                     recently(how recently?) hit by a
  618.     shot from weapon corresponding to #WEAPON.
  619.  
  620.  
  621. killit                    - Removes the current actor from
  622.                     the map. Seems to need to be the
  623.     last instruction executed in an actor. In particular, don't try
  624.     to SPAWN after this.
  625.  
  626.  
  627. money #NUM                - Spawns #NUM dollar bills.
  628.  
  629.  
  630. move #??? [#1 #2 #3 ...    ]        ? Sets the value of #??? to
  631.                     #1, and #2, and #3,(?) or if they
  632.                     are not specified, to 0?
  633.  
  634.  
  635. operate                    ? Causes the current actor to
  636.                     push the 'operate' button thus
  637.     triggering a door, elevator or the like(?)
  638.  
  639.  
  640. palfrom #1 #2 #3            ? Rotates the palette from #1
  641.                     to #2 (and then back?), where #1
  642.     and 2 may be bitflags (aka 1, 2, 4, 8, etc...) where 16 specifies
  643.     red and 0 or 32 specifies green(?). #3 is a "delay" paramete on the
  644.                     screen in the usual fashion.
  645.  
  646.  
  647. resetactioncount            ? Resets the counter that counts the
  648.                     number of frames that have been
  649.     displayed by the action that the current actor is executing?
  650.                     
  651.  
  652. resetcount                ? Resets the global count of
  653.                     number of frames displayed by
  654.     this actor since the last call to resetcount of ifcount(?)
  655.  
  656.  
  657. shadeto #NUM                ? ???
  658.  
  659.  
  660. shoot #WEAPON                ? Makes an enemy fire it's weapon.
  661.                     (Seems to be used to trigger blood-
  662.                     splattering, too)
  663.  
  664.  
  665. sizeto #1 #2                ? Scales the sprites associated
  666.                     with the current actor to 1/#1 (?)
  667.     in the X direction and 1/#2 in the Y direction.
  668.  
  669.  
  670. sound #SOUND                - Plays the sound associated with
  671.                     #SOUND by definesound at the current
  672.                     actor's location.
  673.  
  674.  
  675. soundonce #SOUND            ? ???
  676.  
  677.  
  678. spawn #ACTOR                - Spawns a copy of #ACTOR.
  679.  
  680.  
  681. spritepal #NUM                ? Changes the color of the current
  682.                     actor. Each value of #NUM corresponds
  683.     to a different color scheme, some(?) of which are:
  684.  
  685.         1 - bright blue
  686.         4 - dark
  687.         6 - Night vision green
  688.         7 - "messed up yellow"
  689.         8 - green
  690.         10 - somewhat red
  691.         19 - very reddish
  692.         22 - Almost normal.
  693.  
  694.  
  695. wackplayer                - Boot... TO THE HEAD!
  696.                     <Thwoosh-DONK!>
  697.  
  698.  
  699.  
  700. D. Examples
  701.  
  702.  * Trampoline Trash Cans
  703.  
  704.   I love those grey and red rubber-maid trash cans in the movie theater
  705. lobby in level 1. They're simple and static, so they're fun to play with.
  706. Let's make it so that when a player shoots one, it dents, and if they're
  707. stand too "close" when the trash can bounces back, the trash can will hit
  708. them and jar their viewpoint for a second.
  709.  
  710.   First of all, we have to understand the trash can actor code:
  711.  
  712.     action RUBCANDENT 1 1 1 1 1
  713.     action RUBCAN
  714.  
  715.     actor RUBBERCAN WEAK
  716.  
  717.       ifaction RUBCANDENT {
  718.         ifactioncount 16 {
  719.           strength 0
  720.           action RUBCAN
  721.           break
  722.         }
  723.       }
  724.  
  725.       else ifhitweapon {
  726.         ...
  727.           }
  728.  
  729.     enda
  730.  
  731.   Well, first of all, we don't care about what will happen to the trash can
  732. if it's hit with a weapon, so forget about the 'else ifhitweapon' part
  733. except to keep in mind that it takes care of denting the trash can for us.
  734. (Which is really just a call to 'action RUBCANDENT')
  735.  
  736.   Now then, before we start modifying things, try and think of what's
  737. happening from the trash can's perspective. This is Zen and the art of
  738. Duke3D: you must "become one" with your actor code. ;]
  739.  
  740.   Thinking this way, the important stuff in this actor could be paraphrased
  741. in english as: "if I'm dented, and if I've been dented for a while, pop back."
  742. We'd like to modify that to: "if I'm dented, and if I've been dented for a
  743. while, pop back. And if the player's "close," then bump them."
  744.  
  745.   So how do we tell if the player's close? We can use the "ifpdistl"
  746. primitive to tell if the player is less than a certain distance away.
  747. Now, how close is "close?" Apogee (in DEFS.CON) defined a certain
  748. distance to be close enough to retrieve an item. This is a good
  749. estimate of "close." Apogee called this distance RETRIEVEDISTANCE.
  750. How do we "bump" the player? Why, we "wackplayer," of course. ;]
  751.  
  752.   Okay, the code is shaping up. We have to modify the actor right
  753. in the part where the trash can bounces back. That's the stuff
  754. inside the 'ifactioncount 16 { ... }' Okay, so we go in there.
  755. What do we want? Well, IF player_close { bump_player }, right?
  756. So:
  757.  
  758.     actor RUBBERCAN WEAK
  759.  
  760.       ifaction RUBCANDENT {
  761.         ifactioncount 16 {
  762.           strength 0
  763.           action RUBCAN
  764.  
  765. /* We added these three lines below: */
  766.           ifpdistl RETRIEVEDISTANCE {    // If player's close...
  767.         wackplayer            // Boot... TO THE HEAD!
  768.           }
  769.  
  770.           break
  771.         }
  772.           }
  773.     
  774.       ...
  775.  
  776.     enda
  777.  
  778.  
  779.  
  780.  * Hollow-point bullets.
  781.  
  782.  * Kamikaze enemies.
  783.  
  784.  
  785.  
  786. E. So now what?
  787.  
  788.   Now go start playing with the .CON files. The worst that can happen
  789. is that DN3D will refuse to run because you made a mistake. (Forgot a
  790. brace, or something) If so, you'll have t't e-mail Apogee or 3D Realms with questions;
  791. they have specifically disavowed all responsibility if you mess with the
  792. .CON files. Instead, do what comes naturally: play around until you figure
  793. out the answer.
  794.  
  795.  
  796.  
  797. F. Appendix
  798.  
  799.   * Where can I get this document?
  800.  
  801.   Several places. Here's a list:
  802.  
  803.     http://users1.ee.net/tgreco/confaq.htm
  804.     http://www.3drealms.com/confaq.html
  805.     http://rat.org/duke3d/faq.html
  806.     http://ccwf.cc.utexas.edu/~wieder/ROTT/extra.htm
  807.  
  808.  
  809.   * Contributors/Thank You's
  810.  
  811.    - Apogee Software/3D Realms for a truely fun game.
  812.    - Todd Greco, Joe Siegler, Rich Willoughby and Charlie Wiederhold for
  813. the HTML versions of the CFHG.
  814.    - Chris Gallagher (jazz411@aol.com), Rob Cannon (robbycan@gate.net),
  815. Mike Bobbit (Mike.Bobbitt@acadiau.ca), Peter Risser (PRISSER@us.ccl.com)
  816. for help with various primitives.
  817.