Countbuffalo
Chieftain
- Joined
- Aug 16, 2013
- Messages
- 94
Hi all, in one of my mods I wanted to add some bonuses normally only obtained from policies to a building, so I went about writing the Lua for it. Whilst the Lua itself works fine, there's an issue where players in the industrial era will see their social policies become ridiculously cheap.
I believe it is to do with how I've given the player their policy. Is it necessary to set them a free policy if I'm forcing the policy with Lua?
What happens however it seems that once the player has the building the free policy keeps repeating over and over again because it's a Turn Function. How would I go about closing the code once the player has the building so the effect only happens once?
Cheers
I believe it is to do with how I've given the player their policy. Is it necessary to set them a free policy if I'm forcing the policy with Lua?
Code:
function WashorsehockeyurnFunction(iPlayer)
local pPlayer = Players[iPlayer]
if pPlayer:GetCivilizationType() == iWasshi then
for pCity in pPlayer:Cities() do
if (pCity:GetNumBuilding(iSeto) > 0) then
pPlayer:SetNumFreePolicies(1)
pPlayer:SetNumFreePolicies(0)
pPlayer:SetHasPolicy(iSciencePolicy, true)
end
end
end
end
GameEvents.PlayerDoTurn.Add(WashorsehockeyurnFunction)
What happens however it seems that once the player has the building the free policy keeps repeating over and over again because it's a Turn Function. How would I go about closing the code once the player has the building so the effect only happens once?
Cheers