ACTIONS EXPLAINED v1-01-2003 Release 1 © RTCM Reaper_Man
/!\ Attention: These FAQ's where written before the development of EDuke, many limits do not apply anymore.
These CON FAQs was written because I believe that there is no one place where CON information can be found - from the
simplest ideas to the most complex effects. After the fall of Dukeworld and 3D Portal, a web-edition of the CON FAQ seems to have been lost, and that leaves Duke RTCM as the only other source of CON information. Though they do have information on CONs and how to edit them, I don't
believe that this information is easily understood by the newest of newbie's.
The action primitive is used for several things in the game. Mainly, they are used to define animations for enemies and other things, giving them the illusion of movement. Here's an example of some action definitions for the Octabrain:
1) The action primitive must proceed each and every animation definitionThe numbers after the naming of the action have very important roles, especially when making an animated enemy. Lets take a closer look at the numbers:
The first number after the name is a frame offset. As the name implies, it makes the animation start on a different frame than the frame of the defined actor. For example, we have:
action AOCTAHIT 30 1 1 1 10
The number 30 means "move 30 frames and start the animation". Since the Octabrain is defined as tile 1820 in DEFS.CON , the action AOCTAHIT would start at tile 1850.
The second number is an animation count, it tells how many frames the animation will have. For example, the action AOCTASCRATCH has 4 frames in the action. This number and the next are very closely related.
The third number is how many frames to skip between each frame of animation. In the tiles, each enemy has 5 different frames for each animation; these are the angles, and are what is being skipped between each animation set.
Take a look at the AOCTAFROZEN action. It has 0 offset, 1 animation set, and 5 angles. In the game, when the Octabrain is frozen, it's frames are still and it doesn't move. If you were to change the number 1 to 3, making it resemble the AOCTAWALK action, it wouldn't move in the game, but it's animation would give the illusion of movement.
The fourth number is either 1 or -1. It determines the direction of animation. The number -1 was only used in 1 place, the TRANSPORTERSTAR actor:
action TRANSFOWARD 0 6 1 1 2
action TRANSBACK 5 6 1 -1 2
The action TRANSFOWARD has 1 as it's fourth number, it's animations travel foward. But the animation TRANSBACK has -1, which means it's animation travels backward. This makes the TRANSPORTERSTAR actor look like it is winking out of existance.
The fifth number is the rate or tempo, it determines how fast the frames move. As far as I know, there isn't any limitations on this number, except that it has to be higher than 0. The lower the number, the faster the animations moves. The average walking tempo is 12, the average running tempo is 8, and the average dying tempo is 16.
Like movements and palette settings, the action statement can be used as a flag to make your actor do different things, but not change frames. Since that each action is named, we can use it as a variable.
For example, lets say that you have a sprite of a light bulb, and you want the player's screen it get brighter the closer he gets to it. First, you would make a set of several action definitions:
action ABULB_1 0
action ABULB_2 0
action ABULB_3 0
action ABULB_4 0
The 4 different ABULB actions have different numbers at the end of their names, but each of their offsets are set to 0. Since the CONs check for an action name rather than the frame itself, this is where the trick comes in.
Somewhere in your LIGHTBULB actor, you would have something like this:
ifpdistl (distance 1)
ifpdistl (distance 2)
ifpdistl (distance 3)
ifpdistl (distance 4)
What this is doing is telling the LIGHTBULB actor to change it's action if the player is within certain ranges and if it can see the player. If it can't see the player, or the player is too far away, it tells itself to have an action of 0.
Next, you need to put something like this:
Note - The palfrom primitive is explained in the Primitive List.
What this does is make the palfrom primitive change the color of the screen, depending on what action is being played. Since the code from before tells the action to change depending on the distance of the player, you can set the palfrom primitive's variables to give the illusion the players vision is getting brighter.