GreatBayethe
Chieftain
- Joined
- Jul 12, 2017
- Messages
- 24
You forgot to hook up a (Game)Event to your function, so it never runs.
Try adding
Code:GameEvents.PlayerDoTurn.Add(JeongJoGyujanggak)
Adding one or more print()'s to the code allows you to spot these kinds of mistakes way easier when you open up the Lua.log.
--
I'm assuming that JeongJoDummy, JeongJoDummy2, and JeongJoDummy3 do not provide tourism as you add multiple copies of those while tourism doesn't stack.
GameEvents.PlayerDoTurn.Add(JeongJoGyujanggak) is Not a problem. My lua code includes it, so never mind it. And I'm sorry that my English is bad, so I ask for understanding on that point.
I'll repeat. I want to get bonuses by the number of policies that I have adopt when Gyujanggak is in the city, and this is the code.
Code:
local JeongJoDummy = GameInfoTypes["BUILDING_JEONGJO_DUMMY"]
local JeongJoDummy2 = GameInfoTypes["BUILDING_JEONGJO_DUMMY2"]
local JeongJoDummy3 = GameInfoTypes["BUILDING_JEONGJO_DUMMY3"]
local JeongJoDummy4 = GameInfoTypes["BUILDING_JEONGJO_DUMMY4"]
local GyujanggakID = GameInfoTypes["BUILDING_GYUJANGGAK"]
function JeongJoGyujanggak(playerID, policyID)
local pPlayer = Players[playerID]
if pPlayer:GetCivilizationType() == JeongJo and pPlayer:IsAlive() then
for pCity in pPlayer:Cities() do
if pCity:IsHasBuilding(GyujanggakID) then
local NumberOfPolicies = pPlayer:GetNumPolicies()
if NumberOfPolicies >= 5 and NumberOfPolicies < 10 then
pCity:SetNumRealBuilding(JeongJoDummy, 1)
end
if NumberOfPolicies >= 10 and NumberOfPolicies < 15 then
pCity:SetNumRealBuilding(JeongJoDummy, 1)
pCity:SetNumRealBuilding(JeongJoDummy2, 1)
end
if NumberOfPolicies >= 15 and NumberOfPolicies < 20 then
pCity:SetNumRealBuilding(JeongJoDummy, 1)
pCity:SetNumRealBuilding(JeongJoDummy2, 2)
end
if NumberOfPolicies >= 20 and NumberOfPolicies < 25 then
pCity:SetNumRealBuilding(JeongJoDummy, 1)
pCity:SetNumRealBuilding(JeongJoDummy2, 2)
pCity:SetNumRealBuilding(JeongJoDummy3, 1)
end
if NumberOfPolicies >= 25 and NumberOfPolicies < 30 then
pCity:SetNumRealBuilding(JeongJoDummy, 2)
pCity:SetNumRealBuilding(JeongJoDummy2, 3)
pCity:SetNumRealBuilding(JeongJoDummy3, 1)
end
if NumberOfPolicies >= 30 and NumberOfPolicies < 40 then
pCity:SetNumRealBuilding(JeongJoDummy, 2)
pCity:SetNumRealBuilding(JeongJoDummy2, 3)
pCity:SetNumRealBuilding(JeongJoDummy3, 1)
pCity:SetNumRealBuilding(JeongJoDummy4, 1)
end
if NumberOfPolicies >= 40 then
pCity:SetNumRealBuilding(JeongJoDummy, 3)
pCity:SetNumRealBuilding(JeongJoDummy2, 4)
pCity:SetNumRealBuilding(JeongJoDummy3, 1)
pCity:SetNumRealBuilding(JeongJoDummy4, 0)
pCity:SetNumRealBuilding(JeongJoDummy5, 1)
end
end
end
end
end
GameEvents.PlayerDoTurn.Add(JeongJoGyujanggak)
※JeongJoDummy produces 5 culture. JeongJoDummy2 do 5 science. JeongJoDummy3 reduce culture requirement of policy. JeongJoDummy4 produce 5 tourism. JeongJoDummy5 do 10 Tourism.
※Bonuses that I get
5 policies or more and less than 10 policies that I have adopt - 5 culture
10 policies or more and less than 15 policies that I have adopt - 5 culture, 5 science
15 policies or more and less than 20 policies that I have adopt - 5 culture, 10 science
20 policies or more and less than 25 policies that I have adopt - 5 culture, 10 science, reduce culture requirement to adopt new policies
25 policies or more and less than 30 policies that I have adopt - 10 culture, 15 science, reduce culture requirement to adopt new policies
30 policies or more and less than 40 policies that I have adopt - 10 culture, 15 science, 5 tourism, reduce culture requirement to adopt new policies
40 policies or more that I have adopt - 15 culture, 20 science, 10 tourism, reduce culture requirement to adopt new policies
When the number of policies is 40 or more, all bonuses are applied well, without tourism. What is the problem?