Hi Leugi. I'm playing as Tiwanaku and also have whoward's newest dll mod active.
This mod does enable true religious unit override without the lua hacks you needed to replace the missionary with the Sesqino. Unfortunately as it stands now, there is a conflict that prevents you from buying sesqinos as they don't even appear in the list of purshasable units in city view after you found a religion if both mods are active.
Did you use any hacks besides the lua override script (in order to change the name to sesqino in the city view)? I tried disabling the override script but i still can't buy them. The xml definitions for custom units are similar to what whoward did in his "Clans of Morindim" civilization so i don't really see what's causing the issue.
Edit : Forget this. I found out what was wrong. Sesqino was missing faith cost.
Code:
<GameData>
<Units>
<Row>
<Class>UNITCLASS_MISSIONARY</Class>
<Type>UNIT_KALLAWAYA</Type>
<Cost>-1</Cost>
<FaithCost>200</FaithCost> <!-- This was added for compatibility with whoward dll mod -->
I'm now able to purshase them and with the lua override disabled (i commented it's line in the mod definition file), they still appear as sisqenos and not missionaries. Probably won't hurt if the script is left running so the above would be all that has to be changed to have them compatible with whoward's dll mod.
Bug squashing stage 2
I was wondering why no CS would turn over after being allied and with my religion for a loooong time (everybody is renaissance now) so i fired firetuner (didn't even attempt to make this sound like a joke). After hitting next turn i didn't see any message from the influence script, but got a whole bunch of those
Code:
Runtime Error: E:\Documents\My Games\Sid Meier's Civilization 5\MODS\Tiwanaku Civilization (v 1)\Lua/FreeShrineScript.lua:38: attempt to concatenate local 't' (a nil value)
stack traceback:
E:\Documents\My Games\Sid Meier's Civilization 5\MODS\Tiwanaku Civilization (v 1)\Lua/FreeShrineScript.lua:38: in function <E:\Documents\My Games\Sid Meier's Civilization 5\MODS\Tiwanaku Civilization (v 1)\Lua/FreeShrineScript.lua:33>
And sure enough, line 38 is the only place where you didn't check for t ~= nil. As Murphy would say:
if it can do wrong, it will
I don't really know what those concatenations are doing, but replacing line 38 with
Code:
if t ~= nil then
local iTech = GameInfoTypes["" .. t .. ""]
end
removed the errors. Now i can see the output of the influence script in the console, but i also uncommented the missionary script so i'm not sure what caused the issue. Maybe commenting the line referencing the missionary override script in the modinfo file caused the issue with CS (it's a rather ugly hack) or maybe all those nil errors were related.
Edit 3 :
the revenge of the bug
But then, if i start a new game with the change i suggested, the free shrine is added in cap before i research Pottery, and now i'm lost as this is just a sanity check and shouldn't change the result of the script, just avoid a nil value error...
Now, i really have a hard time understanding someone else's code ...
Edit 3 :
Gotcha (or so i hope)
This one seems to be working correctly, no nil error output and shrine is only added after Pottery is researched.
I simply moved 3 variables definition inside the existing if block (they are not needed anyway if b or t are nil). Also that if block had
t ~=nil rather than
t ~= nil (
without a space), might be why it was evaluated even if t was nil and only the concatenation error prevented the free shrine from being added.
Code:
function TraitFreeBT(iPlayer)
local player = Players[iPlayer];
local numBuilds = GetNumFreeBuildingonTech(player);
local b = GetFreeBuilding(player);
local t = GetFreeBuildingTechPrereq(player);
if b ~= nil and t ~= nil then
local iTech = GameInfoTypes["" .. t .. ""]
local teamID = player:GetTeam();
local pTeam = Teams[teamID];
if numBuilds == -1 then
if (pTeam:IsHasTech(iTech)) then
for pCity in player:Cities() do
print ("Condition 1");
pCity:SetNumRealBuilding(GameInfoTypes["" .. b .. ""], 1)
end
end
elseif (player:GetNumCities() == numBuilds) then
if (pTeam:IsHasTech(iTech)) then
for pCity in player:Cities() do
print ("Condition 2");
pCity:SetNumRealBuilding(GameInfoTypes["" .. b .. ""], 1)
end
end
elseif (player:GetNumCities() < numBuilds) then
if (pTeam:IsHasTech(iTech)) then
for pCity in player:Cities() do
print ("Condition 3");
print (t);
print (iTech);
pCity:SetNumRealBuilding(GameInfoTypes["" .. b .. ""], 1)
GameEvents.PlayerCityFounded.Add(OnCityFoundCheck);
end
end
elseif (player:GetNumCities() > numBuilds) then
if (pTeam:IsHasTech(iTech)) then
for pCity in player:Cities() do
print ("Condition 4");
local i = player:CountNumBuildings(GameInfoTypes["" .. b .. ""])
if i < numBuilds then
pCity:SetNumRealBuilding(GameInfoTypes["" .. b .. ""], 1)
local i = player:CountNumBuildings(GameInfoTypes["" .. b .. ""])
end
end
end
end
end
end