Chapter 7

                            How to...


This chapter is intended as a cookbook: how to create different
effects.
## If you find out something new, please let me know and I'll add
it here.

7.1  *Extracting the original maps*


It's a very good idea to extract the original maps for Duke3D and
see how 3DRealms did things. It has the additional effect of
making you realize just how much work is in these levels and how
much you'll have to work to achieve anything similar :)

The command
KEXTRACT DUKE3D.GRP *.MAP
will extract all map files from Duke's group file.


7.2  *Abbreviations*


In order to easily describe tags, sector effectors and the like,
I use some abbreviations:

Bomb           Also called C9, it's a sprite with the tile number
               1247 (yellow gas bottle), x-shrunken as narrow as
               possible. It is intangible to the player, but
               blows up when triggered.

[x,y]          The tags of a sprite or wall: x is the hi-tag, y
               the lo-tag.
               Example: [0,34] describes a hi-tag of 0 and a lo-
               tag of 34.

(x)            Tile number (refers to sprites, too).
               Example: (621) is the camera sprite.

Controller     A special sprite (tile numbers 1..10) which is not
               shown at game time and controls the environment in
               some way:

S              Sector effector
               Example: S [100,256] means to insert a Sector
               effector with the hi-tag 100 and the lo-tag 256.

A              Activator

T              Touchplate

L              Locked activator

M              Music and SFX

L+             Locator

C              Cycler

D              Master switch

R              Respawn

Sp             Speed


7.3  Player starting points


Player starting points are marked by sprite number 1405.

You'll need to place at least 7 players (the player start
position is automatically included, so you don't have to set a
sprite there specifically for it).

Dukematch starting points have no tags.

Coop starting points have the tag [0,1].

7.3.1  Notes

    *  As far as I know, you can place any amount of dukematch
       starting points.
       ## Anybody knows what happens with too many coop starting
       points?


7.4  Glass panes


Glass panes are simply two-sided walls maskable walls (created by
pointing on the floor in front of a two-sided line and pressing
[M]) with the 'block movement' [B] and 'hitscan' [H] flags set.
The texture has to be glass (503).

7.4.1  Notes

    *  To create unbreakable glass, simply use a glass sprite
       instead of the glass texture.


7.5  Invisible forcefield


Often, you'll want to place an invisible forcefield someplace (it
ripples if hit, but doesn't damage the player).

Simply build a glass pane, using sprite 230 instead. This tile
can be made so transparent/dark as to be completely invisible.


7.6  Doorways


A doorway is nothing but a sector connecting two other sectors.
Simply lower the roof a bit, align the textures (use [O] and [.])
and you're ready to go.

7.6.1  Notes

    *  You can make arching doorways by splitting the doorway
       into several sectors and tilting the roof or even the
       floor.


7.7  Windows


A window is simply a sector with a raised floor and a lowered
roof which has been inserted into a normal wall.

7.7.1  *Setup*

Follow these steps to insert a window into a standard wall (made
up of one-sided walls):
    *  We'll assume the wall goes from east to west.

    *  In 2D mode, split each of the lines making up the wall
       twice where you want the window to be, forming a rectangle
       of points.

    *  Connect these rectangles with lines; a new sector will be
       created. This is your window sector.

    *  Switch to 3D mode. Raise the floor a bit and lower the
       roof of the window sector until the window looks about
       right.

    *  If you want, insert a glass pane in the window sector.
       It'll look especially good if you split the window sector,
       adding the glass in the exact middle of the window sector
       instead of on the edge.

    *  Align the textures. You can auto-align by pointing to the
       left-most wall and pressing [.].

7.7.2  *Notes*

    *  Don't add the glass pane to the very outside of the window
       as the wall texture above it will mess up when the glass
       is shot. Place the glass on its very own line inside the
       window sector.


7.8  *Air ducts*


Air ducts are just flat sprites in front of holes in the wall.
They will break automatically.

7.8.1  *Notes*

    *  Useful sprites are 407 (rotating fan) and 595 (metal
       grate).

    *  Make the duct itself nice and narrow, about as wide as the
       grid at maximum size (1024 units or 256 pixels).

    *  For the duct inside, you can use the textures 342 and 343.
       Use 341 for a hole broken in the duct.

    *  If the above textures are used, the air duct sound is
       created automatically.

    *  If the duct is only visible from one side, make sure the
       sprite is two-sided by pointing at it in 3D mode and
       pressing [1].


7.9  Angled surfaces


To tilt a sector surface (roof or ceiling), point at it and press
the '[' and ']' keys.

7.9.1  Notes

    *  The surfaces will always use the first line of the sector
       as hinge. To set the first line, point at it in 2D mode
       and press Alt-[F].

    *  To undo your changes, press [/].

    *  Use RightShift-'[' or ']' for small changes and
       LeftShift-'[' or ']' for very small changes.


7.10  Secret places


To mark a sector as secret, just tag it [0,32767]. A player will
be credited for finding it as soon as the sector is entered.


7.11  Multiplayer sprites


To make an object appear only in multiplayer (coop or DM) play,
use Alt-P to give it a palette of 1.


7.12  Level-end button


Also called the nukebutton, this sprite (142) is used to end the
level.
Tag it [0,x], where x can be:

32767          End level, go to status screen and then on to the
               next level.

1..11          End level, go to level 1..11
               (eg. [0,10] would take the player to the (secret)
               level 10).

7.12.1  Notes

    *  To get the secret-level color on the nukebutton, set its
       palette to 14.


7.13  Level-end sector


Tag a sector [0,65535] to end the level when a player enters this
sector.


7.14  Cameras


You can place cameras around the map, which will relay an image
to one or more viewscreens.

7.14.1  Setup

The security network consists of three objects:

Channels       A channel transports the video data from the
               camera(s) to the viewscreens. It is just a number.

Cameras        (621) [Mobility,Channel]
               They have to be sprites, and can be placed
               anywhere in a room, facing in any direction. Using
               the hi-tag, you can even set the camera mobility:
               higher numbers allow the camera to move through a
               wider arc.
               Some example numbers:
               0: Immobile
               128: Very jerky (too short) - not recommended
               256: Normal panning

Viewscreens    (502) [Channel,0]
               Viewscreens have to be sprites, too.

7.14.2  *Notes*

    *  The camera shade controls the down-angle: 0 is horizontal,
       -80 is most common, -128 is maximum down.

    *  If several cameras share a channel, the viewscreen
       connected to this channel can cycle through all connected
       camera views.

    *  It is advisable to hide the viewscreen behind a harmless
       forcefield (230), to cause the well-known purple circles
       when it's being shot at.

    *  Mobile cameras shouldn't be flipped, as the animation
       isn't flipped as well.

    *  The angle of the camera should point into the middle of
       the desired panning arc. The arc angle is easily
       calculated: 90 degrees = 512.

    *  Don't place the cameras too close to the walls.


7.15  Demo cameras


Demo cameras can be placed anywhere and will automatically film
duke from the outside when recording a demo. Neat.

7.15.1  Setup

The camera is just an S[ViewDistance,27]. Don't use the sprite
itself.

7.15.2  Notes

A ViewDistance of 7000 works fine.


7.16  *User-controlled force fields*


A user-controlled force field is a standard force field which can
be toggled on and off with a switch.

7.16.1  *Setup*

    *  Build a standard forcefield somewhere (masked wall, tile
       number 663), but don't set the hittable or blocking flags.
       Tag the forcefield line [0,Channel].

    *  Place an S[Channel,12], Palette 2, on each side of the
       force field.

    *  Place a switch anywhere with tags [0,Channel].

7.16.2  *Notes*

You can use a touchplate effector as well to toggle the force
field.


7.17  Blastable walls (user control)


Such walls can be blown up by detonating something close to them
(a pipebomb, RPG, etc).

7.17.1  Setup

    *  First build the wall with the hole already in it (usually
       consisting of several sectors with angled floors and
       ceilings).

    *  In each of these sectors, place an S [Channel,13].
       On the wall to be blasted, place a (possible semi-
       transparent) crack [Channel,0] (546-549), facing the
       player. Fire extinguishers (916) can be used, too.

    *  If you want, place bombs on both sides of the wall for
       realism [Channel,DelayUntilExplosion]. A delay of 8 is
       very short, while 2000 takes ages before it explodes.

7.17.2  Notes

    *  A wall with a crack on each side will blow ok, but the
       other crack will remain hanging in mid-air.

    *  Blastable walls retain no bullet holes until they blow.

    *  Here the first line of a sector is important again - the
       floor and ceiling are moved together until the first wall
       sides touch. So if your wall shows some triangular holes,
       this is where to look: make sure your first walls (set
       with Alt-F4) are the lowest ones.

    *  If you give the crack a palette number of 1, it can only
       be blown in multiplayer games.

    *  It might also be a good idea to create a wall with a
       nicely blasted hole in it and cover it with a solid wall,
       thin as paper. Then blast this thin wall completely away,
       revealing the hole - this is often easier than laborously
       building a hole made up of dozens of sectors, each with
       its own sector effector...

7.17.3  Tips

    *  Use texture 852 (blasted concrete) on the inside of the
       hole.

    *  Carefully align the wall textures. Especially the sideways
       alignment is important, as the wall looks real bad if this
       is not done properly - use the [.] key.


7.18  Blastable walls (triggered)


The work just like user-controlled blastable walls, except that
they can only be blown by program control, not by the user.
They are triggered by a T [0,Channel], and you can even add a
time-delay from the moment T is activated to the explosion of the
wall.

7.18.1  Setup

    *  First build the hole just as outlined above.
       However, you won't need to place a crack.

    *  In just one of the hole sectors, add a D [Delay,Channel].
       Delay ranges from 0 to 255, 255 being longest.

    *  Place at least a bomb [Channel, Delay] in the same sector
       as D. Delay ranges from 8 (blow right away) to over 2000
       (take ages, can be used for nasty traps) with typical
       values being 8,16 or 32.
       For realism, place some of these on both sides of the wall
       as well.

    *  Place a T [0,Channel] in any sector. It will go off as
       soon as the player enters the sector.

7.18.2  Notes

    *  You can blow several walls open simultaneously, but don't
       use different delays - the world shakes, but the holes
       only appear when the highest-numbered D blows.


7.19  Conveyor Belts


Conveyor belts are sectors which will transport any sprite on
them in a certain direction.

7.19.1  Setup

    *  S[0,24] in the conveyor belt sector, facing in the
       direction the belt should move.

    *  Optionally, add a Sp[0,BeltSpeed] to change the belts
       speed.

7.19.2  Notes

    *  You might have to rotate the sectors floor to make it look
       right - I've had a belt going one way and the texture
       scrolling another way...

    *  To create running water, just set the sector tag to [0,1].

    *  Typical conveyor belt tile is (1156).


7.20  *Mirrors*


Mirrors are interesting in that they require a rather large room
behind the mirror (check E1L1 for example). This room must be
able to contain any part of the room visible in the mirror,
otherwise you'll get graphics glitches.

A mirror is in effect a one-sided wall (created by pointing on
the floor in front of a two-sided wall and pressing [1]) with the
texture 560.

Finally, point at it and press [B] and [H] to set the 'block
movement' and 'hittable' flags.

7.20.1  *Notes*

    *  You can make the mirror unbreakable by not setting the
       'block movement' and 'hittable' flags. It will still be
       broken by an explosion close to it, though.

    *  To have Duke say 'Damn I'm looking good' when pressing on
       the mirror, give it a lotag of 252.

    *  Mirrors have a range limit - if they're viewed from too
       far away, they'll default to showing a parallaxed sky
       texture.

    *  If the 'mirror room' is too small, weird graphic glitches
       can occur.

    *  Also, the 'mirror room' has to have the same floor/ceiling
       height as the room being viewed - you'll get glitches when
       jumping/ducking if it isn't.

    *  If you set clipping and walk through the mirror, you:

           -  will die if you leave the mirror room,

           -  get stuck if you deactivate clipping, and

           -  notice graphic glitches underneath the mirror
              (viewed from inside).


7.21  *Garbage cans*


Garbage cans (1232) can spawn something else when shot - just set
its tag to [0,ObjectToSpawn]. You can't spawn every possible
object though (I tried toilets :), but things like shotgun ammo
(49) or, indeed, other cans work well.

7.21.1  Notes

    *  Rubbercans (1062) can't be made to spawn something, they
       always create rats. Although, of course, this can be
       changed in the GAME.CON file (line 204).

    *  A garbage can can spawn a garbage can :)
       This way you can also see that the default sprite size is
       too large: the spawned cans are quite a bit smaller than
       the original ones.


7.22  Revenge of the dancers


When a dancer is shot, you can make an enemy appear. Just set the
dancer sprite to [Channel,0] and place one or more R
[SpriteToAppear,Channel] anywhere.

7.22.1  Notes

    *  You can make lots of things appear, I've even had success
       with burning barrels (1240).

    *  If you try to spawn an invalid object (like another dancer
       or a sign), the respawn spark appears (including the
       sound), but nothing warps in. This might be used to faze
       players.

    *  A dancer can spawn a weapon, preferably in the same place
       as the dancer. This makes it look as if the woman was
       armed (wonder where she hid that Devastator).
       Personally, I don't advise this, though: some people are
       strange enough to play outside Adult Mode and thus never
       see the dancers. Others again (like myself) never shoot
       the dancers (I mean, come on, shooting a woman?).


7.23  Buzzing phones


To have a phone buzz if the player tries to activate it, place a
switch (132) on the phone (967), tag it [174,278] and rotate it
away from the player to make it invisible.


7.24  Light switches


Light switches turn the light in one or more sectors on and off
('on' is the brightness of the S, 'off' is the original light
level).

7.24.1  Setup

    *  Place a switch (eg 164) [0,Channel] sprite anywhere.

    *  The sectors to light up need an S [Channel,12].

7.24.2  Notes

    *  You can use several switches on the same channel, they
       operate simultaneously.

    *  Switches work just fine if used on their own - perhaps
       this could be used by players to communicate?

    *  The hitag of the switch controls the sound the switch
       makes on activation. 0 is the normal 'click', but try the
       others...
7.25  Permanently rotating sector (gears)


You can set up a sector to keep rotating around a midpoint, like
the gears in E1L3.

7.25.1  *Setup*

First, build your sector. If the floor or roof is to be visible,
make sure that you've set the texture alignment to 'relative'
(use [R]) so it rotates with the sector.

You'll need these tags:

S              [Channel,0]
               Defines a rotating sector.

S              [Channel,1]
               Defines the sector rotating axis. The direction
               defines the rotation: up is clockwise, down is
               counterclockwise.

Sp             [0,Speed]
               Default rotation is rather fast, so you might want
               to add an Sp[0,64] for slower movement.

M              [HearingDistance,SoundNumber]
               The distance obviously depends on the size of your
               rotating sector - try 8000. Good SoundNumbers to
               use are 87 (grinding gears) or 89 (machine at
               work).

7.25.2  Notes

    *  The two S must be on top of each other, as the sector will
       behave strangely otherwise. I've had gears rotating around
       an arbitrary midpoint causing a HOM when moving over you.

    *  M is usually placed on the pivot point, too.

    *  A gear will pick you up if it sweeps towards you. To make
       pushing/squashing gears, raise the floor of the rotating
       sector all the way up to the ceiling.


7.26  Doors


Ignoring simple doorways, real doors come in several flavours,
consisting of one or more moving sectors, sector tags and some
controllers.
Note that all controllers must be inside the door sector(s), not
right on the edge (turn off grid locking ond place it real close
to the edge, if necessary).

7.26.1  Standard hinged

A hinged door opens by rotation 90 degrees sideways.
The door sector [0,23] contains three special sprites:

S              [Channel,11]
               The location of the sector effector defines the
               rotation axis, the direction the rotation
               direction:
               up
               counterclockwise turn
               down
               clockwise turn

Sp             [0,Speed]
               Speed ranges from 8 (very slow) to over 1000 (real
               fast). ## I think you can leave this away for a
               default speed, but I'm not sure about this.

M              [Sound2,Sound1]
               Sound1 is the sound number to play when the door
               is opened, Sound2 when it's closed. Usually, these
               sounds will be the same.

7.26.1.1  Notes

    *  Take care to set the ceiling texture to 'not relative'
       using [R], otherwise it'll rotate with the door.

    *  Make sure that the door doesn't rotate out of its original
       sector (for example, into a room with a higher ceiling) as
       the graphics will mess up. Thus the sector containing the
       door sector has to be large enough.

    *  You can open/close several doors simultaneously (building
       double doors, for example) by allocating each door the
       same channel.

    *  Do not attatch any part of the door to any other sector,
       the whole thing will twist (creating interesting effects,
       btw).

    *  Turn off grid locking [L] to position the S as close as
       possible to the edge of the door.

7.26.2  DOOM-type door, remote control

A DOOM-type door is actually a thin sector of its own. It closes
by lowering its ceiling down onto the floor.
This door opens by remote control (a switch) by raising the
ceiling from the floor, delays a moment, and lowers the ceiling
onto the floor again, closing the passageway.

7.26.2.1  Setup

    *  Switches (132) [0,Channel] can be placed anywhere. Must be
       sprites.

    *  The door sector [0,20] contains 4 controllers:
       M  [ClosedSound,MovingSound] (eg 0,167)
       Sp [0,Speed] (eg 0,88)
       S  [OpenDelayTime,Channel]
       A  [0,Channel]

7.26.2.2  *Notes*

    *  Switches can be hidden by letting the sprites face the
       wall and adding another sprite facing the player on top of
       it (as done in the toilet of E1L2 with the blowdryer).

    *  If the door is half-open at game start, it will close
       automatically.

    *  Don't make OpenDelayTime (the time to wait after closing
       the door again) too short! A door with a value of 128 will
       close real quick. If the time passes before the door has
       fully opened, it will malfunction (could be used by
       design, though).

    *  Make sure the orientation of the door texture is set right
       (use [O]) as the door will otherwise appear to grow
       instead or rising properly.

7.26.3  DOOM-type door, local control

These work in the exact same way as the remote-controlled
version, but you don't need a switch to open them - just press on
the door itself.

Simply build the door as above, leaving the S and A controllers
out.

7.26.4  Sliding sideways

While most doors simply move the floor or ceiling (aka DOOM-type
doors) or moving/rotating a sector, the sliding door is made up
of one-sided walls which are shrunk by a sector wrapped around
them.
A perfect example can be found in E1L3, just to the right of your
starting point.

Since I found that I'm no good at explaining this in words, allow
me to use some cheapo ASCII graphics to guide you through a
step-by-step design :)

We have a doorway where we want to insert a sliding door. It
shall slide into the left wall:

---------------*................*-----------------
               |                |
               |                |    Key: * Point
               |                |         . 2-sided wall
               |                |         | 1-sided wall
               |                |
               |                |
               |                |
---------------*................*-----------------

We start by adding a sector inside the doorway sector:

---------------*................*-----------------
               |                |
               *...............*|
               |               .|
               |               .|
               |               .|
               *...............*|
               |                |
---------------*................*-----------------

Note that the new sector goes nearly all the way across. I
usually try to avoid overlaying unrelated lines, as they can
cause ugly graphics glitches.
Give the new sector a tag of [0,25].

Next we simply extend the inner part of the left wall across,
forming the door itself:
---------------*................*-----------------
               |                |
            P1 *...............*|
            P2 *-------------\ .|
                              *.|
            P3 *-------------/ .|
            P4 *...............*|
               |                |
---------------*................*-----------------

The door has a triangular endpoint, you'll see why as we shift
points 2 and 3 (marked as P2 and P3 above) onto the points 1 and
4 (marked as P1 and P4 in the sketch):

---------------*................*-----------------
               | L1             |
         P1/P2 *------------ ..*|
                             \ .|
                              *.|
                             / .|
         P3/P4 *------------...*|
               | L2             |
---------------*................*-----------------

And here's why it's triangular: so we still see a bit of the
sector below; we now insert some sector effectors into it:

    *  S[Channel,15]

    *  M[DoneSound,MovingSound]

    *  Sp[0,DistanceToOpen]

If you open the door now, the lines L1 and L2 (on the left) will
twist backwards. To avoid this, move P1/P2 and P3/P4 a bit to the
left, insert a point in L1 and L2 and move this point down (or in
P2s case, up) onto the line so you get this:

---------------*................*-----------------
               | L1             |
      P1/P2 *--*------------ ..*|
                             \ .|
                              *.|
                             / .|
      P3/P4 *--*------------...*|
               | L2             |
---------------*................*-----------------

Voila! Press against the door to open it.

Sorry about the ugly sketches, but the above is a lot easier to
understand than the gamboozle that was here in v0.4 of the FAQ :)

7.26.4.1  Notes

    *  A typical sliding door texture is 447.

    *  Changing the heading of the sector effector produces
       interesting (and usually, buggy) results.

7.26.5  Star Trek door

This door slides sideways, compressing its texture as it does so.
The door is activated by pressing against it.
7.26.5.1  *Setup*

This door is very similar to the sliding door.
Let's assume your doorway goes from north to south and the star
trek door thus slides east/west:

* Create the sector containing the doorway.

* Using horizontal lines, split this sector into three sectors.

* Extend the doorway sectors walls into the middle sector of the
doorway, forming the doors themselves. Let the doors (almost)
meet in the middle.

* Now tag the middle sector: [0,9]

* Add two sprites to the middle sector:
     M[0,Sound] (eg. [0,259])
     Sp[0,OpeningSpeed] (eg. [0,64])

And that's all!

7.26.5.2  Notes

    *  If you extend the middle sector straight to the east and
       west (like the sliding door), the door texture will be
       longer although part of it will be hidden. This will make
       sure that you can hardly see the compressing effect while
       the door opens.

    *  The door sound is played twice (bug). Thus my Star trek
       doors are always totally silent.

7.26.6  Four-way door

These doors open in both directions (up/down and left/right) at
the same time when activated.

Simply build a star trek as above, but let the floor and ceiling
of the middle sector meet in the middle and give the middle
sector a tag of [0,26].

These doors look very nice indeed :)

7.26.6.1  Notes

    *  It is possible to get these doors to misbehave: try
       triggering a low, long door again while it is already
       opening. The roof will start to close again while the
       walls are still opening.
       Now the door will be difficult to navigate: as the roof
       opens, the walls close and vise versa.
       Of course, this can be fixed by triggering the door again
       in quick succession, but it interesting to know.

    *  The above bug can be used for special doors - simply
       design the walls to be open at the start, and the door
       will react as above.
       You can get through it if you run, though.

7.26.7  Clamshell doors

Clamshell doors split horizontally when opening - the top half
disappears into the ceiling, the bottom half into the floor.
Just build a DOOM-style door, but tag the door sector [0,22] and
make sure the floor and ceiling meet in the middle.

7.26.8  Teeth doors

## I've found some info on building teeth doors, but I didn't get
them to work. The BUILD docs say that teeth doors weren't tested
in the game and might make trouble in multi-play.

7.26.9  Auto-closing doors

Simply add an S[DelayTime,10] in the door to auto-close.

7.26.10  Switch-controlled doors

Every door can be opened via a switch as well:

Simply add a switch somewhere and tag it [ActivationSound,
Channel].

Inside the door, place two effectors:
S  [OpenDelayTime,Channel]
A  [0,Channel]

7.26.10.1  *Notes*

You can also use sector tags (T[0,Channel]) to open a door when
the player enters a sector.


7.27  Shrinking sector (remote control)


This will shrink a sector (for example a curtain) on the flick of
a switch. Pressing the switch again will regrow the sector.

7.27.1  Setup

    *  Place one or more switches anywhere
       [ActivationSound,Channel].

    *  Inside the sector to shrink [0,27], place three
       controllers:
       S  [Channel,20] facing the movement direction.
       A  [0,Channel]
       Sp [0,OpeningDistance]

7.27.2  Notes

    *  Don't open the sector too wide - it will move through the
       wall, creating ugly HOM effects.

    *  Have a look at the floor if a hanging sector moves - it
       looks strange. Use [R] to get rid of the effect.


7.28  *Spawning monsters*


You can have monsters appear anywhere when the player walks onto
a certain sector.

7.28.1  *Setup*

    *  Place a T[0,Channel] in the activating sector.

    *  Place one or more R[TileToSpawn,Channel] anywhere.

7.28.2  *Notes*

    *  The pig cop has TileToSpawn of 2000.

    *  I don't know what T's hitag means. Perhaps the delay time?
       ##

    *  You can also use a switch with a tag of [0,Channel] to
       spawn monsters.

    *  You can spawn other things than just monsters (like
       weapons or medipacks).


7.29  *Difficulty settings*


To have an object or monster only appear in a certain difficulty
level, just give it a lo-tag:

Lotag     Appears in difficulty level
0         1,2,3,4
1         1,2,3,4
2         2,3,4
3         3,4
4         4


7.30  Automatic cannon


An automatic cannon will fire an object every 5 seconds in a
certain direction as soon as it's been activated by a
masterswitch.

7.30.1  Setup

Place an S with [0,36], marking the shot spawn shot. Aim it
whereever you please.

Add an Sp[0,ObjectNumber] in the same sector. ObjectNumber is the
tile number of the object to fire from S.

Add a D[0,TriggerChannel] in the same sector. You can hook, for
example, a T[0,TriggerChannel] anywhere to start the gun up.

7.30.2  Notes

    *  I've found the following objects to be possible ammo:

       1360          Psionic blast.
                     Aimed slightly down, and has a limited
                     range.

       1625          Laser.

       1636          Spit.

                     Aimed slightly down, and has a very limited
                     range. Makes no noise at all.

       1641          Freeze blast.
                     Always aimed at player, but has no effect on
                     him. Looks cool, though :)

       1650          Mortar.
                     The mortar ball drops down at a steep angle
                     and explodes on impact.

       2556          Shrink ray.

       2605          RPG.
                     Will always aim at player, regardless of aim
                     or LOS.


7.31  Lethal sectors


To make a sector instantly lethal to the player (even in God
mode), parallax BIGORBIT as the ceiling.


7.32  Earthquakes


Earthquakes have three effects:

    *  The screen shakes for about 4 seconds and the earthquake
       sound is played.

    *  Sectors can tilt.

    *  All SE[0,33] on the whole map spawn rocks and debris.

7.32.1  Setup

Place an S[0,2] on every sector to tilt.
Place an D[0,TriggerChannel] in the same sector.
If you want, place S[0,33] anywhere on the map.

Earthquakes have to be triggered, for example with a
T[0,TriggerChannel] anywhere.

7.32.2  Notes

    *  To tilt sectors, they have to be tilted on the map by a
       maximum of 4 clicks (you can tilt more, but it won't have
       any effect). Such sectors are shown flat at startup.

    *  You can put S[0,33] anywhere - they are triggered by any
       earthquake on the map. Try putting them slightly under the
       floor, or high in the air for special effects.

    *  The build docs claim that a sector will move in the S[0,2]
       direction during an earthquake, but I've never seen that.

7.33  Elevators


Elevators come in two kinds: those where just the floor moves
(open elevator) and those where the ceiling moves as well (closed
elevator).

Both rely totally on sector tags: except for the sound, no
controllers are used.

7.33.1  Setup

An elevator is simply a sector that moves from the nearest low
floor to the nearest high floor. Thus the only important thing
really is setting the floor heights of the adjacent sectors
properly.

Tag the sector according to the desired elevator type:

[0,16]         Open elevator

[0,18]         Closed elevator

7.33.2  Notes

    *  You can set an elevator at the top or the bottom to start
       with, it doesn't make a difference. You can even set it at
       half-way.

    *  Elevators must be the right size. If the elevator seems to
       go on forever, the ceiling of the first room is too high -
       try fiddling with this or pressing [SpaceBar] in the game
       to reverse the elevators direction.

    *  There are two more sector tags available to elevators:
       [0,17] (open elevator) and [0,19] (closed elevator).
       They're supposed to control the starting position of the
       elevator, but _you_ do that already simply by placing the
       elevator at the desired starting height.
       ## Anybody know what's going on?


7.34  Remote-controlled Elevators


Remote-controlled elevators are just like ordinary elevators,
except that they're operated via a switch somewhere (or several
switches, of course).

7.34.1  Setup

To turn an ordinary elevator into a remote-controlled one, just
add an A[Channel,0] in the elevator sector and place switches
tagged [Channel,0] anywhere.


7.35  Teleporters


Teleporters move players instantly between any two points.

7.35.1  Setup

Teleporters are not sectors, just sector effectors. They do need
the floor tile 626, though.
S [Channel,7], facing is the same the arriving player should
face.

7.35.2  Notes

    *  A teleporter without a floor tile 626 only act as
       receivers.

    *  A single teleporter without a destination will kill the
       player.

    *  If the S is off the ground, the teleporter is silent -
       useful for transporting players around the map without
       telling them about it (see E1L1, falling down the airduct,
       as an example).

    *  When using more than two teleporters on the same channel,
       you always land on the teleporter with the lowest sprite
       number. If teleporting from the lowest sprite number, you
       end up on the next-highest one.

    *  Teleporters don't work if you fly over them.

    *  Don't create a teleport sector with two of the walls being
       masked, blocked and hitable. It messes up.

    *  ## I've had strange effects when firing rockets into two
       teleporters set up in a line - the rocket reappeared
       _behind_ me, angled slightly to the right (thankfully :)
       Any ideas?


7.36  Swimming pools


Swimming pools allow the player to jump into the water and dive
around under the water surface.

7.36.1  Setup

A swimming pools consists of at least two sectors: one is the
room above the water, one is the room below it. An teleporter
secretly moves the player (and any other objects, like pipebombs)
between the levels as required.
The sectors sharing the water surface have to be the exact same
size and shape (of course).
The teleporter connecting them needs a unique channel number.

Above-water sector
               [0,1]
               S [Channel,7]

Below-water sector
               [0,2]
               S [Channel,7]

7.36.2  *Notes*

    *  The floor/ceiling types for the water surface don't matter
       - all objects will always be transported correctly, water
       will splash, etc.
       This allows you to generate hidden traps, mud, etc.

    *  If you split a pool into several sectors (for example in
       order to create a pool with a shallow and a deep end), you
       have to split the above-water sector as well and add a
       sector effector in each new sector, each with it's own
       channel.

    *  Interesting things happen if the S is not exactly on the
       floor (use [Ctrl]-[PgDn]).

    *  The S above and below the water must be in the exact same
       relative position and face in the same direction.

    *  Don't place a toilet underwater. While Duke can use it, he
       won't be able to surface anymore afterwards (bug).

    *  Beware of sloping pool floors. The SE has to be on the
       lowest point, and I don't know how stable it works.

7.36.3  Tips

    *  Nothing to stop you from adding sector to the below-water
       sector, forming an underwater tunnel leading somewhere
       else; perhaps even surfacing in a different pool.


7.37  The Grapplers


Grapplers are hooks descending from the ceiling which will pick
up objects (including players), transport them somewhere else and
drop them off again.

7.37.1  Setup

    *  Add a crane pole [Channel,0] (1221) at the place where
       something is to be picked off. Place it in its own sector,
       as the crane will pick up anything that moves into this
       sector.

    *  Place the crane itself [Channel,0] (1222) at the
       destination point.

7.37.2  Tips

    *  Grapplers don't pick up everything - I'm still fiddling
       around to try what is actually transported. Players are,
       as are monster corpses.

    *  As the crane move across the ciling, it's a good idea to
       place some kind of raised texture there (353 works well).


7.38  Overlapping sectors


While DOOM was 2.5D because of its strictly 2D map, Duke3D is
2.75D: while the data structure allows you to design several
sectors over each other, the graphic engine can't display more
than one ceiling and one floor over each other at a time.

This means you can't:

    *  Build a real bridge.

    *  Build two windows over each other.

    *  Build a house missing a wall, showing several floors over
       each other.

However, you can:

    *  Build a house where you can actually walk on the roof (as
       long as the house doesn't have windows).

    *  Build corridors crossing over and under each other.

    *  Build a house with two stories above each other, as long
       as the windows are on opposite sides of the house (and
       facing into different sectors).

Building overlapping sector is easy: Just draw the first sector,
move floor and ceiling where you want them, then draw another
sector overlapping the first one. Try it!

7.38.1  Notes

    *  Two overlapping sectors cannot share a double-sided wall,
       but you can connect them with a separate sector (for
       example, a sloping tunnel or an elevator).

    *  Don't use overlapping sectors unless you have to! Editing
       them is very little fun indeed, as the 2D editor has
       trouble differentating between the sectors and it's hard
       joining sectors, etc.

    *  Note that you can build real 3D floors (walkable above and
       below) by using sprites rotated flat as floor (set the
       'blocking' flag). It's hard work, though - see the section
       on bridges.

    *  Be careful when building overlapping sectors - monsters
       can get confused if there's somebody else in the
       overlapping room, and the sound will come from there as
       well. Use it sparingly.


7.39  Hiding switches


To hide a switch, simply turn its facing towards the wall.

It is advisable to place a different sprite facing the player
over it, so he knows where to press (unless you _really_ want to
hide it).


7.40  Bridges and Shelves


We actually cheat a bit in order to build a bridge: it's made up
of sprites!
Take the sprite, rotate it flat to the floor, mark it as 'blocks
movement' and then raise it into the air - you'll be able to walk
on and underneath it.

So far, I have found two typical bridge sprites, but any sprite
will work:

513            Stone bridge, as found in E1L1.

609            Metal bridge with holes in it, found in E1L6.

7.40.1  *Notes*

    *  Building a solid-looking bridge (one having width)
       actually takes some time, as you have to mess around with
       the side and bottom walls too (they're also sprites, of
       course) which can take ages.

    *  It's possible to make a bridge droppable (try using a
       pipebomb on the bridge in E1L1) by tagging the sprites
       [Channel,0].
       Bridges with the same channel with collapse
       simultaneously. I've tried channels 254 and 255 with good
       results.

    *  Keep in mind that the visible overlapping of sprites is
       calculated by looking at the sprite center. Thus if you
       place several small sprites (bottles) on a single large
       sprite (a wooden board), the board will overlap some
       bottles when viewed diagonally.
       Thus you should build larger objects of several small
       sprites.

    *  Especially bridges often suffer from the above problem.
       One way to (partly) fix this is to make all the sprites
       single-sided, with the sprites only visible from outside
       (press [1] and use [F],[<] and [>] to rotate them until it
       looks right).

    *  It's perfectly possible to create a multilevel building
       out of nothing but sprites. It's a hell of a job, however.


7.41  Minibosses


In episodes two and three, the boss from episode one makes a
comeback, but in a 'light' version: he's smaller, more easily
killed and the level doesn't end when he's dead.

To create such a boss, just give him (2630) the palette number
21.

7.41.1  *Notes*

    *  To spawn minibosses, set the palete of the respawn
       effector to 21.

    *  No other minibosses are defined in the .CON files, thus
       this trick works poorly on the other two bosses: they die
       after taking a single hit.

7.42  *Crashing car/helicopter*


These are easy: just place their sprite (car is 2491, helicopter
is 1386) anywhere high enough, point them in the direction you
want them to go and that's all.

7.42.1  *Notes*

Make sure the sprites have enough space to fly all the way before
they (automatically) crash: if they hit a wall first, they will
slide down it.


7.43  Pulsing lights


Pulsing lights are made up of several sectors which light up in
sequence, causing a 'running light' effect. This can be used
nicely to point a player towards an emergency exit, for example.

7.43.1  Setup

You'll need several sectors in a line. Each of these sectors
should contain a C[0,LightTime] and an Sp[0,LightSpeed].

The sectors themselves should be dark and the C's light.

LightTime is the sequence in which the sectors light up (higher
ones first). A typical sequence would be 0,256,512,768,1024,...
This also controls how many sectors are lit at the same time.
With a difference of 200, the light pulse is about 4 sectors
long. With 400, it's 2 sectors (not as smooth).

LightSpeed is the speed at which the light pulse travels along
the sectors.

7.43.2  Notes

    *  Nowhere is it written that the sectors have to be in a
       straight line or, indeed, any line at all.

    *  The C and Sp effectors have to face in the same direction
       or they won't work.


7.44  Vehicles


Vehicles (simply a sector with a raised floor, a lowered roof or
both) can be set up to travel from their original position to a
pre-determined closed path, which they will follow.

7.44.1  *Setup*

    *  The vehicle sector requires an S
       [LocatorNumberToStartAt,6]. The position of this
       controller determines the rotation center when turning,
       and its direction the facing of the vehicle.
       LocatorNumberToStartAt is usually 0 if you have only one
       vehicle on the route.

    *  All vehicle sectors need to be tagged [0,1].

    *  Mark the route with several L+ [Pause,VisitingOrder].
       A Pause of 0 means smooth movement, a 1 means a short
       pause at the _next_ L+.
       The controllers are visited in their VisitingOrder,
       starting from 0.

    *  Use [R] on the vehicles floor texture to make it move with
       the vehicle.

7.44.2  *Notes*

    *  The vehicle must start in the same sector as its route, as
       the game will refuse to run otherwise. Thus you can't, for
       example, cause a car to come out of a low garage and
       circle around outside afterwards.

    *  You can have several vehicles following the same route.

    *  You can also design a vehicle using several sectors, but
       they will rotate individually at each L+. Rather use a
       'bounding' sector, containing the S - see the attacking
       spaceship in E2L1 for an example.

    *  The whole route must be in one sector - you cannot move a
       vehicle through several sectors.

    *  You can only have one route defined per map.

    *  To have sprites move with the vehicle, they must be in the
       same sector as the S[0,6].

    *  Vehicles can't move up or down slopes.


7.45  Attacking Vehicles


To make a vehicle attack any visible player with rockets (like
the space fighter at the start of E2L1), just parallax the
ceiling of the vehicle.

7.45.1  Notes

    *  To have a vehicle move about under an parallaxed sky
       without shooting at you, give the sky or the floor a
       palette (any palette except 0 will do). Palette number 3
       works well.


7.46  Two-way Vehicles


A two way vehicle moves back and forth between two points when
activated (for example, with a key).

7.46.1  Setup

    *  The vehicle needs a tag of [0,31], an S[Channel,30] and an
       A[0,Channel].
       S points in the direction of vehicle movement.

    *  Two locaters L+[0,0] and L[0,1] need to be placed to mark
       the stopping points of the vehicle. L[0,1] is the locator
       visited first by the vehicle.
    *  Place one or more switches [0,Channel] anywhere, including
       on the vehicle.

7.46.2  *Notes*

    *  The vehicle moves off in the direction of its S. If it
       doesn't find an L+, it will keep moving forever, passing
       straight through any walls on the way out.

    *  Vehicles don't have to start near an L+, they will move
       there on their own.

    *  On both locators, channels are triggered which can be used
       to automatically open dors, switch on lights, etc. The
       channels are Channel+1 for the L+[0,1] and Channel+2 for
       the L+[0,0].
       Thus if you used channel 6 for a two-way train, channel 7
       would be triggered when the train reaches the first stop.


7.47  *Echoing rooms*


To make a room echo (as in a sewer, for example), simply tag the
room sector [1000+AmountOfEcho,SoundDistance].

AmountOfEcho ranges from 0 to 255.


7.48  Water waves


It's possible to have the floor of a sector move up and down.
Several of these sectors in series can give the effect of a
travelling water wave.

7.48.1  Setup

A wave sector actually changes its floor tilt value.
Thus, simply define several 4-walled sector in a row, adding a
single S [WaveShape,29] in each.

You can add an Sp[0,WaveHeight] in the sector as well.

7.48.2  Notes

    *  Wave sectors must be four-sided.

    *  The floor tilts along the first line of each sector, so
       make sure you've set it properly (use [Alt]-[F]).

    *  WaveShape/WaveHeight range from 0 to 2048.

    *  If you tag the wave sectors [0,2], you'll be able to swim
       underneath the water (see Swimming Pools for details).
       Duke won't be able to stay afloat if the wave is too high,
       though.


7.49  Engine piston


In designing machines, you often want a piston moving up and
down, squashing anything wandering underneath.
7.49.1  Setup

Simply add an S [0,25] in the sector.

7.49.2  Notes

    *  This effector moves the ceiling down to the height of the
       S and back up.

    *  You can add an Sp or M to taste.


7.50  *Edge walls*


The edge of the playing map in an outdoors setting is always a
problem - how to avoid simply using a very tall building and
instead closing off with an (impassable) low wall?

7.50.1  Setup

    *  Build a low wall around your world.
       Use any texture you like.

    *  Set the ceiling texture of the wall to the same as your
       main ceiling.
       Usually, this will be 89 (LA).

    *  Parallax it.
       If your main ceiling is already parallaxed, the upper part
       of the wall will disappear.

    *  Lower the ceiling of the low wall to its floor.


7.51  Code switches


Code switches are buttons which have to be pressed in a certain
way before activating something. An example is the 3-way dip
switch used to unlock the red gate in E1L2.

7.51.1  Setup

Set up the switches anywhere, tagging them [Status,Channel].

Status         is the required state for activation: 0 (off) or 1
               (on).

Channel        is the same for all code switches belonging
               together, and is used as the lo-tag of the A or L
               tags activating whatever is supposed to happen.

7.51.2  Notes

    *  Personally, I find these boring. I just cycle through them
       in order and the door or whatever opens real quick.

    *  You can place the switches all over the level, if you
       like. Not a nice thing to do :)

7.52  The pool table


Everybody (myself included) was very impressed with the pool
table in E1L2. It's easy to make your own, and perhaps you can
use this to design other toys.
Reading this, I also realize why 3DRealms didn't answer our
request for a reset button :)

7.52.1  Setup

The table itself is just a table with a raised wall around it.
The trick is in the sprites used: just add balls (901 and 902)
and (flat) pockets (903).

7.52.2  Notes

    *  The balls will move nicely when pushed. They will remain
       at the same height, floating through the air if necessary.

    *  Use different palettes on the balls to create different
       colors.


7.53  Once-only sound effects


Often, you'll want a sound effect to be played only once when a
player enters a sector. An example is Duke talking at the
beginning of E1L1.

7.53.0.1  Setup

Give the sector a lotag of 10000+SoundNumber.


7.54  Ambience sounds


Simply place an M[Range,SoundsFrom] anywhere. Every now and then,
an ambience sound will be played.

SoundsFrom is the number of the lowest sound to play, Range is
the number of sounds to look at for random selection of the sound
to play.

For example: M[231,3] would randomly select a sound from the
sound numbers 231,232,233,234.

Sadly, not all sounds can be used as ambience sounds (see the
list in the reference section).


7.55  Tips and tricks: New and interesting effects


It is often the case that users find new and interesting effects
for sector functions that the designers never thought of. If
anybody finds something like that, please let me know and I'll
put it here.

7.55.1  Ghosts

You can make enemies transparent or even rotated (2D or messed-up
flat things). They'll still attack normally.
Transparent enemies are particularily effective in dark places.

7.55.2  Unfreezable monsters

If you give a monster a palette of 1 (blue), it can't be frozen.

7.55.3  Falling to your death?

Scaring the player is high on anybodies list for levels.
So let the player fall down a deep shaft (aaaaarrrggh) with a
teleporter hanging in the air at the bottom, transporting him
somewhere else (causing a safe landing).

7.55.4  *Malfunctioning doors*

Doors malfunction if the closing time is too short (see the
section on doors). This can cause a nice paranoia effect when the
door keeps opening and closing all the time.

7.55.5  Mines

It's possible to take a trip mine, shrink it real small and put
it in it's very own sector somewhere on the floor. Done properly,
you can create a proximity mine which can only be seen if the
player is paying attention >:)

7.55.6  The shrinking player

Called the Alice In Wonderland effect, this requires you to take
a long hallway and gradually make everything bigger - the floor
gets wider, the walls higher, the sprites bigger...
The opposite works as well, of course.

Problems:

    *  Enemies can't be resized (they're animated).

    *  The map will show it all.

7.55.7  Even more textures

Remember to only add your own graphics into your maps if you
really have to - they make your final package large and unwieldy
and, after all, Duke3D already contains LOTS of textures.
You can also cleverly resuse old textures by resizing them - if
you elongate a texure until it breaks into streaks and then make
the streaks wider, you get a nice metallic effect.