Welp, so I made a code that took me the whole day (even if it is simple as heck), only to end up with it not working at all even after correcting all syntax errors i could have made.
Oh, by the way here is the online tool I used to find my syntax errors: https://www.tutorialspoint.com/execute_lua_online.php
So what I'm trying to achieve is to get + 2 additional faith per turn every time I unlock a policy. So here is my code:
I Have made "locals" for:
-palace
-testleaderID
and they work fine on other codes i used and i have no errors in the lua.log.
Edit: nevermind for the "neat tool" just realized modbuddy does the same apparently.
Oh, by the way here is the online tool I used to find my syntax errors: https://www.tutorialspoint.com/execute_lua_online.php
So what I'm trying to achieve is to get + 2 additional faith per turn every time I unlock a policy. So here is my code:
Code:
function OnPolicyAdopted(playerID)
local player = Players[playerID]
if player:IsAlive() and player:GetCivilizationType() == testleaderID then
for city in player:Cities() do
if city:IsHasBuilding(palace) then
local numPolicies = Player:GetNumPolicies()
city:SetNumRealBuilding(GameInfoTypes.BUILDING_SMH_DUMMY_FAITHPOLICIES, numPolicies)
end
end
end
end
if isTestLeaderActive then
GameEvents.PlayerAdoptPolicy.Add(OnPolicyAdopted)
end
I Have made "locals" for:
-palace
-testleaderID
and they work fine on other codes i used and i have no errors in the lua.log.
Edit: nevermind for the "neat tool" just realized modbuddy does the same apparently.
Last edited: