I want to make a UA that forces the player's unhappiness to 20 unless they capture a city every 30 turns. My problem is that I don't know how to check is pPlayer has captured a city, can you help?
Code:
function Smash(PlayerID)
print("UA")
local pPlayer = Players[playerID]
local Turn = Game.GetGameTurn()
local Capture = false
if (pPlayer:IsAlive() and (not pPlayer:IsMinorCiv()) and (not pPlayer:IsBarbarian())) then
-- Check if a city has been captured by player --
if (Turn == 30 and (not Capture) ) then
pPlayer:SetHappiness(-20)
else
Turn = Turn - pPlayerCity.GetTurnAcquired
Capture = false
end
end
GameEvents.PlayerDoTurn.Add(Smash)