Object - Auto Turret



This tutorial is designed to show how create an auto turret. It is best that you have section 4 of the ADVANCED.TXT handy while going over this turtorial. To view this map in Shadow Warrior download turret.zip (Updated 24 March 1998).




Fig 1. Main Auto Turret (object) sector.

1. First, create the sector that you plan to place your turret sector in. Next, create the outer most part of the turret (object) sector. This I call the object sector, or main object sector. Before you create any sectors within the main object sector it is a good habit to tag it first. Our turret (in this case) will pivot around the center of this sector. Tag the sector object first by placing the cursor inside it (2D mode) and pressing T (sector LoTag). Enter the value of 501 (our first sector object). Next, press H (sector HiTag) and enter 96 for the auto turret value. Finally, we need to tag the wall loop (section 4.1.1) with a LoTag of 504. Make sure that you place the cursor on the outside of the wall (see fig. 1). Note: any wall of the object sector will work, but tag only one wall.


Fig 2. 2D mode view.

2. Once you have created the inner sectors for appearance (as shown in figs. 2 and 3) we can insert the gun barrel sprite (purple sprite). Note: make sure that you give the top (floor textures) of the turret a Flag value of 48 (4a for sloped). This is done by placing the cursor on them and pressing the E and R keys in 3D mode. Use picnum 764 and a Flag value of 141 for the gun barrel sprite. We need to insert four key ST1 sprites into the main turret object sector (the one that we tagged in step 1 above), not in the inner sectors. If you place these ST1 sprites in a non-tagged inner sector the sprite(s) will have no effect. Give the first ST1 spirte a HiTag of 81 (SO_AUTO_TURRET) and point the angle towards the front of the sector object (towards the right, or east in out case). Give the second ST1 sprite a HiTag of 16 (SO_ANGLE) and point the angle towards the front. The third ST1 sprite is given a HiTag of 76 (SO_MAX_DAMAGE) and a LoTag value for it's health (I gave it 150). Also, set TAG3 and TAG5 to 0 (zero), and point the angle towards the front. This sprite is for the amount of damage it can take (150 in our case) from an exploding type weapon before it breaks down. We will add a spawn sprite shortly to show that it is broken. The forth ST1 sprite HiTag 68 (SO_LIMIT_TURN) tells the sector object how far it is aloud to pivot around the tagged center of the main object sector. The is controled by the LoTag which I gave a value of 128. Which is 22.5 degrees in either direction from the center point for a total of 45 degrees total. As with the others, point the angle towards the front.


Fig 3. 3D mode view.

3. Insert a ST1 sprite at the very end of the gun barrel sprite, and give it a HiTag of 62 (SHOOT_POINT). Point the angle towards the front, and give TAG3, TAG5, TAG6, and BOOL1 a value of 0 (zero). TAG3 = 0 is for a tank shell, and can be given another value if you want to (see HiTag 62 in the SPRITAGS.TXT file). Place a ST1 sprite where you want the smoke to appear on the turret when it becomes broken. It must be within the main object sector, but can be in one of the inner sectors. Give it a HiTag of 69 (SPAWN_SPOT) and a LoTag of your next available match tag value (press F5 in 2D mode for this info). I used 1 in our case cause it is the first match tag value for this map. Give TAG3 and TAG6 a value of 3 (for smoke to appear), and you can point the angle towards the front. As shown in fig. 2a, Insert another ST1 sprite for a SOUND_SPOT (HiTag 134) somewhere close to the turret object sector. Give it the same match tag that you gave to the SPAWN_SPOT sprite (1 in our case). Now, give TAG4 a value of 276 (hissing sound) and BOOL2 a value of 1.

4. Finally, we need to insert two more ST1 sprites to create what is known as the Bounding Box (section 4.1.2 of the ADVANCED.TXT). This is an "imaginary rectangle" that must be large enough to contain the entire outer wall loop plus the sprites that will move with the sector object (the gun barrel and SHOOT_POINT sprites in our case). The first ST1 sprite is given a HiTag of 500 (BOUND_SO_UPPER) since it is our first sector object on the map. It is placed to the upper left of the sector object. The second ST1 sprite is given a HiTag of 501 (BOUND_SO_LOWER). You will note that this is and MUST be the same value of the LoTag given to the main object sector in step 1 above. This sprite is placed to the lower right of the sector object. Remember, this imaginary rectangle must contain the entire outer wall loop PLUS the gun barrel and SHOOT_POINT sprites.




Back to my Shadow Warrior site.