Fixed the Lua homepage url in Vol II manual, good catch, thanks again!Zovs wrote: Mon Dec 30, 2024 11:15 am Thanks for the update. Looking forward to the ME patch/upgrade.
From the site I posted a typo in the Volume I guide with regards to linkage to the lua site.
I downloaded the binaires to install lua locally, since lua looks like a neat scripting language to learn.
Do you happen to know what other games might be scripted that use lua?
Interesting concepts.
As for Lua use in games, I found this while writing my previous Scripted AI blog: https://en.wikipedia.org/wiki/Category: ... ideo_games
Of those, I really only knew CMANO had an active Lua community. I finally purchased CMO from the Winter Sales yesterday, but haven't had a chance to install it yet.
Since we're on Middle East forum, I'd suggest start by playing with the existing scenario CSEE Lua files that come with 2.31. There's two scenario sets with accompayning Lua files: the four Sirte scenarios and the five Teaching Set scenarios.
Out of these, Sirte 01 really is the only one with actual Battle plans. Especially Side A, where I tried to find out if it was possible to script a full Air assault in CSEE. It turns out it was. Outside the landing, which takes quite a while under SAI, there's not much after infantry is feet on ground, they basically just attack_strong the selected objectives. That is when playing with Side B against Brits.
When playing as Brits, or Side A, there's things like securing the SAM Radar site allows for earlier reinrorcements and stuff like that.
Most other Lua files are about Scenario Briefings, and reacting on events like losing an HQ that diminishes your supply, etc.
I would perhaps start with one of the Teaching Set scenarios. For instance, try adding an attack against one of the objectives under the proper "Do local units =" blocks (see the Vol II manual).
Here's a quick How-to for that:
- Copy the original Lua file and put it aside as a backup
- Open the Teaching set Lua for editing where it resides, with Notepad++ perhaps, or with any programming editor you like
- Open the same scenario in game engine. If you script Side B Battle plan, save it in first turn under Side A.
- Try a little edit on Lua file, save.
- Go to game, it should have noticed a senario file has saved. Click Yes to allow for reading the files again
- If you made a typo, it will immediately notify you with error message and line number.
- If all good - and you edited Side B in Lua - click Next Turn and see how it plays under the SAI side.
- Make another edit in Lua, save.
- Go back to engine, again in notifies of file change. Do not save (unless you want to), open the scenario again, it opens up on your save point
- Click Next Turn again so see your changes in action.
- And so on. Good luck!
Note, that other types of Lua errors, like errors in logic, or expecting a data variable where one does not exist, cause a Lua error as well, but these are on the fly, not upon scenario load. They will be more difficult to debug, often.
Note also that once the SAI side has thrown even one Lua error message box, it no longer executes the Lua code. You always need to start the scenario again to activate Lua after an error message.