Firebug
Not-so Great Engineer
This is what i'm attempting to make.
Each We Love the King Day decreases
Unhappiness from number of cities by 15%
Logs aren't showing any errors, the dummy building does work (i was able to spawn it in using ingame editor), but yet triggering a WLTKD doesn't spawn the dummy building.
I've used other mod's WLTKD scripts as reference to what should be done, and i came up with this.
but it doesn't work. Where did i go wrong?
Each We Love the King Day decreases

Logs aren't showing any errors, the dummy building does work (i was able to spawn it in using ingame editor), but yet triggering a WLTKD doesn't spawn the dummy building.
I've used other mod's WLTKD scripts as reference to what should be done, and i came up with this.
Code:
function BulgariaTrait(playerID)
print("Bulgaria function is running")
local player = Players[playerID]
if player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_BULGARIA"] and player:IsAlive() then
for city in player:Cities() do
if (pCity:GetWeLoveTheKingDayCounter() > 0) then
if (not city:IsHasBuilding(GameInfoTypes["BUILDING_TRAIT_UNHAPPINESS"]) > 0) then
city:SetNumRealBuilding(GameInfoTypes["BUILDING_TRAIT_UNHAPPINESS"], 1);
end
else
if city:IsHasBuilding(GameInfoTyupes["BUILDING_TRAIT_UNHAPPINESS"]) > 0) then
city:SetNumRealBuilding(GameInfoTypes["BUILDING_TRAIT_UNHAPPINESS"], 0);
end
end
end
end
end
GameEvents.PlayerDoTurn.Add(BulgariaTrait)
print("my lua loaded to the end")
but it doesn't work. Where did i go wrong?