Scripting ‐ Parameters (move a Static) - Tomb-Raider-Level-Editor/Tutorials GitHub Wiki

Written by Nina Croft

Parameterscommand in the Script has many uses and functions, and in this tutorial I will show you one use of this command. The principle is the same for all other uses of this command.

In this example, we have a static object (suspended bridge) that we want to move in upward direction by 2 sectors (2048 units) at a certain speed. First we will place the Static object in the room and note its ID number. Then in the Script, we’ll create a Parameter command for this Static.

Parameters= PARAM_MOVE_ITEM, 2, IGNORE, 253, DIR_UP, 2048, 16, IGNORE, IGNORE

The syntax of this command is as follows:

Screenshot-4

PARAM_MOVE_ITEM (we define the Parameter which will move a static object) Then number of parameter (2) follows - if this is your first Parameters= command in the Script, then it should be “1”. In my case, this is the second Parameters= command in my Script, therefore I wrote “2”. Then there’s a slot for Parameter Flags. We don’t use any flags in this case, and we write “IGNORE”. Then the ID number of our static object follows (in my case, 253) The next slot describes the direction in which we want to move our object (DIR_UP - direction UP) Number 2048 indicates the number of units by which we will move our object in the upward direction. I want to move my object by two sectors, and that’s 2048 units. Number 16 indicates the speed at which the static object will move in the upward direction. Two last slots in this command are the SOUNDS you can add to this command if you want. The first defines the sound of moving, and the second defines the sound of stopping. I won’t use any sound in this example, so I wrote “IGNORE” on both these slots.

When this Parameter is created, the next thing we must do is “call” this parameter. We will export the trigger for this parameter from the Editor into the Script. So, in the Editor, click on any square and then the sign + to open Trigger Editor window. Trigger type: Trigger What: FlipEffect Param: Statics.Move Move static with data in parameter list (F166) Extra: number of Parameter (in this case 2)

Screenshot-5

Do not click OK in this window. Export the Script code in the lower right corner of Trigger Editor window (click on Copy to clipboard) and then click Cancel to close the Trigger Editor window. Make sure that you haven’t accidentally added a trigger for this parameter in the Editor (room). Then go to the Script and create a new Trigger Group. In my case, the number of this Trigger Group is 30. After you type the number of the Trigger Group, paste the code you exported from the Trigger Editor window. In my case, the code is

TriggerGroup= 30, $2000,166,$0002

Now we can trigger this Trigger Group in the Editor, and the Trigger Group will move the Static object up by 2 sectors, as you defined in the Parameter line for that Static. First save and build the Script, and go back to the Editor. As usual, Trigger Groups are triggered in the Editor as FlipEffects.

Add a Switch to the room, and place the Switch type trigger for this Switch object. Make sure to tick off the “one-shot” box in this Switch trigger window. This is really important (read the note at the end of this tutorial).

Screenshot-3

Then select the same square where you placed the Switch trigger, and then click the sign + to open Trigger Editor window. Trigger type: Trigger What: FlipEffect Param: TriggerGroup. Perform Trigger Group from script.dat (Single execution to use...) Timer: number of the Trigger Group, in this case 30. This time click OK and place the trigger on the same square where you placed the Switch trigger.

Start the game and test the setup. Flip the switch and the Static object should go up by two sectors. Make sure that you cannot use this switch again (one-shot).

Now, so far we have a Static object which is moved up by two sectors. It looks nice. If this Static object blocks a door, we can move that Static object up, and then we can access the door. In this case, the Static object must have its collision (the collision will move up with the object, of course).

However, in this tutorial example, I created a bit more sophisticated event. The Static in this example is actually a suspended bridge. Lara uses this suspended bridge to get to the other side of the lava pool. But then she must raise the suspended bridge, to be able to get to a higher level. Since this object is Static and basically useless by itself, I must use Bridge_Flat object. Therefore, the collision of the Static object in this example is ZERO, and the Bridge_Flat object is invisible (textured transparent). Then I add the Bridge_Flat object, with OCB 64. This OCB will make the Bridge_Flat object grabbable. Then I place Dummy trigger under the Bridge_Flat, that Lara can stand on it. Finally, I will raise this Bridge_Flat by two sectors, together with the Static. When we raise the Bridge_Flat object, it keeps all its features, and Lara can walk on it and grab its edges when it goes up by 2 sectors. All I have to do is export the correct trigger for the Bridge_Flat object and add it to the same Trigger Group 30, where I added the flipeffect/parameter trigger to raise the Static.

Screenshot-2

There is something many builders do, that makes things more complicated than they actually are. For instance, if you want to have a Bridge_Flat object on three sectors at the same height (elevation), you will typically place three Bridge_Flat objects on these three sectors, and place three separate Dummy triggers beneath these three Bridge_Flat objects. This isn’t wrong, but it’s also unnecessary. If all three sectors have a Bridge_Flat at the same height, then you don’t have to place three Bridge_Flat objects and three Dummy triggers beneath them. You should only place ONE Bridge_Flat object, and then select all three sectors, and place one Dummy trigger for that single Bridge_Flat on all three sectors. This always works like a charm. And all three sectors will have a grabbable bridge, if you enter OCB 64 for that one Bridge_Flat object. As I said, as long as all three sectors have a bridge at the same height (elevation), everything will work perfectly and you will have less work to do in the Editor.

Therefore, place one Bridge_Flat object at the Static object, and enter 64 in the OCB window. Select all three squares beneath the suspended bridge and place one Dummy trigger for the Bridge_Flat. Now we must export the Script code where we want to raise the Bridge_Flat object by 2 sectors at exactly the same speed as the Static we already triggered. Select the Bridge_Flat object, then select a sector in the room and open the Trigger Editor window. Therein, select the following values: Trigger Type: Trigger What: ActionNG Param: the bridge you selected Timer: Move.Move up animating for E clicks (A30) Extra: 8 clicks (2 sectors)

Screenshot-6

Again, do NOT click OK, but copy the Script code below. Click Cancel or X to close the window without adding the trigger to the sector. Then go to the Script and find Trigger Group where you triggered the Static object to move up. Add a comma and paste the code you copied from the Trigger Editor window. Save and build the Script. You can now test the Trigger Group. Before you use the switch in game, jump to the suspended bridge and check if it’s walkable and grabbable. Then use the switch and raise it. Check if the suspended bridge is climbable and walkable in its Up position.

Screenshot-7

Now you can add to this Trigger Group more items. If you want to add invisible collision, or another static item, then create another Parameter for that item, export the trigger for that Parameter as you did with the first Static object, and simply add it to the Trigger Group you already created. If you want to add an animated item to the Trigger Group, then again use ActionNG as you used with Bridge_Flat object, since that’s how we lift an animated item. Export the trigger as you did with the Bridge_Flat, and add it to the Trigger Group. You can also add some sounds and even Parameter Flags. Just remember that a Parameters= line must be created for a staticobject and the corresponding FlipEffect trigger exported, and for an animated we simply export an ActionNG trigger into the Script.

Of course, we don’t have to trigger this Trigger Group with a switch, as I did in this example. We can also heavy trigger the Trigger Group 30 with a flyby camera, for instance. In the video tutorial I showed how this is done and how both variants look in game. A Trigger Group from the Script can be triggered as any other normal Trigger in the Editor. It can be heavy triggered, or triggered by a switch, puzzle item, key, or any other normal trigger in the Editor. Trigger Group is one of the safest ways to ensure that ALL objects will be triggered at the same time. In another tutorial I explained the Organizers, which define the sequence at which the Trigger Groups will be executed. We always place one single trigger in the Editor itself, by which we call the Trigger Group or Organizer, or a Global Trigger. Creating triggers in the Script by exporting them from the Editor and placing them into a Trigger Group is a powerful tool to create a great and still new and innovative gameplay.

IMPORTANT NOTE: Why I said that this particular trigger for this particular Trigger Group should be “one-shot”? Well, there’s a limitation to this. If the switch in this example is not “one-shot”, then we can use that switch again. The entire Trigger Group will be executed again, which means that the Static and Bridge_Flat will againmove up by 2 clicks, as defined in the Script. Eventually, the entire suspended bridge will go up through the ceiling, and that doesn’t look nice and doesn’t make sense. Therefore, make sure that the trigger that executes this Trigger Group is “one-shot”.

Also, if you want to lower this suspended bridge again later in the game, then simply create a new parameter for the same Static, just create another Parameters= line where you’ll move the static DIR_DOWN by 2048 units and at the same speed. Then create another Trigger Group, export this Flipeffect trigger and paste it into the Script, and then export the corresponding ActionNG trigger for the same Bridge_Flat object, and add it to the new Trigger Group. Add the trigger for this trigger group to another switch (for example) and make sure that this trigger is also “one shot”.

It is possible to lower and then raise the same suspended bridge with one “multi shot” switch, but this is done in the Script in another way, with the aid of Global Triggers. But that’s planned for another Scripting tutorial.

Video tutorial with heavy triggering the Trigger Group (with flyby camera)

https://www.youtube.com/watch?v=2ERVW8JhrfU