Displaying new yields

Gherrick

Chieftain
Joined
Dec 3, 2016
Messages
1
I'm working on a mod that includes new yield types. The new yields are added to the database, but I don't know how to have them display in the UI. As a test, I added the new yields to the palace building, but it doesn't show up in the overview panel. I found the <Stack ID="BuildingAndDistrictsStack" ...> tag in CityPanelOverview.xml (I'm using the CQUI mod, which is awesome btw), but it looks like it might be assembled via Lua.

I think I found the relevant lua code in CityPanelOverview.lua (243):
local yieldString:string = "";
for _,kYield in ipairs(building.Yields) do
yieldString = yieldString .. GetYieldString(kYield.YieldType,kYield.YieldChange);​
end
kInstanceBuild.BuildingYield:SetText( yieldString );​
For some reason, it isn't displaying the new yields, although I see the rows in the database. Is there another table I need to adjust besides Building_YieldChanges?

Any assistance would be appreciated.

Edit: It seems there is a bit of hard-codedness going on regarding yields. I'm finding a bit of code scattered around that uses variables for each yield type, and that implies I may need to touch each of those files...sigh. Also, there are a lot of references to YieldTypes.X, but I can't find where the YieldTypes variable is defined. Is this hard-coded somewhere in the engine?
 
Last edited:
I have not created a new yield yet myself but I think you need a record for each new yield in the Yields table, and also in the Types table.
 
If Civ6 works like CivBE then it's not just displaying stuff in the UI that's your problem. The various gameplay functions which calculate the player's income (like pCity:GetYield() )will also be hardcoded to work for just the six default YieldTypes, and will ignore any extra entries in the Yields table. And since those functions are in the dll we can't mod them.

For my Affinity As Yields mod in BE I had to write my own lua script to run every turn, count how many of each type of building the player owned, and total up their "new yield" income accordingly (and implement it's effects). Then I fudged the UI for various panels and tooltips to display the total from that function alongside actual yields.

Feel free to borrow from my code if that's useful to you, link is in my sig.
 
Back
Top Bottom