| Thrawn wrote: |
| Instead, you can create script files with text editors and the "programming" language LUA to do stuff. LUA is easier to learn than C++ so you can do a lot of things easier and quite a lot quicker! |
... Exactly!

And each entity will come with a set of predefined functions that make programming it easy. For example, light entities have functions ("methods" in C++ lingo) like GetColor(), SetColor(), GetRadius(), SetRadius() etc.
Because each entity will also have a unique name in the future (e.g. the "MyLight" entity above), you can "program" the entities in your map in a very convenient manner.
| Quote: |
@ Carsten:
Do I get it right that this LUA script is some sort of predefined light that can be called just by a line of script from another script, like: the map script? |
Yes, that's essentially right.
I should have mentioned right in my first posting above that I will of course provide additional documentation later, complete with examples from introductory to advanced.
Essentially, each entity in a map will (or should) have a unique name. In the above example, I had a light entity of type "PointLightSource" with name "MyLight" somewhere in the test map.
Another entity I had in that map has name "MyLift", of type "mover" and made of a single platform brush.
The C++ game code will provide all sorts of methods for each entity, depending on its type. As written above, there are methods like GetColor(), SetColor(), ... for light entities. For movers, there will be methods like Move(), Rotate(), etc.
You call such methods for example like
Code:
MyLight:SetColor(255, 0, 0); -- Set the light color of "MyLight" to red.
MyLift:Move(direction, duration); -- Move "MyLift" into "direction" over "duration" seconds.
SoldierBarney:Attack(otherEntity); -- ... you get the pattern. ;)
HeavySubwayDoor:Open();
InvisibleWall:Hide();
Moreover, there are additional methods that you can write (provide) yourself, as for example the MyLight:OnTrigger() method above.
Whenever the game code tries to trigger an entity (e.g. because the player walked into a trigger volume), it will look for the OnTrigger() method of the targeted entity, and if found, run it.
The above MyLight:OnTrigger() is quite such an example: If we had a trigger volume whose target was the "MyLight" entity, then whenever something walked into the trigger volume, the OnTrigger() method of the target entity (here "MyLight") would be called.
An alternative (as implemented in my current test map) is to simply call "MyLight:OnTrigger()" straight from a 3D world GUI script. In this case, there is no requirement to name the method "OnTrigger()", it could have been named anything else as well, e.g. MyLight:ToggleLightOnAndOff().
Once a function is called, you can from there of course call any other function that you desired, both those that the C++ game code predefined, those that you provided for yourself, those from the Lua standard libraries, etc.
As soon as the scripting system is reasonably powerful, I'll also augment the existing maps with examples of its use (especially the TechDemo map, but also (some of) the smaller ones), as well as provide related documentation. So when the next version is being released, things should become a lot clearer.
