Showing posts with label NGLE/TombEditor SCRIPTING. Show all posts
Showing posts with label NGLE/TombEditor SCRIPTING. Show all posts

20 September 2024

 

TRNG / NGLE and TombEditor SCRIPTING Tutorials

ELEVATORS
- for beginners -

In my debut level "BtB2024 Challenge of the Highpriest" I had freedom to use any and every Script command at my disposal. And based on the reviews I received, the players were very glad to see some new gameplay, that I achieved solely with the aid of the powerful Script. Some of those very much liked and commended moments of my debut level were:

  • the Elevator puzzle, where you can bring the elevator to four floors, and use it to reach various platforms in the room
  • the battle to kill Seth (Seth is only mortal if the rays of Isis are hitting him and as long as he doesn't fly)
  • the ability to craft poison and explosive arrows from the Inventory items
  • pushable parallel bars, or parallel bars glued to pushable obelisks
  • the Elevator trap, where plough blades are glued to the elevator floor as we all go upwards

All these gameplay elements were created with the use of the powerful NGLE / TombEditor Script. It offers us endless possibilities and combinations, such as creating brand new puzzles and weapons, enemies and traps, or sequences of perfectly timed doors, traps, burners, enemies, events, whatever you want. Trigger Groups, Organizers and Global Triggers can do miracles if you know how to use them, and they're also not complicated at all. I've provided several tutorials for NGLE scripting, and I'll continue to do so, but for the time being, let's focus on the ELEVATOR, my second-favorite Script command (my favorite and ultimate being the Global Trigger).

Elevators are actually Two_Block Platforms (TBP), which are defined in the Script as elevators, using the simplest command:

Elevator= 

Within this Script command, you define how the elevator should move:

  • how many floors?
  • how many clicks between each floor?
  • the speed of the elevator
  • the animated objects that move with the elevator
  • are there doors and keypads to operate the elevator internally?
  • are there doors and keypads to operate the elevator externally?

Within the WAD, you need to have the following objects:

  • TWO_BLOCK_PLATFORM or ONE_BLOCK_PLATFORM object
  • all other objects which should be moved with the Elevator in Animating slots!
  • Keypad in Switch_type 1 slot (if you use it for external operation)
  • Door in Door_type slot (if you use it, double or single)
  • False keypad in Animating 1 slot (if you use it for internal operation)

When you define the TBP as an Elevator in the Script, you will automatically get the following features:

  • the Elevator has "two floors" 8 clicks apart. This means that the elevator ceiling will be 8 clicks above the elevator floor.
  • Lara can stand on both floors and also ride the elevator inside (on the elevator floor) or above the elevator (on the elevator ceiling).
  • Lara can also hang from the edges of the elevator floor and elevator ceiling, but don't try to pull up while the elevator is moving upward or downward, as the results could be quite strange
  • the Elevator can be used as a trap as well. If Lara is standing at the bottom of the elevator shaft, the elevator can kill her as it goes to the ground floor. If Lara is standing on the elevator roof as it goes up, she can die when the elevator reach the top floor, if the shaft ceiling is low.

In my BtB2024 level, the setup was the following:

  • TBP set to "invisible" in the OCB window
  • Dummy trigger set beneath the TBP in the room (elevator shaft)
  • Elevator created in the Script, and various animated objects added to it, which should go up/down with the TBP
  • Placing four switches that bring the elevator to the desired floor (4 floors in total)

This is the BASIC setup for an Elevator, perfect for this tutorial. More complex elevators can be created as well, with bridges, keypads, doors, collisions etc., but this is a tutorial for beginners, and we'll focus on the basics here. As example, I'll use the Horus Elevator puzzle from my debut level "BtB2024 Challenge of the Highpriest".

 

The basic concept of an elevator is: you create the elevator from a TBP, and then you define the number of floors, the clicks between the floors and speed of the elevator. After that, you add the animated objects that you want to be moved with the TBP (elevator).

 

So, place the TBP in the elevator shaft and note its ID number. In our example, it's 84. The elevation of the TBP in the Editor is always the first floor. You can lower the floor of the elevator shaft if you want and create a basement, it won't change the elevation of the TBP and the first floor. 

 

Elevator= [ID of the TBP], [clicks between floors], [number of floors]...

 



In our case:

 

Elevator= 84, 8, 4...

 

Two-block platform 84 will work as elevator with 4 floors and 8 clicks between each floor.

 

Elevator= [ID of the TBP], [clicks between floors], [number of floors], [elevator features], [elevator door], [elevator keypad], [speed], [...objects attached to the elevator...]

 

For our setup, we don't need a keypad inside the elevator, and we don't need an elevator door. So, after the number of floors, we write "IGNORE" three times, and then define the other parameters:

 

Elevator= 84, 8, 4, IGNORE, IGNORE, IGNORE, 16... (the speed is added, which is 16)

 

Now, you simply add other Animated objects in the Editor and note their ID numbers. You simply add these numbers to the Elevator= line in the Script, separated by a comma. In my level, I added 30 objects to this elevator, such as 4 bridges, 12 golden platforms, burners, curtains, wall brackets... But for the purpose of this tutorial, you simply make a 2x2 elevator shaft, and place one Dummy trigger for the TBP at the bottom of the shaft, by selecting the 2x2 area beneath the TBP. If you made your TBP invisible in the OCB window, then you have to add an Animating or MIP object that will imitate the elevator floor and ceiling, or several such objects. Just add their ID numbers to the Elevator= line in your Script after the speed parameter, and they'll simulate the elevator for you.

 

So, after the speed (in our example "16"), add the ID numbers of animated objects that will move with the visible or invisible two-block platform. You can now build your Script. The remaining work is to be done in the Editor, or elevator room itself.

 

In our example (Challenge of the Highpriest) we have an elevator that is sent to the desired floor by four different wall levers. Switch 1 sends the elevator to floor 1, Switch 2 sends it to floor 2, etc.  

 

Place the switch you want to use for sending the Elevator to floor 1. Place a Switch trigger beneath that switch, as usual. Now, select the TBP in the room and the same floor square beneath the switch, and click on "+" in the Trigger section of the Editor to open the Trigger Editor window. In this window, place an ActionNG trigger for the Elevator on the same square beneath the switch. 

 

 

Click "OK" to place the trigger, and then repeat the same process with other three switches, assigning the respective floor to each of the switches. You can now build the level and test your elevator.

 

ADDITIONAL NOTE: The sounds for the elevator are hard-coded. The Script always uses samples/slots 370 and 371 for the Elevator (370 for moving, 371 for stopping). If your elevator is silent, it's because you're missing the sounds/samples on these two slots. If you hear strange and inadequate sounds when you move your elevator in-game, then replace these two samples (370 and 371) with sounds that will fit better with your elevator.

 

Happy building!

 


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!