安装 Steam
登录
|
语言
繁體中文(繁体中文)
日本語(日语)
한국어(韩语)
ไทย(泰语)
български(保加利亚语)
Čeština(捷克语)
Dansk(丹麦语)
Deutsch(德语)
English(英语)
Español-España(西班牙语 - 西班牙)
Español - Latinoamérica(西班牙语 - 拉丁美洲)
Ελληνικά(希腊语)
Français(法语)
Italiano(意大利语)
Bahasa Indonesia(印度尼西亚语)
Magyar(匈牙利语)
Nederlands(荷兰语)
Norsk(挪威语)
Polski(波兰语)
Português(葡萄牙语 - 葡萄牙)
Português-Brasil(葡萄牙语 - 巴西)
Română(罗马尼亚语)
Русский(俄语)
Suomi(芬兰语)
Svenska(瑞典语)
Türkçe(土耳其语)
Tiếng Việt(越南语)
Українська(乌克兰语)
报告翻译问题
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?
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.
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
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.
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.
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
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.
It also break another mod, I can't remember the name, one that shows all the civs figures above.