06 September 2024

 TRNG / NGLE and TombEditor SCRIPTING Tutorials

ELEVATORS
- intermediate/advanced -


--- External Keypad ---

Let's say we want a modern-day elevator, which can be operated by a keypad from outside of the elevator. You simply type into the keypad the number of the desired floor, and the elevator will raise or lower to that floor. The setup of the two-block platform is the same as for simple elevators, and the only difference is the switch(es) we use for operating the elevator.

For this kind of an elevator, we need a keypad, and it has to occupy Switch Type 1 slot. The OCB number for this switch item is very important here. We should add 26384 to the number of floors and type the result on the OCB code line of the switch object (keypad). You can place one such keypad, or several keypads outside of the elevator, wherever in the level you want. You place a Switch trigger for each of the keypads, and then you place ActionNG trigger A28 on the same square, as shown in the image below:



--- Internal Keypad ---

Now, we can make our elevator even "more modern-day" than this! We can operate the elevator from the outside with the aid of external keypads, but now we will also add a keypad to operate the elevator from inside the elevator!

For the internal keypad, we need a "dummy" keypad, or "dummy" switch. In other words, this object must occupy an "Animating" slot, and to play safe, use one of the first five Animating slots in your WAD. You can even import the keypad from Switch_type1 slot onto an Animating slot, and use it as the internal keypad for your elevator. It will work like the real thing, with correct scripting! And it's easier to done than to explain!

So, you place this Animating keypad inside the elevator, at a correct elevation from the elevator floor (from the two-block platform in the room). Note the ID number of this Animating object (keypad) and go to the Scripter.

Now you must replace the first IGNORE with an adequate Elevator feature. In this case, we have an "inner keypad". So, the ID of the TBP is 84. The number of floors is 4. The distance between the floors is 8. The Script line looks like this:

Elevator= 84, 8, 4, EF_INNER_KEYPAD, ... // the Script line is unfinished for now.

Since our elevator doesn't have an inner door, we will write IGNORE after this, and then we'll write the ID number of the Animating object that works like the inner keypad. Let's say the ID of this object is 85. The Elevator command in the Script is like this:

Elevator= 84, 8, 4, EF_INNER_KEYPAD, IGNORE, 85 ... // the Script line is unfinished for now.

Now we must specify the elevator speed, as with normal simple elevators, in our case 16:

Elevator= 84, 8, 4, EF_INNER_KEYPAD, IGNORE, 85, 16 ...

After the Elevator speed, we add the ID numbers of all other animated objects which will be dragged along with the elevator, such as bridge_flat objects, or support structure, or any other object, as long as all these objects are placed on an animated slot in your WAD.


--- Elevators with doors ---

Elevators can be placed in a concrete shaft, for example, and for such elevators, you probably don't need an elevator door. You can also make an "open" elevator, as I did in my BtB2024 level "Challenge of the Highpriest", where you also don't need an elevator door. But you can also make an elevator that has e.g. transparent glass walls, and a door that moves along with the elevator. This door will open when the elevator stops, and close as soon as you sent the elevator to any floor. Of course, this object must be placed onto a Door Type slot in your WAD, and to play safe, place it on the first or second Door Type slot. 

The door can have one wing (standard door that opens from left to right), or two wings (as double doors). Also, you can make a sliding door for the elevator, if you want. Simply place the door on the TBP and rotate it correctly where you want. Note the ID number of this Door Type object. Let's say it's number 86. Go to the Scripter, and add the correct Elevator feature to the Elevator command, like this:

Elevator= 84, 8, 4, EF_INNER_KEYPAD+EF_SINGLE_DOOR, 86, 85, 16 ... // the list of other animated items

So, we added "+EF_SINGLE_DOOR" to the Elevator Features line, where we defined the internal keypad. Instead of the "IGNORE", we wrote the ID number of the Door Type item in the Editor. Then the number of the internal keypad follows, then the speed of the elevator, and then the list of other animated objects that are dragged along with the elevator.

Of course, if you made a double door for your elevator, instead of EF_SINGLE_DOOR feature, you'll type EF_DOUBLE_DOOR feature to your Elevator command in the script.

REMEMBER: Where you place the TBP in your room, that's Floor 1. You can lower the floor beneath the TBP and create a "basement", but the elevation of the physical TBP in the room is always Floor 1. Also, make sure to refer to the Elevator tutorial for the Beginners on this Blog, for other details (sounds, etc.).

Happy building!

No comments:

Post a Comment