Craig_Sutter
Deity
This portion of my code is not longer working with BNW. It worked with G & K. It gives golden age bonuses based upon influence with a particular city state.
I remember reading that ChangeGoldenAgeTurns() has been removed with BNW but my search failed to find the relevant entry.
Can anyone tell me which of the functions I'm using has been altered or removed? And if so, are there BNW equivalents I can use to rework this function?
I remember reading that ChangeGoldenAgeTurns() has been removed with BNW but my search failed to find the relevant entry.
Can anyone tell me which of the functions I'm using has been altered or removed? And if so, are there BNW equivalents I can use to rework this function?
Code:
local modData = Modding.OpenSaveData()
local modGoldenAgeKey = "GoldenAge"
local haveGoldenAge = (modData.GetValue(modGoldenAgeKey) == 1)
-- Sets up Free Imperial Cities and Holy Roman Empire
-- Determines if FIC is alive
-- Determine bonus level based on alliance status: friend or ally
-- no Golden Age adds bonus to progress and sets mod data to false
-- if Golden Age sets mod data to true and increases Golden Age length
function HREGoldenAges()
local FIC
local iFIC
local HRE
local iHRE
-- find FIC
for iPlayer=GameDefines.MAX_MAJOR_CIVS, GameDefines.MAX_CIV_PLAYERS-1, 1 do
local pFIC = Players[iPlayer]
if (GameInfo.MinorCivilizations.MINOR_CIV_FREE_IMPERIAL_CITIES.ID == pFIC:GetMinorCivType()) then
FIC = pFIC
iFIC = iPlayer
end
end
--Set up HRE
for iPlayer=0, GameDefines.MAX_MAJOR_CIVS-1 do
local pHRE = Players[iPlayer]
if (GameInfo.Civilizations.CIVILIZATION_PERSIA.ID == pHRE:GetCivilizationType()) then
HRE = pHRE
iHRE = iPlayer
end
end
-- Set up bonus
if ( FIC:IsAlive () ) then
if not FIC:IsFriends( iHRE ) and not FIC:IsAllies( iHRE ) then -- at neutral level
local CityBonus = FIC:GetNumCities()
local Bonus = math.ceil(CityBonus/4)
local GoldenAgeProgressBonus = Bonus + (HRE:GetCurrentEra() * Bonus )
local IsGoldenAge = HRE:IsGoldenAge()
if not IsGoldenAge then
HRE:ChangeGoldenAgeProgressMeter( GoldenAgeProgressBonus )
haveGoldenAge = false
modData.SetValue(modGoldenAgeKey, 1)
print (HRE:GetName() ,"is getting",GoldenAgeProgressBonus, "points towards a Golden Age from relations with", FIC:GetName());
elseif IsGoldenAge then
if (haveGoldenAge == false) then
HRE:ChangeGoldenAgeTurns( math.ceil(Bonus/3) )
haveGoldenAge = true
modData.SetValue(modGoldenAgeKey, 1)
print (HRE:GetName() ,"has increased Golden Age by",Bonus,"turns due to friendship with", FIC:GetName());
end
end
elseif FIC:IsFriends( iHRE ) and not FIC:IsAllies( iHRE ) then -- at FRIENDS level
local CityBonus = FIC:GetNumCities()
local Bonus = math.ceil(CityBonus/3)
local GoldenAgeProgressBonus = Bonus + (HRE:GetCurrentEra() * Bonus )
local IsGoldenAge = HRE:IsGoldenAge()
if not IsGoldenAge then
HRE:ChangeGoldenAgeProgressMeter( GoldenAgeProgressBonus )
haveGoldenAge = false
modData.SetValue(modGoldenAgeKey, 1)
print (HRE:GetName() ,"is getting",GoldenAgeProgressBonus, "points towards a Golden Age from friendship with", FIC:GetName());
elseif IsGoldenAge then
if (haveGoldenAge == false) then
HRE:ChangeGoldenAgeTurns( math.ceil(Bonus/2) )
haveGoldenAge = true
modData.SetValue(modGoldenAgeKey, 1)
print (HRE:GetName() ,"has increased Golden Age by",Bonus,"turns due to friendship with", FIC:GetName());
end
end
elseif FIC:IsAllies( iHRE ) then
local CityBonus = FIC:GetNumCities()
local Bonus = math.ceil(CityBonus/2)
local GoldenAgeProgressBonus = Bonus + (HRE:GetCurrentEra() * Bonus )
local IsGoldenAge = HRE:IsGoldenAge()
if not IsGoldenAge then
HRE:ChangeGoldenAgeProgressMeter( GoldenAgeProgressBonus )
haveGoldenAge = false
modData.SetValue(modGoldenAgeKey, 1)
print (HRE:GetName() ,"is getting",GoldenAgeProgressBonus, "points towards a Golden Age from alliance with", FIC:GetName());
elseif IsGoldenAge then
if (haveGoldenAge == false) then
HRE:ChangeGoldenAgeTurns( Bonus )
haveGoldenAge = true
modData.SetValue(modGoldenAgeKey, 1)
print (HRE:GetName() ,"has increased Golden Age by ",Bonus, "turns due to alliance with", FIC:GetName());
end
end
end
end
end
Events.ActivePlayerTurnEnd.Add( HREGoldenAges )