Sid Meier's Civilization VI

Sid Meier's Civilization VI

Better Tech Tree (UI)
 This topic has been pinned, so it's probably important
infixo  [developer] 18 Mar, 2019 @ 11:07am
Please report issues here.
The thread to report issues.
< >
Showing 1-15 of 29 comments
sdgabai 26 Jun, 2019 @ 8:40pm 
TechTree: Loading TechTree_BTT_XP2.lua from Better Tech Tree version 2.0
TechTree: Loading TechAndCivicSupport_BTT.lua from Better Tech Tree version 2.0
TechTree: Real Eurekas: no
TechTree: OK loaded TechAndCivicSupport_BTT.lua from Better Tech Tree
TechTree: OK Loaded TechTree_BTT_XP2.lua from Better Tech Tree
Runtime Error: …\Steam\steamapps\workshop\content\289070\1337632610\Base\TechAndCivicSupport_BTT.lua:300: table index is nil
stack traceback:
…\Steam\steamapps\workshop\content\289070\1337632610\Base\TechAndCivicSupport_BTT.lua:300: in function 'PopulateHarvests'
…\Steam\steamapps\workshop\content\289070\1337632610\Base\TechAndCivicSupport_BTT.lua:565: in function 'Initialize_BTT_TechTree'
…\Steam\steamapps\workshop\content\289070\1337632610\XP2\TechTree_BTT_XP2.lua:15: in function 'LateInitialize'
…\Steam\steamapps\common\Sid Meier's Civilization VI\Base\Assets\UI\Screens\TechTree.lua:1935: in function 'OnInit'
Lua callstack:
CivicsTree: Loading CivicsTree_BTT_XP2.lua from Better Tech Tree version 2.0
CivicsTree: Loading TechAndCivicSupport_BTT.lua from Better Tech Tree version 2.0
CivicsTree: Real Eurekas: no
CivicsTree: OK loaded TechAndCivicSupport_BTT.lua from Better Tech Tree
CivicsTree: OK Loaded CivicsTree_BTT_XP2.lua from Better Tech Tree
CivicsTree: Extra unlockables found: 114

function PopulateHarvests()
local sTT:string;
local tHarvests:table = {};
-- first, collate harvests of the same resource into 1 string
for row in GameInfo.Resource_Harvests() do
if tHarvests[ row.PrereqTech ] == nil then tHarvests[ row.PrereqTech ] = {}; end -- init a new tech
local tTechHarvests:table = tHarvests[ row.PrereqTech ];
if tTechHarvests[ row.ResourceType ] == nil then
-- init a new resource
tTechHarvests[ row.ResourceType ] = "[ICON_"..row.ResourceType.."] "..LL(GameInfo.Resources[row.ResourceType].Name)..":"; -- don't put resource font icon, modded ones usually don't have it
end
tTechHarvests[ row.ResourceType ] = tTechHarvests[ row.ResourceType ]..string.format(" %+d", row.Amount)..GameInfo.Yields[row.YieldType].IconString;
end
--if sDesc == nil then -- insert name as initial insert
--sDesc = LL("LOC_UNITOPERATION_HARVEST_RESOURCE_DESCRIPTION")..": "..LL(GameInfo.Resources[row.ResourceType].Name); -- don't put resource font icon, modded ones usually don't have it
--end
-- second, add to the proper techs
for tech,harvests in pairs(tHarvests) do
-- create a collated tooltip
local sTT:string = LL("LOC_UNITOPERATION_HARVEST_RESOURCE_DESCRIPTION");
for _,tooltip in pairs(harvests) do sTT = sTT.."[NEWLINE]"..tooltip; end
AddExtraUnlockable(tech, "HARVEST", "BTT_HAMMER", sTT, "WORLD_2");
end
end


Runtime Error: …\Steam\steamapps\workshop\content\289070\1337632610\Base\TechAndCivicSupport_BTT.lua:300: table index is nil
if tHarvests[ row.PrereqTech ] == nil then tHarvests[ row.PrereqTech ] = {}; end -- init a new tech

What should be done, when row.PrereqTech = nil?
infixo  [developer] 26 Jun, 2019 @ 11:47pm 
Row.PrereqTech refers to Resource_Harvests table. If it is nil, then this table somehow got messed up.
infixo  [developer] 26 Jun, 2019 @ 11:49pm 
Either check game files or some other mod breaks it. BTT has not been changed in the last 2 months and it is working fine.
sdgabai 27 Jun, 2019 @ 5:57am 
I think I still have the save file. I'll re-enable the mod and check it.
Last edited by sdgabai; 27 Jun, 2019 @ 5:58am
sdgabai 27 Jun, 2019 @ 6:58am 
The situation is: first turn, Modern era, inland sea map, standard map, multi-player co-op [team 1 = Seondeuk/Suleiman, there are 3 other AI teams of 2]

I did a validate of game files

i've updated my operating system, my firewall, anti-virus, my drivers for everything under the sun, every piece of software on my computer is updated that i could find.

the issue still happens, even when i kick my husband from the game temporarily for testing purposes. and it happens when i disable all of the mods that i've added over month or two. I can continue dumping mods if you insist, I don't see it changing much of the situation.
Last edited by sdgabai; 27 Jun, 2019 @ 7:01am
sdgabai 27 Jun, 2019 @ 7:14am 
Would this work?

function PopulateHarvests()
local sTT:string;
local tHarvests:table = {};
-- first, collate harvests of the same resource into 1 string
for row in GameInfo.Resource_Harvests() do
if row.PrereqTech ~= nil then -- sdgabai suggested line of code here
if tHarvests[ row.PrereqTech ] == nil then tHarvests[ row.PrereqTech ] = {}; end -- init a new tech
local tTechHarvests:table = tHarvests[ row.PrereqTech ];
if tTechHarvests[ row.ResourceType ] == nil then
-- init a new resource
tTechHarvests[ row.ResourceType ] = "[ICON_"..row.ResourceType.."] "..LL(GameInfo.Resources[row.ResourceType].Name)..":"; -- don't put resource font icon, modded ones usually don't have it
end
tTechHarvests[ row.ResourceType ] = tTechHarvests[ row.ResourceType ]..string.format(" %+d", row.Amount)..GameInfo.Yields[row.YieldType].IconString;
end -- if row.PrereqTech ~= nil then -- sdgabai suggested line of code here
end
--if sDesc == nil then -- insert name as initial insert
--sDesc = LL("LOC_UNITOPERATION_HARVEST_RESOURCE_DESCRIPTION")..": "..LL(GameInfo.Resources[row.ResourceType].Name); -- don't put resource font icon, modded ones usually don't have it
--end
-- second, add to the proper techs
for tech,harvests in pairs(tHarvests) do
-- create a collated tooltip
local sTT:string = LL("LOC_UNITOPERATION_HARVEST_RESOURCE_DESCRIPTION");
for _,tooltip in pairs(harvests) do sTT = sTT.."[NEWLINE]"..tooltip; end
AddExtraUnlockable(tech, "HARVEST", "BTT_HAMMER", sTT, "WORLD_2");
end
end
Last edited by sdgabai; 27 Jun, 2019 @ 7:27am
sdgabai 27 Jun, 2019 @ 7:17am 
i wrapped an if then inside the for row loop. i'm not looking for credit. i'm just trying to help. if that would fix the loop, feel free to use it. if you have a better suggestion, even if you don't want to implement it, I would love to hear it. I love discussing coding suggestions.
Last edited by sdgabai; 27 Jun, 2019 @ 7:31am
sdgabai 27 Jun, 2019 @ 7:39am 
I disabled all mods without the code fix above. Still broken.
I applied the code fix above. It works. I added all the mods. It continues to work.
Evidence points to this mod without the code fix being the issue. Sorry.
It very well could be Firaxis June 2019 update.
Last edited by sdgabai; 27 Jun, 2019 @ 7:49am
infixo  [developer] 27 Jun, 2019 @ 9:01am 
Add this line just after the for loop:
print("resource=", row.ResourceType, "yield=", row.YieldType);
It will tell you which resource is causing troubles because I am pretty sure it is a modded one. All resources in the base game have harvests locked behind a tech and row.PrereqTech is never nil.
sdgabai 27 Jun, 2019 @ 9:27am 
TechTree: Loading TechTree_BTT_XP2.lua from Better Tech Tree version 2.0
TechTree: Loading TechAndCivicSupport_BTT.lua from Better Tech Tree version 2.0
TechTree: Real Eurekas: no
TechTree: OK loaded TechAndCivicSupport_BTT.lua from Better Tech Tree
TechTree: OK Loaded TechTree_BTT_XP2.lua from Better Tech Tree
TechTree: resource= RESOURCE_BANANAS yield= YIELD_FOOD PrereqTech= nil
TechTree: resource= RESOURCE_CATTLE yield= YIELD_FOOD PrereqTech= nil
TechTree: resource= RESOURCE_COPPER yield= YIELD_GOLD PrereqTech= nil
TechTree: resource= RESOURCE_CRABS yield= YIELD_GOLD PrereqTech= nil
TechTree: resource= RESOURCE_DEER yield= YIELD_PRODUCTION PrereqTech= nil
TechTree: resource= RESOURCE_FISH yield= YIELD_FOOD PrereqTech= nil
TechTree: resource= RESOURCE_RICE yield= YIELD_FOOD PrereqTech= nil
TechTree: resource= RESOURCE_SHEEP yield= YIELD_FOOD PrereqTech= nil
TechTree: resource= RESOURCE_STONE yield= YIELD_PRODUCTION PrereqTech= nil
TechTree: resource= RESOURCE_WHEAT yield= YIELD_FOOD PrereqTech= nil
TechTree: Extra unlockables found: 116
CivicsTree: Loading CivicsTree_BTT_XP2.lua from Better Tech Tree version 2.0
CivicsTree: Loading TechAndCivicSupport_BTT.lua from Better Tech Tree version 2.0
CivicsTree: Real Eurekas: no
CivicsTree: OK loaded TechAndCivicSupport_BTT.lua from Better Tech Tree
CivicsTree: OK Loaded CivicsTree_BTT_XP2.lua from Better Tech Tree
CivicsTree: Extra unlockables found: 114
infixo  [developer] 27 Jun, 2019 @ 10:34am 
So... how come you have nils everywhere?
sdgabai 27 Jun, 2019 @ 11:50am 
print("resource=", row.ResourceType, "yield=", row.YieldType, "PrereqTech=", row.PrereqTech);
sdgabai 27 Jun, 2019 @ 12:04pm 
Honestly, I'm just trying to help. There seems to be some reluctance in your acceptance of my help; however, I thank you for your willingness to discuss this matter and teaching me some debugging techniques. I really appreciate that. Thank you. It will help me in future endeavors.
infixo  [developer] 27 Jun, 2019 @ 2:10pm 
I appreciate all the help and suggestions.
But it seems that we have a misunderstanding here.
There are 2 things.
1. The error thrown when PrereqTech is nil. Your solution is ofc a good one, no need to discuss it because I would do exactly the same thing. Most likely I will include it in the next update of the mod, if only for the sake of making the code more error-proof.
2. Answer to the question WHY it is nil. Please note that I already pointed out that in the base game these values were NEVER nil. It is clear to me that you have a mod that changes them. And I am not sure if it is by design or by mistake.
p.s 7 Jan, 2020 @ 4:28pm 
I liked the mod, but there were some issues. I can't see the yields in the map anymore. I press "Y" and they don't appear. Removing the mod they appear again.
It also break another mod, I can't remember the name, one that shows all the civs figures above.
< >
Showing 1-15 of 29 comments
Per page: 1530 50