The crash:
Code: Select all
[02:05:40][10472]game/game_events.lua:16782(global AustriaDead) game/game_events.lua:16782: attempt to perform arithmetic on field 'artillery' (a nil value)
Code: Select all
function AustriaDead()
local austria = game:GetFactionById(3)
local italy = game:GetFactionById(8)
local russia = game:GetFactionById(4)
if GetEvent("AustriaDead") == 0 then
local dead = austria.luaData.statsCasualties["ground"] + austria.luaData.statsCasualties["naval"] + austria.luaData.statsCasualties["air"] + austria.luaData.statsCasualties["artillery"] + austria.luaData.statsCasualties["armour"]
if dead > 8000
and austria.alliance.id == 2 then
SetEvent("AustriaDead", game.turn)
if austria.morale > 100 then
local value = austria.morale - 100
austria.morale = austria.morale - value
end
austria.luaData.collaps = austria.luaData.collaps +3
ui.resourcesPanel:Refresh()
end
end
end