Thanks for the new version, TNO, this sounds very promising! It seems that the movementMultipliers table is initially empty though. Is this a foundational piece, that you're intending to fill out with appropriate keys/values in a later TOTPP release? Or is this something that's fully ready for use by scenario developers, we just need to populate it? (If the latter, I'm not quite understanding what keys are valid to use here.)
I've recently found a few other anomalies in trying out various aspects of Lua and TOTPP, and I wondered if you (or perhaps someone else in the community) could help me out:
1) For organizational purposes, I tried splitting some Lua functions out into a second .lua file, located in the same scenario directory as events.lua, which I would "require" from the main events file. However, this returns the following:
Code:
C:\Games\Civ2ToT\TestScen\events.lua:62: module 'events2' not found:
no field package.preload['events2']
no file 'C:\Games\Civ2ToT\lua\events2.lua'
no file 'C:\Games\Civ2ToT\lua\events2\init.lua'
no file 'C:\Games\Civ2ToT\events2.lua'
no file 'C:\Games\Civ2ToT\events2\init.lua'
no file 'C:\Games\Civ2ToT\..\share\lua\5.3\events2.lua'
no file 'C:\Games\Civ2ToT\..\share\lua\5.3\events2\init.lua'
no file '.\events2.lua'
no file '.\events2\init.lua'
no file 'C:\Games\Civ2ToT\events2.dll'
no file 'C:\Games\Civ2ToT\..\lib\lua\5.3\events2.dll'
no file 'C:\Games\Civ2ToT\loadall.dll'
no file '.\events2.dll'
I would have thought that '.' would be my scenario directory and '.\events2.lua' would succeed, but apparently not. It finds my events2.lua file just fine if I move it to one of the locations listed above with a fully qualified path. For the sake of distributing a scenario, though, it seems highly advisable to keep all events files in the scenario subdirectory if possible. Any thoughts?
2) The new "onCityFounded" trigger works very well, except that in my testing it fires as soon as I give the command to build a city (i.e., as soon as I hit 'b'), while the "What Shall We Name This City?" dialog is still up on the screen. The city object received by the trigger contains the city's name as if that was finalized, but in fact I can change it in that dialog box. In fact, I can actually click "Exit" and undo the entire build, so that a city is
not founded and my Settler unit still exists and is active. Would it be possible to delay the trigger so that it fires immediately
after you click OK in that dialog box?
3) I've encountered a few issues with Lua returning negative values that seem unexpected. Specifically, in at least a couple places, some things return -128 instead of +128, which seems like a situation involving signed/unsigned bytes. One example is tile.terrainType: this normally returns 0 through 15, unless the tile has a river. The river seems to
subtract 128 from the normal value -- so a Grassland tile is "2" but a Grassland with a river is "-126". Another example is tile.improvements, where I think pollution (0x80 bitmask value) returns "-128". Is this working as intended? Is trial and error the best approach to see what is returned in similar cases, or is there a more general/consistent rule?
As always, thanks for the great work and for any further help you can provide.