Countbuffalo
Chieftain
- Joined
- Aug 16, 2013
- Messages
- 94
For my Civ I'm writing several pieces of Lua, I've created what I need, though it doesn't seem to work.
This first piece is meant to give +1 happiness from every wheat resource in the player's territory using a dummy building:
If anyone can lend me a hand I'd be grateful, thanks.
This first piece is meant to give +1 happiness from every wheat resource in the player's territory using a dummy building:
Code:
function Happinessfromwheat(iplayer)
local pplayer = Players[player]
if pplayer:IsAlive() and pPlayer:GetCivilizationType() == GameInfoTypes["CIVILIZATION_HERO"] then
for pCity in pPlayer:Cities() do
local NumberCultureBuildings = 0;
for i = 0, pcity:GetNumCityPlots() -1,1 do
local pPlot = Pcity:GetCityIndexPlot(i)
if pPlot:GetOwner() ==player a pPlot:GetResourceType() == GameInfoTypes.RESOURCE_WHEAT then
local NumberCultureBuildings = NumberCultureBuildings + 1
end
pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_UDON"], NumberCultureBuildings)
end
end
If anyone can lend me a hand I'd be grateful, thanks.