Closed veden closed 8 years ago
nice, thanks for the bug report! I will fix it in 0.2.1. The function "handleForceCreated" needs to check all global tables exist prior to attempting to add/index them with force names.
A fix (if you want it for now) is to replace handleForceCreated function with:
function handleForceCreated(event)
local force = event.force
LOGGER.log(string.format("New force detected... %s",force.name) )
global.DroidAssemblers = global.DroidAssemblers or {}
global.DroidAssemblers[force.name] = global.DroidAssemblers[force.name] or {}
global.Squads = global.Squads or {}
global.Squads[force.name] = global.Squads[force.name] or {}
global.uniqueSquadId = global.uniqueSquadId or {}
global.uniqueSquadId[force.name] = global.uniqueSquadId[force.name] or 1
global.lootChests = global.lootChests or {}
global.lootChests[force.name] = global.lootChests[force.name] or {}
global.droidCounters = global.droidCounters or {}
global.droidCounters[force.name] = global.droidCounters[force.name] or {}
global.droidGuardStations = global.droidGuardStations or {}
global.droidGuardStations[force.name] = global.droidGuardStations[force.name] or {}
force.set_cease_fire(force, true) --set ceasefire on your own force. maybe this will prevent friendlyfire stuff?
LOGGER.log("New force handler finished...")
end
Works, thanks for the quick response
This indicates that the global table was not being initialized to = {} elsewhere in the migration/init code so I will need to fix that source of the error as well.
I have a save that was using the older version, after upgrading though anytime I try to add a force to the game line 53 throws attempt to index field 'droidGuardStations' (a nil value).
After placing a guard station it works fine.
line 130 looks like it is missing a guard station initialization.