Viregel
, The Rt. Hon.
Hey! I have a bunch of Lua here that would be useful to finish. As a rundown, I'm pretty sure the first function is right, need some clarification on the second one (need to half unhappiness in coastal cities, there must be an easier way to do it) and then I have no idea where I'm going with the third one (double gold from trade routes in golden ages). None of it is tested anyway, so I have no clue how much would actually work.
Thank you very much for any help!
Code:
function GE_KalmarGarrisonedBorderExpansion (playerID)
local player = Players[playerID]
for city in player:Cities() do
if city:GetGarrisonedUnit() == GameInfoTypes["UNIT_GE_KALMAR_UNION_BALTIC_WARSHIP"] then
city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_BALTIC_EXPANSION"], 1)
else
if city:IsHasBuilding(GameInfoTypes["BUILDING_GE_BALTIC_EXPANSION"]) then
city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_BALTIC_EXPANSION"], 0)
end
end
end
end
GameEvents.PlayerDoTurn.Add(GE_KalmarGarrisonedBorderExpansion)
function GE_KalmarCoastalUnhappiness (playerID)
local player = Players[playerID]
local CityPopulation = city:GetPopulation/2()
if player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_GE_KALMAR_UNION"] and player:IsEverAlive() then
for city in player:Cities() do
if city:IsCoastal() then
city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_HYGGE"], 2 + CityPopulation)
end
end
end
end
GameEvents.PlayerDoTurn.Add(GE_KalmarGarrisonedBorderExpansion)
function GE_KalmarGoldenAgeTrade (playerID)
local player = Players[playerID]
local TradeGold = player.GetGoldPerTurnFromTradeRoutesTimes100
if player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_GE_KALMAR_UNION"] and player:IsEverAlive() then
if player:IsGoldenAge() then
TradeGold = TradeGold * 2
end
end
end
GameEvents.PlayerDoTurn.Add(GE_KalmarGoldTrade)
Thank you very much for any help!