I don't know whether you saw them or not, TNO (I know you had a lot of posts to sort through upon returning), but I had also made a few more suggestions in two posts lately. For convenience, I've quoted them below:
[...]
These will eventually be possible when Lua has fully replaced the macro language (see below for update). For the first suggestion, simply decrement a counter every turn (civ.scen.onTurn), and when it reaches 0, do a civ.killUnit. For the second, set tribe.name and/or tribe.leader.name when I finish the bindings.
Okay, I set tech 94 to value 0 for tribes 6 and 7. It was already 0 for the other tribes. It seemed to fix the problem. Considering tech 94 was a low priority tech and the main tree doesn't seem to depend on it, I am rather baffled why that tech caused the entire tree to be value 1 for column 0 in advance2 & leaders2 for the last two tribes.
This is how EnableTechnology works, it changes group permissions, not single tech permissions.
Late Edit: Ive noticed a peculiarity. For some new units that use some of the extra slots (80 - 127), they seem to default to a specific sound. Units in slot 105 defaults to the submarine sounds, overriding the custom sound specified for it in rules.txt. There are other affected slots, I think, since I heard an out of place Warriors sound on Mars in my scenario. I my 7z file that I gave to TNO earlier in this thread, slot 105 is taken by "Cloaking Bomber"
I originally thought I had specified too many or too few new units in @COSMIC2, but the sound overrides happen even with the correct numbers.
Will have to look into that.
First time using the patch, and the AI doesn't try to build wonders (possibly other things as well, but I haven't noticed) since I've started using it. Could you let me know what I could do to mitigate this? Thanks!
Just ran a game without a human player for about a hundred turns and the Indians built the Pyramids. So there shouldn't be a problem.
Update on the project/lua integration:
I've implemented most of the existing event triggers, saving/loading of state to/from the saved game is fully implemented and the "civ" library is steadily expanding. I've begun rewriting the Sci-fi scenario in lua, both as a test-case and as an example of lua scenario writing. A little example:
Code:
local state = {shuttleBuilt = false,
[...]
}
local shuttleText = "The newly built Shuttle unit is capable [...]"
local shuttleDiscoveryText = "On a test flight of the new Shuttle, [...]"
civ.scen.onCityProduction(function (city, prod)
if civ.isUnitType(prod) and prod.name == "Shuttle" then
civlua.justOnce(civlua.property(state, "shuttleBuilt"), function ()
civ.ui.text(shuttleText)
civ.giveTech(city.owner, civ.getTech(95), 0)
civ.ui.text(shuttleDiscoveryText)
end)
end
end)
This example registers a callback to the onCityProduction trigger. When anything is built anywhere, this callback is run, with appropriate values for "city" and "prod". Skipping the justOnce wrapper for a sec, we test if "prod" is a unit type, and its name is "Shuttle", if so, we first show a pop-up with text, give technology 95 (Plasma Chamber (X3)) to the city owner, and then show another pop-up.
The justOnce wrapper ensures the callback only runs when "shuttleBuilt" in the state table (at the top) is false, and it ensures it is set to true when finished. The "civlua" library just contains (lua) functions that do not need to be written in C per se, and therefore are not in the "civ" library.
New are the onSave and onLoad triggers, responsible for storing/restoring state to/from the saved game. onSave has to return a string which is written to the saved game, onLoad receives this string and is responsible for restoring the scenario's state:
Code:
civ.scen.onLoad(function (buffer) state = civlua.unserialize(buffer) end)
civ.scen.onSave(function () return civlua.serialize(state) end)
I find that putting all scenario state in a single table (called "state" in my case) allows for very easy serialization using the provided civlua serialize/unserialize functions. The above 2 lines should be fine for use in most scenarios, at least as a default.
Other than that, the "civ" library already contains lots of functions to work with units, cities, tribes, techs, improvements, terrains etc. Too much for me to discuss all of them in this update.
I'll release it in a little while, probably after I've rewritten the Sci-fi scenario and those events are all working as they should.