_1. Mod version - 3/14 & 3/28)
_2. Mod list - More Unique Components & Custom civs (namely Macedon)
_3. Error description:
Mod conflict introduced in the last 2 versions. lua no longer loads for multiple mods using the same lua hooks
No errors in logs pertaining to failed file loading, syntax errors, etc. The mods were unchanged from prior versions except for the inclusion of the new -1 flat unhappiness on certain base buildings.
Files pass database validation, but the luas simply don't fire anymore. If I remove 4UC from the modlist the custom civ works fine though.
I have been tampering with dependencies/references, renaming and re-hashing files, but no positive results.
update: tested 17 of the 60 lua codes in 4UC. 5 didn't work. The ones that were broken were not unified by hook, load order, entry point order or anything else. Some code worked that used the same hooks, or did very similar things.
None of these codes have been altered in months, but they just stopped working.
I haven't modified any LUA code to my knowledge. What functions specifically?
So far,
1 CombatEnded() code failed that sets bonus damage on the target based on remaining moves
1 CombatEnded() code failed 1 that converts barbarian units to you and gives you influence for the nearest CS.
1 CombatEnded() code that triggers an eventChoice whenever a unit is killed
1 PlayerDoturn() code that gives influence if the unit begins turn in CS territory
1 PlayerEndTurnCompleted() that gives a promotion to a specific unit class if it is within 2 tiles of a specific unit
The problem is I have found a combatended code that worked as intended, an eventChoice triggered via lua that worked fine, and a PlayerDoTurn() that worked fine. The ones that work and the ones that don't aren't loaded in any order where everything breaks after X line either.
It must have something to do with load order to some extent, however, because if a custom civ references 4UC and loads after it then none of the lua works, but if the custom civ loads before 4UC, the lua works fine.
actually most if not all Lua won't work after 3uc/4uc is loaded.
I edited a custom civ so that it loaded before 4UC and then edited the modinfo so it required 4UC. All lua worked if the mod loaded before 4UC, but non of it worked if it loaded after. Is it possible that anything loading after a lexicographic point could fail?
Do luas get indexed alphabetically after they are loaded? Of the 5 units I tried, the lua鈥檚 filenames all started with P or later.
I'll let @ilteroi chime in, but so far as I know no changes have occurred on the lua or hook front.
I am getting a UI failure, where choices like pantheons and decisions can take forever and just hang. Might have something to do with
"Runtime Error: E:...MODS(6a) Community Balance Overhaul - Compatibility Files (EUI)LUAEUI_core_library.lua:278: attempt to perform arithmetic on local 'r' (a nil value)"
In the seemingly unrelated issue #3901, the conclusion was that the lua hook were overloaded and no longer working properly. Is it possible that the march happiness changes are making VP much more heavier on lua hooks than before, making 3&4UC overload them while it didn't before?
No. The happiness changes actually resulted in less overhead and less redundant code.
Found the problem, I think. It's a lua called "Huey Teocalli" Everything that has a name after that point alphabetically doesn't work. It uses GameEvents.PlayerGoldenAge.Add()
The code adds a dummy building to the city with the HueyTeocalli national wonder on golden age start
When was this code added, and by whom?
It was one of the first things that Blue Ghost coded, around November 2017. The code hasn't been modified since, but we've had some people come to the forums to report it as busted before.
Weird. Is it tied to baktun for maya? Or what? I don't see anything explicitly wrong with the lua hooks in the DLL.
G
It's an aztec national wonder. The wonder grows more powerful every time a golden age is triggered.
``function OnGoldenAgeStartAddYieldsAndXP(iPlayer, bStart, iTurns)
if not bStart then return end
local pPlayer = Players[iPlayer]
if pPlayer:GetCivilizationType() ~= eCivilizationAztec then return end
local iNumberOfHueys = pPlayer:CountNumBuildings(eBuildingHueyTeocalli)
if iNumberOfHueys > 0 then
for city in pPlayer:Cities() do
if city:IsHasBuilding(eBuildingHueyTeocalli) then
local iGoldenAges = city:GetNumRealBuilding(eBuildingDummyForHuey) + 1
if iGoldenAges <= 10 then
city:SetNumRealBuilding(eBuildingDummyForHuey, iGoldenAges)
end
if pPlayer:IsHuman() and pPlayer:IsTurnActive() then
local iCityX, iCityY = city:GetX(), city:GetY()
local sCityName = city:GetName()
pPlayer:AddNotification(NotificationTypes.NOTIFICATION_GOLDEN_AGE_BEGUN_ACTIVE_PLAYER,
'Golden Age has begun. The City of [COLOR_CYAN]'..sCityName..'[ENDCOLOR] received additional bonuses.',
'Golden Age in '..sCityName,
iCityX, iCityY)
end
break
end
end
end
end``
Wow that's some janky-ass code.
Is it? it has to loop through all cities to find the Huey because we didnt lock the wonder to the capital
that's why you loop, I see. Still, there's gotta be a better method for that, no? Instead of dummy buildings? Dummy buildings can add up quickly and slow down the game if you aren't careful.
It's a max of 10 dummies, one every time a new GA starts. They add food, faith and XP in the city.
so what exactly is wrong with that piece of code? looks harmless to me ...
Apparently it鈥檚 not, though.
Most helpful comment
No. The happiness changes actually resulted in less overhead and less redundant code.