I applied your fix and now my code looks like this
Code:
print ("Strength of Unity")
local StrengthofUnity = GameInfoTypes["PROMOTION_STRENGTH_OF_UNITY"]
function StrengthofUnityCalc(playerID)
local pPlayer = Players[playerID];
print (pPlayer)
if (pPlayer:IsAlive() and (not pPlayer:IsMinorCiv()) and (not pPlayer:IsBarbarian())) then
for pUnit in pPlayer:Units() do
if pUnit:IsHasPromotion(StrengthofUnity) then
local iBaseStrength = pUnit:GetBaseCombatStrength();
local GlobalHappiness = math.floor(pPlayer:GetHappiness() / 2);
print (GlobalHappiness)
if (GlobalHappiness > 0) then
iDeltaS = GlobalHappiness;
end
print("Strength of Unity: " .. iDeltaS)
pUnit:SetBaseCombatStrength(iBaseStrength + iDeltaS)
end
end
end
end
GameEvents.PlayerDoTurn.Add(StrengthOfUnityCalc)
When I go into the game the UU still doesn't work and I found it odd the log wasn't displaying anything, so I checked for my print functions in FireTuner and only the one outside the loop worked.
(I just copy+pasted the results from my and took out MapGen)
[6094.171] CivilopediaScreen: SetSelectedCategory(12)
[6094.171] CivilopediaScreen: CivilopediaCategory[CategoryTerrain].DisplayList
[6094.203] CivilopediaScreen: SetSelectedCategory(1)
[6094.203] CivilopediaScreen: CivilopediaCategory[CategoryHomePage].DisplayList
[6094.921] Tutorial: Loaded Additional Tutorial checks - Assets\DLC\Expansion2\Tutorial\Lua\TutorialInclude_Expansion2.lua
[6094.921] Tutorial: Loaded Additional Tutorial checks - Assets\DLC\Expansion\Tutorial\lua\TutorialInclude_Expansion1.lua
[6096.187] GenericPopup: Loaded Popup - Assets\DLC\Expansion2\UI\InGame\PopupsGeneric\ConfirmImprovementRebuildPopup.lua
[6096.187] GenericPopup: Loaded Popup - Assets\DLC\Expansion2\UI\InGame\PopupsGeneric\DeclareWarMovePopup.lua
[6096.187] GenericPopup: Loaded Popup - Assets\DLC\Expansion2\UI\InGame\PopupsGeneric\PuppetCityPopup.lua
[6096.187] GenericPopup: Loaded Popup - Assets\DLC\Expansion2\UI\InGame\PopupsGeneric\DeclareWarPlunderTradeRoutePopup.lua
[6096.203] GenericPopup: Loaded Popup - Assets\DLC\Expansion2\UI\InGame\PopupsGeneric\DeclareWarRangeStrikePopup.lua
[6096.203] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmImprovementRebuildPopup.lua
[6096.203] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\NetworkKickedPopup.lua
[6096.203] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\CityPlotManagementPopup.lua
[6096.203] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmCommandPopup.lua
[6096.203] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\MinorCivEnterTerritoryPopup.lua
[6096.203] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\LiberateMinorPopup.lua
[6096.203] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ReturnCivilianPopup.lua
[6096.218] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\AnnexCityPopup.lua
[6096.218] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\DeclareWarMovePopup.lua
[6096.218] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\BarbarianRansomPopup.lua
[6096.218] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmGiftPopup.lua
[6096.218] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmCityTaskPopup.lua
[6096.218] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\PuppetCityPopup.lua
[6096.218] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\DeclareWarRangeStrikePopup.lua
[6096.234] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmPolicyBranchPopup.lua
[6096.234] GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\MinorCivGoldPopup.lua
[6096.625] EconomicGeneralInfo: Total Units - 2
[6096.640] EconomicGeneralInfo: Maint Free Units - 0
[6096.640] EconomicGeneralInfo: Paid Units - 2
[6096.656] EconomicGeneralInfo: Total Units - 2
[6096.656] EconomicGeneralInfo: Maint Free Units - 0
[6096.656] EconomicGeneralInfo: Paid Units - 2
[6097.421] ChoosePantheonPopup: -252
[6097.421] ChoosePantheonPopup: 963
[6097.421] ChoosePantheonPopup: 711
[6097.640] ChooseIdeologyPopup: -252
[6097.640] ChooseIdeologyPopup: 963
[6097.640] ChooseIdeologyPopup: 711
[6098.203] PowerOfUnity: Strength of Unity
[6098.562] AdvisorInfoPopup: Closing Advisor Info
[6098.578] Demographics: Dequeuing demographics
[6098.578] Demographics: Dequeuing demographics
[6217.312] InGame: OnInterfaceModeChanged
[6217.312] InGame: oldInterfaceMode: 1
[6217.312] InGame: newInterfaceMode: 0
[6218.171] WorldView: nil
[6218.171] WorldView: function: 14D8A2B0
[6221.093] InGame: OnInterfaceModeChanged
[6221.093] InGame: oldInterfaceMode: 0
[6221.093] InGame: newInterfaceMode: 1
[6236.765] TechPopup: stealingTechTargetPlayerID: -1
[6236.765] TechPopup: iValue: 0
[6241.765] TurnProcessing: Hiding TurnProcessing
Can you please help with the further problem?