www.tombraiderforums.com

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

Closed Thread
 
Thread Tools
Old 24-08-15, 11:24   #1
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,084
Default TRNG - The Keypad

by Bedazzled


This tutorial shows how to use the TR5 keypad as a coded switch in base type levels with the option of on screen instructions being given to the player.





I have tested it and found it to work in switch slots 1 - 4. When adding it to your wad there is no need to use WadMergers switch manager; just copy the keypad into a switch slot. Also ensure you are using one of the revised wads.

By default Lara will perform the small push switch animation when using the keypad, but this and the animation she does on exiting the keypad can be changed along with the sound the keypad emits when a button is pressed.

The secret to its operation is the OCB code which takes this form 16384 + the desired 4 digit code number. For example if you want a user code of 1234 the OCB code for the keypad would be 17618.

After placing the keypad and entering the correct OCB code, place a switch trigger beneath it as you would for a normal switch, along with the trigger for the object to be triggered.

Adding the instructions

To give the player on screen instructions the two flipeffects shown below are used. The first sets size of the text and the second determines what is printed and how long it's displayed for.

They should be arranged so that as Lara approaches the keypad they will be triggered in the order they are shown here.








The text you want displayed must be added to the English.txt file as an additional string. This can be done manually but to avoid errors use the NGScripter as described in this tutorial. Either way the finished English.txt file will contain extra lines similar to these.

[ExtraNG]
0: Use the arrow and action keys to\nSelect and enter a number\npress enter to exit the keypad

Creating the text to display

Open the NGScripter and from the Strings tab select the [ExtraNG] option from the section drop down box; then click the Add new Extra String button. A new entry will be started and the cursor will be positioned in the text box near the bottom of the window; this is where you will enter your text.





Enter your text into the box at the bottom of the window, when you want to start a new line enter \n into the text. If you're using half height characters as I did try to limit each line of the on screen text to a maximum length of 32 characters.

This is the line of text I used for the first screenshot, which you can just copy & paste:


Use the arrow and action keys to\nSelect and enter a number\npress enter to exit the keypad


After entering your text, press the Update button to transfer it into the top window. Click on the script tab and find the level section of your script. You now need to set the colour, position on screen and the size of your printed text.


This is the command I used to have white, size10 text at the top centre of the screen.


[Level]
Name= Playable Tutorial Level
Horizon= ENABLED
Layer1= 160,160,192,7
TextFormat= CL_WHITE,FT_TOP_CENTER,IGNORE, 10

The colour, position on screen and the size are set using the command:
TextFormat=
Syntax: TextFormat=Color, FormatFlags(FT_..), BlinkTime, SizeCharacter (SC_..)

To be used in the title or level sections of the script.


A complete explanation of the arguments used with this command can be found under the Reference Tab of the NGScripter, in the Show SCRIPT NEW commands window.
The values which can be used for all of these arguments can be found under the Reference Tab of the NGScripter, in the Show _ MNEMONIC CONSTANTS for new script command window.
AkyV is offline  
Old 11-11-16, 16:25   #2
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,084
Default OCB codes for elevators

(by poster)

Usually the code in a keypad is between 0 and 9999 (plus, that 16384).
But if the TRIGGER under the switch object and under the SWITCH trigger is an A28, then the code is something else, because it is a code for an elevator, the elevator will go to the level you type in the keypad.

Level__Lara types in the keypad__OCB code__code you need to type in OCB (because of that 16384)
1__1__1+10000=10001__26385
2__2__2+10000=10002__26386
3__3__3+10000=10003__26387
4__4__4+10000=10004__26388
5__5__5+10000=10005__26389
6__6__6+10000=10006__26390
7__7__7+10000=10007__26391
8__8__8+10000=10008__26392
9__9__9+10000=10009__26393
10_0__10+10000=10010_26394
AkyV is offline  
Old 11-11-16, 16:26   #3
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 2,084
Default More than one proper code

(by poster)

If you would like to use more than one good code with the keypad (at the same time), then these are the methods:

Method#1

This time you need a Switch Script command.
This method is useful for codes maximum with one digit.
First of all, type in the OCB panel any number which is out of the useable range. It is “from 0 to 9999” range usually, but you also need to calculate the elevator range: “from 10001 to 10010”. As you know, you also need to add 16384. 16384+10010 is 26394. I choose a number a bit above it. I mean, I tested it with 27000, successfully.

You need a SWITCH trigger and a TRIGGER as well on the square of the keypad, as usual. But this time the TRIGGER is an F289, to activate a Switch Script command. The variable you use in the command must be Last Input Number.
Switch Script commands are useful instead of complicated GlobalTriggers, if your purpose is something like this: “if Variable A value is B then TriggerGroup C will be executed, if Variable D value is E then TriggerGroup F will be executed etc”.

So, for example:

Switch= 1, #0200, IGNORE, 15, 17, IGNORE, 22

1 is Switch command ID. #0200 is the ID of Last Input Number. The first IGNORE for flags (unused now).
The other numbers are TriggerGrup codes, in order for 1, 2, 3, 4 numbers typed in the keypad. So, if you type 1, then TriggerGroup#15 will be executed, if you type 2, then TriggerGroup#17 will be executed, if you type 3, then no TriggerGroup will be executed, if you type 4, then TriggerGroup#22 will be executed.

Method#2

This time you need GlobalTrigger Script commands, without ANY triggers placed under the switch object.
This method is useful for codes maximum with three digits. (Be careful if you use the same code with another keypad of the level, because the solution will be the same. Or disable the GlobalTrigger of the first keypad when Lara is near the other keypad.)
First of all, type in the OCB panel any wrong code of the “from 0 to 9999” range. Eg. you don’t need the code of 102, so you type 102+16384=16486.

For example:

GlobalTrigger= 1, IGNORE, GT_ALWAYS, IGNORE, IGNORE, 1, IGNORE
TriggerGroup= 1, $8000, 123, $13, > ; C19: if last number type in a keypad=123
$5000, 416, $2B, > ; A43: activate flame ID#416
$8000+TGROUP_ELSE, 456, $13, > ; C19: if last number type in a keypad=456
$5000, 415, $2B ; A43: activate flame ID#415

Don’t use it for timed setups!
Or for features that can be activated more than once, now and even in the next moment (like an audio file).


Method#3

This time you need GlobalTrigger Script commands, without ANY triggers placed under the switch object.
This method is useful for codes even with four digits. (Be careful if you use the same code with another keypad of the level, because the solution will be the same. Or disable the GlobalTrigger of the first keypad when Lara is near the other keypad.)
First of all, type in the OCB panel any wrong code of the “from 0 to 9999” range. Eg. you don’t need the code of 102, so you type 102+16384=16486.

For example:

GlobalTrigger= 1, IGNORE, GT_ALWAYS, IGNORE, IGNORE, 1, IGNORE
TriggerGroup= 1, $8000, 53, $28, > ; C40: if Last Input Number variable=number at PARAM_BIG_NUMBERS#0
$5000, 416, $2B, > ; A43: activate flame ID#416
$8000+TGROUP_ELSE, 53, $128, > ; C40: if Last Input Number variable=number at PARAM_BIG_NUMBERS#1
$5000, 415, $2B ; A43: activate flame ID#415
Parameters= PARAM_BIG_NUMBERS, 1234, 5678

If the setup is timed (or see eg. even that audio thing I said above), then modify the setup this way:

GlobalTrigger= 2, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 3, 4, IGNORE
TriggerGroup= 3, $8000, 53, $28 ; C40: if Last Input Number variable=number at PARAM_BIG_NUMBERS#0
TriggerGroup= 4, $5000, 416, $52B, > ; A43: activate flame ID#416, for 5 seconds
$2000, 232, $35 ; F232: turn Last Input Number variable into 0
GlobalTrigger= 3, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 5, 6, IGNORE
TriggerGroup= 5, $8000, 53, $128 ; C40: if Last Input Number variable=number at PARAM_BIG_NUMBERS#1
TriggerGroup= 6, $5000, 415, $52B, > ; A43: activate flame ID#415, for 5 seconds
$2000, 232, $35 ; F232: turn Last Input Number variable into 0
Parameters= PARAM_BIG_NUMBERS, 1234, 5678

Note:
If you'd like to change the code (so if you want more good codes, but after each other), then probably "timed" Method#3 is the best (not timed everyway now), but in this way:
- GlobalTrigger for code#1 is enabled and the one for code#2 is disabled, then
- GlobalTrigger for code#1 is disabled and the one for code#2 is enabled.
But "resumed" flag is necessary now only if the setup is timed or that audio type or something similar.

Last edited by AkyV; 11-11-16 at 21:18.
AkyV is offline  
Closed Thread

Bookmarks

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 17:42.


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