Jump to content

Recommended Posts

Posted (edited)

this correction will add some defense to me_exportToMiz.lua.

hard to find the issue since the original code is really poor on logs of any sort.

function createTblIds()
    tblGroupIds = {}
    tblUnitIds = {}
    tblGroupNames = {}
    tblUnitNames = {}

    for k,coalition in base.pairs(mission.coalition) do
        for kk,country in base.pairs(coalition.country) do
            for kkk,grType in base.pairs({"helicopter","ship","plane","vehicle","static"}) do
                if country[grType] and country[grType].group then    
                    for _tmp, group in base.pairs(country[grType].group) do
                        if group.groupId ~= nil then
                            tblGroupIds[group.groupId] = group.groupId
                            tblGroupNames[group.name] = group.name
                            for _tmp2, unit in base.pairs(group.units) do
                                tblUnitIds[unit.unitId] = unit.unitId
                                tblUnitNames[unit.name] = unit.name
                            end
                        else
                            log.error("Group missing groupId: " .. group.name)
                        end
                    end            
                end                
            end
        end
    end    
end

on the interesting side, it appears that every unit generated from a late activation template through scripting will trigger the NPE.

again, this used to work fine before the latest "patch".

it's very interesting that the units failing to be saved have all names plane, plane1...planeN, helicopter1...helicopterN and finally vehicle1...vehicleN which are the names of the groups that will be created by the same save feature. seems that the method is trying to save the same units it generates during this scan but those do not have an ID yet.

Edited by leonardo_c
Posted

there's an error also saving destroyed statics, no scripting in this case.

place a static warehouse on the map, destroy it and then save. reproducible every time.

2025-08-16 20:47:24.740 ERROR   LuaGUI (Main): [string "./MissionEditor/modules/me_exportToMiz.lua"]:98: [string "./MissionEditor/modules/me_exportToMiz.lua"]:1939: attempt to index local 'unitDef' (a nil value)

 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...