bane_
Howardianism High-Priest
- Joined
- Nov 27, 2013
- Messages
- 1,559
I'm having an issue with this code:
It is supposed to retrieve all buildings that produce Faith and insert them into a table, but I get a total of 142 buildings added. I tried adding ", Yield > 1}" to the end of line #5, but it breaks when the Yield is null.
Also, on another note. GameEvents.CityConstructed() doesn't seem to be working for me, it doesn't fire at all and the game is updated.
Code:
function PopulateRelBuildingsTb()
for row in GameInfo.Buildings() do
local iBuildingType = GameInfo.Buildings[row.Type].ID
local pBuildingType = GameInfo.Buildings[row.Type].Type
if GameInfo.Building_ResourceYieldChanges{BuildingType = pBuildingType, YieldType = "YIELD_FAITH"} then
table.insert(RelBuildingsTb, iBuildingType)
end
end
for i, v in pairs(RelBuildingsTb) do
print("[PopulateRelBuildingsTb] " ..i, v)
end
end
It is supposed to retrieve all buildings that produce Faith and insert them into a table, but I get a total of 142 buildings added. I tried adding ", Yield > 1}" to the end of line #5, but it breaks when the Yield is null.
Also, on another note. GameEvents.CityConstructed() doesn't seem to be working for me, it doesn't fire at all and the game is updated.