Connecting a yeild to a civ or civs

Hambil

Emperor
Joined
Oct 16, 2006
Messages
1,100
In the tech tree they use the Yields table. It contains everything the tech tree needs.
Code:
for row in GameInfo.Improvement_TechYieldChanges(condition) do
However, it displays in the tech tree things like "Increases gold from Moais." which is civ (or civ trait in some cases?) specific and I want to make it not show if you aren't a civ that can use it.

My question is, how the heck do I tie these yields to a Civ or trait?
 
Join Improvement_TechYieldChanges.ImprovementType to Improvements.Type and then use any associated Improvements.CivilizationType to get Civilizations.ID (via GameInfoTypes or a table join) and then compare that to pPlayer:GetCivilizationType()
 
You would not believe how long it took me to work out what Improvements.CivilizationType did. Why Firaxis couldn't just go with Civiliziation_ImprovementOverride to keep with units and buildings is beyond me.
 
It doesn't help that the only way to even know there is an Improvements.CivilizationType is to use SqliteSpy, since it's not listed in any documentation.

Neat, and another step forward. I figured out how to use that query syntax I've seen here and about, instead of falling back on my old skills and going straight to the DB.

Code:
local query = "Type = '" .. row.ImprovementType .. "' and CivilizationType = '" .. Game.GetActiveCivilizationType() .. "'"
for civ in GameInfo.Improvements(query) do

Another small victory! Except it doesn't work - yet. Hmmmmm.....
 
You're looking in Civ5DebugDatabase and not Civ5CoreDatabase?
 
It doesn't help that the only way to even know there is an Improvements.CivilizationType is to use SqliteSpy, since it's not listed in any documentation.

Neat, and another step forward. I figured out how to use that query syntax I've seen here and about, instead of falling back on my old skills and going straight to the DB.

Code:
local query = "Type = '" .. row.ImprovementType .. "' and CivilizationType = '" .. Game.GetActiveCivilizationType() .. "'"
for civ in GameInfo.Improvements(query) do

Another small victory! Except it doesn't work - yet. Hmmmmm.....

GetActiveCivilizationType() returns Civilizations.ID not Civilizations.Type (like all of the GetXyzType() methods on the Lua objects)

Also, why bother with a query at all? row.ImprovementType within Improvements will always be unique so GameInfoTypes[GameInfo.Improvements[row.ImprovementType].CivilizationType] == Game.GetActiveCivilizationType() pretty much does it
 
Back
Top Bottom