Sid Meier's Civilization VI

Sid Meier's Civilization VI

Better Tech Tree (UI)
 Denne tråd er blevet fastgjort, så den er sikkert vigtig
infixo  [udvikler] 18. mar. 2019 kl. 11:07
Please report issues here.
The thread to report issues.
< >
Viser 1-15 af 29 kommentarer
sdgabai 26. juni 2019 kl. 20:40 
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  [udvikler] 26. juni 2019 kl. 23:47 
Row.PrereqTech refers to Resource_Harvests table. If it is nil, then this table somehow got messed up.
infixo  [udvikler] 26. juni 2019 kl. 23:49 
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. juni 2019 kl. 5:57 
I think I still have the save file. I'll re-enable the mod and check it.
Sidst redigeret af sdgabai; 27. juni 2019 kl. 5:58
sdgabai 27. juni 2019 kl. 6:58 
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.
Sidst redigeret af sdgabai; 27. juni 2019 kl. 7:01
sdgabai 27. juni 2019 kl. 7:14 
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
Sidst redigeret af sdgabai; 27. juni 2019 kl. 7:27
sdgabai 27. juni 2019 kl. 7:17 
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.
Sidst redigeret af sdgabai; 27. juni 2019 kl. 7:31
sdgabai 27. juni 2019 kl. 7:39 
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.
Sidst redigeret af sdgabai; 27. juni 2019 kl. 7:49
infixo  [udvikler] 27. juni 2019 kl. 9:01 
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. juni 2019 kl. 9:27 
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  [udvikler] 27. juni 2019 kl. 10:34 
So... how come you have nils everywhere?
sdgabai 27. juni 2019 kl. 11:50 
print("resource=", row.ResourceType, "yield=", row.YieldType, "PrereqTech=", row.PrereqTech);
sdgabai 27. juni 2019 kl. 12:04 
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  [udvikler] 27. juni 2019 kl. 14:10 
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 kl. 16:28 
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.
< >
Viser 1-15 af 29 kommentarer
Per side: 1530 50