Tomb Raider Forums  

Go Back   Tomb Raider Forums > Tomb Raider Level Editor and Modding > Tomb Raider Level Editor > Tutorials and Resources

Closed Thread
 
Thread Tools
Old 27-07-24, 11:14   #1
AkyV
Moderator
 
Joined: Dec 2011
Posts: 5,074
Default TEN - Building script files

Made using Tomb Editor 1.7.1. pack (including Tomb Engine 1.4.)
Last update to TE/TEN: -


Just like in the classic engines, TEN also uses scripting to build levels.
In the case of the good old TRLE, you could experience that making script means typing numerical (or sometimes textual) values in the fields of different script commands. It seemed a pretty easy procedure.
TRNG is based on TR4, so TRNG script followed the same pattern - though, even a bit more complicated way, also using constants and such.
TEN scripting is not some TEN-specific procedure, it is called "Lua scripting". Perhaps for you, who is a beginner in building TEN, it is not really understandable and not really important. But what must be important is that you need to keep in mind that Lua scripting is completely different. It is not about commands and their fields, it has different and more parameter types, and not simply level blocks and command lines make its structure.
So Lua scripting is really diverse, you need to learn more about not only TEN happenings which are available with scripting, but even about scripting techniques.

It is meaningless to deal with TEN happenings till you don't know enough about scripting techniques. - So let's start.
Now I start a tutorial sequence to introduce Lua scripting techniques. This current tutorial is the first member of this sequence - it will be very short, I only introduce the script files now.

However, I don't want to tell once more some basics about scripting in TEN, read these here and here.

Besides, you already needed to do some scripting, when you created your current level (i.e. this level needs a block in Gameflow.lua script file and a level name in Strings.lua script file), that is why now I don't need to introduce Scripting Studio in TIDE, where you can see/edit your script for your game/level.

Also remember: when you finished editing your script files, so they are ready to build them for the game, then you don't have a separated "building" function.
I mean, simply save the changes in the files - and after that the script is already ready for the game.


----------

Notes:
  • As the title says, it is “only” a Tomb Engine (TEN) tutorial. Many aspects you need to know for this tutorial are specific Tomb Editor (TE), TombIDE (TIDE), WadTool (WT) etc. features.
    So non-TEN features are only referred now, if it is necessary. And as much as I found it necessary. You need to also meet these features in other tutorials, for further details about them.
  • Some related TEN features are only mentioned, but not discussed in this tutorial, because they belong better to (an)other tutorial(s).
    Find another info source or be patient till those other tutorials are made.
  • Some options or commands can be executed in several ways. I may not introduce all of the ways in the tutorial. (Using default keys are presumed.)
  • Explainig basics about Lua scripting is not the best decision in a precise way when you, the reader, is a beginner TEN builder. That is why I try to interpret Lua scripting mostly with my own words - while I also try to remain authentical, naturally. (Which is not too hard, anyway, because when I am making this tutorial sequence then I am not a Lua expert myself...)
  • Perhaps you understand the Lua basics better in a form of another tutorial.
    Help dropdown menu of Scripting Studio also leads you to this linked tutorial, anyway.

Last edited by AkyV; 29-07-24 at 18:39.
AkyV is online now  
Old 27-07-24, 12:32   #2
AkyV
Moderator
 
Joined: Dec 2011
Posts: 5,074
Default

In the "new level" tutorial (linked in the previous post) you could already get to know of Scripting Studio of TIDE, the script files with LUA extension, and the File Explorer of Scripting Studio, where the LUA files are listed, to be selected and opened in Scripting Studio.
File Explorer shows the LUA files in Scripts folder and its Levels subfolder. This folder structure is available in the Engine folder of the main project folder.
  • Script files available directly in Scripts folder:

    • Gameflow.lua: this contains the level blocks for each level of the project. Unlike the very detailed contents of TRNG level blocks, TEN ones are used only for some general information of a level.
      Besides, this file also defines some general settings of the game, like eg. the maximum number of secrets.
      So you will edit this file only:

      • If you add a new level to your project, so you need to create that level block with the minimum needful contents. (The TIDE level-adding wizard can help you in this, but you can add the contents even manually.)
        And of course perhaps you want to change these contents later. (Which probably includes adding some further needful contents, though. - I mean, see eg. inventory item data.)
      • The game runs nicely with these default settings, but feel free to change them if you don't like them.

    • Settings.lua: you will mostly use this file if you want to do some customizations on Lara's animations.
    • Strings.lua: here you can define some texts you will see in the game: the item names of the inventory and the level names.
      So you will edit this file when you want to add names to new inventory items or new levels - or naturally when you want to change these names.
    • SystemStrings.lua: here you can define some texts you will see in the game: menu commands (like eg. "Save Game") and such.
      Probably these texts are mostly fine to you, so you will not really change the contents of this file - but naturally you can.

  • Script files available in Levels subfolder:
    Each level has its own script file here. Title.lua naturally initially exists because it is the own script file of the title level.
    Other files will be automatically created for the "real" levels - or if you do not create a PRJ2 with the TIDE wizard, then a LUA file like that could be even manually created in TIDE. Eg. the script file for Test1.ten level file will probably be Test1.lua - however, the name should be the key name of the level, which is set in Gameflow.lua.
    Level script files are the main places to write your script for the game. Which means that every scripting which is not placed in the files I mentioned just above should be placed in the level script files:

    • Events could be scripted here for local or global event sets. These events are formed as functions, which you need to add to the local (volume)/global event set editor in TE.
    • Some global events written here don't need to be added to the global event set editor. These functions will be controlled directly from here, this script file.

    See very simple examples for these two types of event scripting in the "Game command types" tutorial I linked in the first post.
    Naturally if you type a function in a level script file, that function will be available only for that level.
  • File Explorer won't show the other subfolder of Scripts folder, which is named "Engine".
    It is because the script files in this subfolder shouldn't be changed by level builders ever (but you can open them by Notepad, to see their contents):

    • Script files available directly in Engine subfolder:

      • EventSequence.lua: eventsequences are like TRNG Organizers. I.e. they will link events to each other, with some time gaps between them. This file is a little tutorial for them.
      • Timer.lua: different timers are available even by nodes, but you can make even really unique custom timers by scripting. This file is a little tutorial for scripted timers.
      • Util.lua: you could ignore it.

    • Script files available in Engine\NodeCatalogs sub-subfolder:
      All of these files are data bases for nodes.
----------

Notes:
  • In the linked "Nodes" tutorial I tell when you are ready to add a node to an event set. These are also the proper conditions to be ready to add a scripted event (i.e. a function) to an event set.
  • It seems that you can do language settings for strings, in string LUA files. But, as far as I know, language settings are not implemented yet into TEN.

Last edited by AkyV; 30-07-24 at 06:07.
AkyV is online now  
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 16:45.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Tomb Raider Forums is not owned or operated by CDE Entertainment Ltd.
Lara Croft and Tomb Raider are trademarks of CDE Entertainment Ltd.