Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Tomb Raider Level Editor Tutorials

Closed Thread
Thread Tools
Old 08-09-15, 09:06   #1
Join Date: Dec 2011
Location: Hungary
Posts: 2,377
Default TRNG – Following Lara’s route in the level map

Author: AkyV
Based on the idea of Dino14

I used the original Playable Tutorial Level of TRLE as the example level.

How it works

The player hits Key M (M for map) to open the map where the tip of the pointer (i.e. the middle of the little star object) indicates Lara’s actual position.

The map will close:

- if the player hits the Look button, or
- if Lara extracts a weapon, or
- if special cameras (fixed cameras, flyby cameras etc.) are shooting, or
- if an F120 trigger deactivates all the static cameras.

The map is separated for texture tiles which are placed on a floor of a room (the so-called Map Room). A camera will shoot at the floor, I mean, a camera target. This camera will switch on if the player hits M.
The pointer is also placed on the floor, anywhere in the room, always moved to the proper position by scripted triggers.

Further examples:

The setup

1. Creating a map

Make your level to 100 %, ready for the beta test.

Click Settings button on Flip Palette of the Room Editor, to open the Settings panel.
Check “Save image of map after output wad command”.
Close the panel with OK.

Output the WAD.
See TRLE main folder: a map has been created here with the name like:


We will use that map as the map where the pointer will move in the game.

Uncheck “Save image of map after output wad command”, if you want. You don’t need that function any more.

2. Calibrating the map

The ratio and the position between the map of the pointer and the original level map of the Editor Window must be as perfect as it is possible. That is why we will try to use a really precise measure unit for map sizes. This is the well-known “unit”, in which 1024 units mean 1 square.
The size of the effective level map is 100 squares×100 squares, which is 102 400 units×102 400 units. However, the real level map is bigger than the effective level map, because there is a 1 square (1024 units) sized useless gap between the edge of the effective map and the edge of the Editor Window: (“Useless” means you can’t get move rooms horizontally out of the border of the effective map.)

So we’ll start the calculation with a 102 squares×102 squares (104 448 units×104 448 units) sized level map – because this is the same map you can see now in Last_2dMap_(project_title).bmp.
To calculate a precise ratio, we will handle that 104 448 units as if that were 104 448 pixels. The original size of Last_2dMap_(project_title).bmp is 512×512 pixels, so we should increase that to 104 448×104 448 pixels. I think a huge size like that is impossible technically, so we will increase it only to 1044×1044 pixels – which is the proportional, hundredth part of 104 448×104 448 pixels.

So resize Last_2dMap_(project_title).bmp to 1044×1044 pixels, and save it.

If we need a useable ratio, then we must say that if the level map is 100×100 squares sized, then the Map Room is 5×5 squares sized. It is clearly a 1:20 ratio. So we need to cut the useless 1 square sized gap off Last_2dMap_(project_title).bmp to get the effective (100×100 squares sized) map.

I recommend for example IrfanView for that:

Hit SHIFT+C to open this window:

Choose “none” for “1-set ratio for width : height”, and choose these values in “2-selection size/position”:

Width and Height is 1024, which is 102 400/100, because we increased the map to 1044 instead of 104 448.
X-Offset and Y-Offset is 10, which is 1024/100, because we increased the map to 1044 instead of 104 448.

Click “Save and apply to image”, and then CTRL+Y to crop selection.
Then save Last_2dMap_(project_title).bmp, with this new size.

The example project I used has 64×64 pixels’ sized texture tiles, so if I say I need a 5×5 squares’ sized Map Room, that means a 64×64 pixels’ sized tile on each square, i.e. a 64×(5×5)=320×320 pixels sized map.

That is why resize the 1024×1024 pixels’ sized Last_2dMap_(project_title).bmp to 320×320 pixels, and save it.

Joey79100's remark:

As I wanted to use 128*128Px textures for the map I decided not to resize the image from 1024*1024 to 320*320 but to 641*641 instead. This allows for a very good precision for all the map, there is no displacement for the bottom right part, even right in the corner (or it's so minimal that it's not even visible).

SUMMARY – how to calibrate the map:

STEP1 - resize Last_2dMap_(project_title).bmp to 1044×1044 pixels.
STEP2 – select X-Offset: 10, Y-Offset: 10, Width: 1024, Height: 1024 as the new Last_2dMap_(project_title).bmp.
STEP3 - resize Last_2dMap_(project_title).bmp to 320×320 pixels.

3. Using the map parts as texture tiles

Open a texture set editor, eg. TBuilder. Load the TGA set of the level and also load Last_2dMap_(project_title).bmp. Add the tiles of the BMP to the TGA set.

If there are more than one totally white texture tiles on the BMP then naturally you need to add only one of them to the TGA set.

Load (update) the TGA set, you have just changed, to the level.

Click the Select button of the Level Editor (amongst the Room Buttons) to create a brand new room. Call it Map Room. Keep the 20 clicks sized height, but bound (resize) the room for 5×5 squares.

Texture the Map Room:

- Click the black spot on the Flip Palette, and use it on the room walls and ceiling, to make them transparent.
- Place the map textures on the floor of the room.

4. Positioning Map Room

The next problem is the origin of the map in the game. It is always the northwestern (upper left) corner of the Editor Window, but you can’t move the Map Room out of the effective map (as I said above).
So, even if you move the Map Room to X:0 and Y:0 coordinates, there will always be 1 square (1024 units) difference between the game map and the map of the pointer.

However, the best position for Map Room is X:0 Y:0 (because that is the easiest situation to calculate the pointer coordinates – see below), so move Map Room to that coordinate. (The vertical coordinate of the room is unimportant.)

5. Setting Map Room

Add a one-meshed, tiny Moveable object to your WAD. That will be the pointer. – I chose a puzzle item of the WAD, but you can choose any other object. (Probably also try to add an AddEffect to it.)
Put the object on the floor of the Map Room – it doesn’t matter where, because scripted triggers will always move it to the proper position.

But never forget:
The pivot of the object will be the tip of the pointer that precisely indicates Lara’s position. So always choose an object that has the pivot at the part of the object that will work as the tip. (Or you can use ACTION triggers to modify the object position, so not the pivot but another part of the object will be the tip.)

Place a CAMERA_TARGET object on the floor, and (near the ceiling) a camera. (Later, if you test the map view, you will move the camera up or down if that is not the proper position.)
Both of them must be over the central square of the room, so the camera will shoot at all the floor squares in a nice way, i.e. (almost) in the same distance and camera angle.

The Map Room view will be turned with 90 degrees in the game. It is probably because the target is exactly under the camera.
To fix that, we will cheat a bit, what is imperceptible in the game:

Place a One Shot trigger below Lara object, so the target will be moved a little bit in the northern way (Room Editor facing) when the level starts:

; Set Trigger Type - ACTION 65
; Exporting: TRIGGER(65:1) for ACTION(358)
; <#> : CAMERA_TARGET ID 358 in sector (3,3) of Room8
; <&> : Move. Move to north <#>animating for (E)units (one sector = 1024)
; (E) : Units = 8
; Values to add in script command: $5000, 358, $41

6. Scripting

The scripted segment of the setup has three main parts:

If the player hits Key M then the camera of the Map Room will shoot at the camera target below it.

GlobalTrigger= 1, IGNORE, GT_KEYBOARD_CODE, 50, IGNORE, 1, IGNORE ; 50= Key M – M for map
TriggerGroup= 1, $5000, X, $2A, > ; A42: define object with ID X as the camera target
$5000, Y, $29 ; A41: activate camera with ID Y
The game will read the two actual horizontal coordinates of Lara into Global Long Alfa (GLA) and Global Long Beta (GLB) variables:

TriggerGroup= 2, $5000, Z, $36, > ; A54: define object with ID Z as Lara
$2000, 256, $1930, > ; F256: put one of the actual horizontal coordinates into Global Long Alfa (GLA) variable
$2000, 256, $1B31 ; F256: put the other actual horizontal coordinate into Global Long Beta (GLB) variable
The game will force the two actual horizontal coordinates of Lara, stored in GLA and GLB, for the pointer:

- STEP1: the game divides the coordinate by 20, because, as I said above, we will use a 1:20 ratio.
- STEP2: We need that 1024 units’ sized correction between the origin of the game map and the pointer map, as I said above, so 1024 will be added to both of the coordinates. (I used several F231 triggers, because the biggest value I can force with that trigger is 127.)
- STEP3: The coordinates will be forced.

TriggerGroup= 3, $5000, W, $36, > ; A54: define object with ID W as the pointer
$2000, 253, $1430, > ; F253: divide GLA by 20
$2000, 231, $7F30, > ;F231: add 127 to GLA
$2000, 231, $7F30, > ; F231: add 127 to GLA (=254)
$2000, 231, $7F30, > ; F231: add 127 to GLA (=381)
$2000, 231, $7F30, > ; F231: add 127 to GLA (=508)
$2000, 231, $7F30, > ; F231: add 127 to GLA (=635)
$2000, 231, $7F30, > ; F231: add 127 to GLA (=762)
$2000, 231, $7F30, > ; F231: add 127 to GLA (=889)
$2000, 231, $7F30, > ; F231: add 127 to GLA (=1016)
$2000, 231, $830, > ; F231: add 8 to GLA (=1024)
$2000, 257, $1930, > ; F257: force GLA value for the northern-southern position (Room Editor facing)
$2000, 253, $1431, > ; F253: divide GLB by 20
$2000, 231, $7F31, > ; F231: add 127 to GLB
$2000, 231, $7F31, > ; F231: add 127 to GLB (=254)
$2000, 231, $7F31, > ; F231: add 127 to GLB (=381)
$2000, 231, $7F31, > ; F231: add 127 to GLB (=508)
$2000, 231, $7F31, > ; F231: add 127 to GLB (=635)
$2000, 231, $7F31, > ; F231: add 127 to GLB (=762)
$2000, 231, $7F31, > ; F231: add 127 to GLB (=889)
$2000, 231, $7F31, > ; F231: add 127 to GLB (=1016)
$2000, 231, $830, > ; F231: add 8 to GLB (=1024)
$2000, 257, $1B31; F257: force GLB value for the eastern-western position (Room Editor facing)

Joey79100's remark:

A little something I've added to my setup, which depends on what people prefer, is copying the orientation too. I'm using this because I'm using an arrow (currently) so I prefer when it also has Lara's orientation with it.
In GT2 (where you save Lara's coordinates) I've added
$2000, 256, $1D32 ; F256: put facing horizontal coordinate into Global Long Delta (GLD) variable, and in GT3 (where you give the object the transformed coordinates), I've added $2000, 257, $1D32 ; F257: force GLD value for facing horizontal coordinate.

7. Troubleshooting

Incorrect ratio

104 448 pixels divided by 100 is 1044 in the description above. But it is clearly not true, the exact value should be 1044.48.

That is why the further Lara gets from the origin of the map the more incorrect the ratio will be.

For example, you can see: Lara is standing on the middle of the ledge. The pointer shows she’s on a corner of the ledge, though:

If that bothers you, then don’t place rooms near the eastern (right) or southern (lower) edge of the Editor Window, which are far from the origin.
Or find a method to create a perfect 1044.48 pixels’ sized map.

Camera issues

The camera of the Map Room and other static cameras will be stuck in each other: So if Lara is standing on a square of a CAMERA trigger, then:

- If you can just see the static camera view and hit M then some strange camera view will be shown.
- If you have already aborted the static camera view and hit M then some strange camera view will be shown.

To prevent that problem, you may disable the trigger square with deactivating the active TRIGGER_TRIGGERER on it, if you don’t want to use that camera any more, but perhaps you should be more refined than that:

1. Use this GlobalTrigger, so you won’t be able to mess up the static camera view, hitting M, because nothing will happen, some strange camera view won’t be shown.

GlobalTrigger= 4, IGNORE, GT_CONDITION_GROUP, IGNORE, 4, 5, 6
TriggerGroup= 4 $2000, 277, $11, > ; F277: copy the actual camera mode into Current Value variable
$8000, 1, $30 ; C48: study if Current Value is 1 (which means if a static camera is just shooting or not)
TriggerGroup= 5 $2000, 109, $100 ; F109: disable GlobalTrigger#1 – so you can’t switch on the pointer camera
TriggerGroup= 6, $2000, 109, $101 ; F109: enable GlobalTrigger#1 – so you can switch on the pointer camera again
2. Even if you use GlobalTrigger#4, you will be able to show that strange camera view if you hit M when Lara is still standing on the CAMERA trigger square after aborting the camera view.
To prevent that, you should use One Shot for the camera trigger.

If you don’t want to use One Shot for the camera trigger, then use a TRNG camera trigger. (The main difference between TRLE and TRNG static camera triggers is TRNG camera won’t switch off if Lara leaves the trigger square, you need to switch that off in some other way: hitting Look key, extracting weapons etc.)
If you want to use a TRNG static camera trigger, then place an F118 trigger where you originally wanted to place the CAMERA TRLE trigger. (Choose “single mode” in F118.)
F118 refers to a TriggerGroup, for example, TriggerGroup#7. That TriggerGroup must contain the TRNG camera trigger:

TriggerGroup= 7, $5000, 415, $29 ; A41: activates static camera with ID 415

If you hit M, standing on F118 trigger square, just after aborting the camera view, then the pointer map will open.

See more here about TRNG cameras:


Made using TRNG

Last edited by AkyV; 22-07-17 at 00:10.
AkyV is offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT. The time now is 01:00.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.