Code: Select all
[18:38:57][8472]game/game_research.lua:861(global HasUnitTech) game/game_research.lua:861: attempt to index field 'luaData' (a nil value)
[18:38:57][8472]Resume: false, std::exception: 'Lua Error:game/game_research.lua:861(global HasUnitTech) game/game_research.lua:861: attempt to index field 'luaData' (a nil value)'
[18:38:57][8472][C]:-1(global error) ai/ai.lua:0: std::exception: 'Lua Error:game/game_research.lua:861(global HasUnitTech) game/game_research.lua:861: attempt to index field 'luaData' (a nil value)'
Code: Select all
function HasUnitTech(unit, techName)
-- Check if unit has it
i = 1
while unit.luaData.unitTechs[i] ~= nil do -- line 861
-- Check if unit already has tech
if unit.luaData.unitTechs[i] == techName then
return true
end
i = i + 1
end
return false
end