Hello,
I am new at modding and I didnt found any lua function that could change the loyalty, I only found some Get.. function but when I try to use Getloyalty and GetCulturalIdentity, it doens't work and in the lua.log I get:
"lua:18: function expected instead of nil stack traceback:"
does that mean that these functions are "nil"?
Or did I mistyped?
the code :
At the end I want to find a function that would change the city loyalty...
(Sorry if my english is bad I am not a native speaker)
Any help is welcome
I am new at modding and I didnt found any lua function that could change the loyalty, I only found some Get.. function but when I try to use Getloyalty and GetCulturalIdentity, it doens't work and in the lua.log I get:
"lua:18: function expected instead of nil stack traceback:"
does that mean that these functions are "nil"?
Or did I mistyped?
the code :
Code:
function GetCitiesLoyalty(player)
local pPlayer = Players[player]
local playerCities = pPlayer:GetCities();
for j, pCity in playerCities:Members() do
if pCity ~= nil then
local currentLoyalty = pCity:GetCulturalIdentity():GetLoyalty() -- line 18 is here
end
end
end
GameEvents.PlayerTurnStarted.Add( GetCitiesLoyalty )
At the end I want to find a function that would change the city loyalty...
(Sorry if my english is bad I am not a native speaker)
Any help is welcome