[Crash] Crashes strangely. Corrupted?

Level 30
Joined
Jun 11, 2017
Messages
988
Doubt they changed much besides Art related stuff, trying forcing everything back to SD graphics in-game and in the editor.
Thank you @Uncle, but I managed to create an empty map and re-add all content step by step from the crashing map. During adding I checked for save & load and after loading all content new map works fine for now. Probably crashing map was corrupted somehow.
It seems that if you want to continue developing on LUA, you should avoid using libs for now.
 
Level 30
Joined
Jun 11, 2017
Messages
988
And where is that? I can't find it.
Tests1.png
Tests2.png
 
Level 1
Joined
Nov 14, 2024
Messages
1
Hey guys, has anyone figured out what the reference command line for such art portrait could be? For model it's just art, for Portrait I have no clue.

EDIT:
Nvm this is just the portrait for the unit it probably has no relation to SLK files getting messed up :p
 
Last edited:
Level 24
Joined
Jun 26, 2020
Messages
1,928
Ok, at least this script causes the crash, why could it be? Is a bit edited for me system of @Tasyen
Lua:
if Debug then Debug.beginFile("GetMainSelectedUnit") end
OnInit("GetMainSelectedUnit", function ()
    ---Returns the local current main selected unit, using it in a sync gamestate relevant manner breaks the game.
    ---@return unit
    function GetMainSelectedUnitEx()
        return GetMainSelectedUnit(GetSelectedUnitIndex())
    end

    local containerFrame
    local frames = {}
    local group
    local units = {}
    local filter = Filter(function()
        local unit = GetFilterUnit()
        local prio = BlzGetUnitRealField(unit, UNIT_RF_PRIORITY)
        local found = false
        -- compare the current unit with allready found, to place it in the right slot
        for index, value in ipairs(units) do
            -- higher prio than this take it's slot
            if BlzGetUnitRealField(value, UNIT_RF_PRIORITY) < prio then
                table.insert(units, index, unit)
                found = true
                break
            -- equal prio and better colisions Value
            elseif BlzGetUnitRealField(value, UNIT_RF_PRIORITY) == prio and GetUnitOrderValue(value) > GetUnitOrderValue(unit) then
                table.insert( units, index, unit)
                found = true
                break
            end
        end
        -- not found add it at the end
        if not found then
            table.insert(units, unit)
        end

        unit = nil
        return false
    end)

    ---@return integer | nil
    function GetSelectedUnitIndex()
        -- local player is in group selection?
        if BlzFrameIsVisible(containerFrame) then
            -- find the first visible yellow Background Frame
            for int = 0, #frames do
                if BlzFrameIsVisible(frames[int]) then
                    return int
                end
            end
        end

        return nil
    end

    ---@param unit unit
    ---@return integer
    function GetUnitOrderValue(unit)
        --heroes use the handleId
        if IsUnitType(unit, UNIT_TYPE_HERO) then
            return GetHandleId(unit)
        else
            --units use unitCode
            return GetUnitTypeId(unit)
        end
    end

    ---@param index integer | nil
    ---@return unit
    function GetMainSelectedUnit(index)
        if index then
            GroupEnumUnitsSelected(group, GetLocalPlayer(), filter)
            local unit = units[index + 1]
            --clear table
            repeat until not table.remove(units)
            return unit
        else
            GroupEnumUnitsSelected(group, GetLocalPlayer(), nil)
            return FirstOfGroup(group)
        end
    end

    --init
    local console = BlzGetFrameByName("ConsoleUI", 0)
    local bottomUI = BlzFrameGetChild(console, 1)
    local groupframe = BlzFrameGetChild(bottomUI, 5)
    --globals
    containerFrame = BlzFrameGetChild(groupframe, 0)
    group = CreateGroup()
    -- give this frames a handleId
    for int = 0, BlzFrameGetChildrenCount(containerFrame) - 1 do
        local buttonContainer = BlzFrameGetChild(containerFrame, int)
        frames[int] = BlzFrameGetChild(buttonContainer, 0)
    end
end)
if Debug then Debug.endFile() end
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Maybe it's related to the ConsoleUI frame stuff. See this thread:
 
Level 24
Joined
Feb 27, 2019
Messages
833
Tasyen mentioned publishing a fix but the thread was locked. Probably this one?

Anyway he posted the fix on discord #modding
 
Level 30
Joined
Jun 11, 2017
Messages
988
Ok, at least this script causes the crash, why could it be? Is a bit edited for me system of @Tasyen
Lua:
if Debug then Debug.beginFile("GetMainSelectedUnit") end
OnInit("GetMainSelectedUnit", function ()
    ---Returns the local current main selected unit, using it in a sync gamestate relevant manner breaks the game.
    ---@return unit
    function GetMainSelectedUnitEx()
        return GetMainSelectedUnit(GetSelectedUnitIndex())
    end

    local containerFrame
    local frames = {}
    local group
    local units = {}
    local filter = Filter(function()
        local unit = GetFilterUnit()
        local prio = BlzGetUnitRealField(unit, UNIT_RF_PRIORITY)
        local found = false
        -- compare the current unit with allready found, to place it in the right slot
        for index, value in ipairs(units) do
            -- higher prio than this take it's slot
            if BlzGetUnitRealField(value, UNIT_RF_PRIORITY) < prio then
                table.insert(units, index, unit)
                found = true
                break
            -- equal prio and better colisions Value
            elseif BlzGetUnitRealField(value, UNIT_RF_PRIORITY) == prio and GetUnitOrderValue(value) > GetUnitOrderValue(unit) then
                table.insert( units, index, unit)
                found = true
                break
            end
        end
        -- not found add it at the end
        if not found then
            table.insert(units, unit)
        end

        unit = nil
        return false
    end)

    ---@return integer | nil
    function GetSelectedUnitIndex()
        -- local player is in group selection?
        if BlzFrameIsVisible(containerFrame) then
            -- find the first visible yellow Background Frame
            for int = 0, #frames do
                if BlzFrameIsVisible(frames[int]) then
                    return int
                end
            end
        end

        return nil
    end

    ---@param unit unit
    ---@return integer
    function GetUnitOrderValue(unit)
        --heroes use the handleId
        if IsUnitType(unit, UNIT_TYPE_HERO) then
            return GetHandleId(unit)
        else
            --units use unitCode
            return GetUnitTypeId(unit)
        end
    end

    ---@param index integer | nil
    ---@return unit
    function GetMainSelectedUnit(index)
        if index then
            GroupEnumUnitsSelected(group, GetLocalPlayer(), filter)
            local unit = units[index + 1]
            --clear table
            repeat until not table.remove(units)
            return unit
        else
            GroupEnumUnitsSelected(group, GetLocalPlayer(), nil)
            return FirstOfGroup(group)
        end
    end

    --init
    local console = BlzGetFrameByName("ConsoleUI", 0)
    local bottomUI = BlzFrameGetChild(console, 1)
    local groupframe = BlzFrameGetChild(bottomUI, 5)
    --globals
    containerFrame = BlzFrameGetChild(groupframe, 0)
    group = CreateGroup()
    -- give this frames a handleId
    for int = 0, BlzFrameGetChildrenCount(containerFrame) - 1 do
        local buttonContainer = BlzFrameGetChild(containerFrame, int)
        frames[int] = BlzFrameGetChild(buttonContainer, 0)
    end
end)
if Debug then Debug.endFile() end
Yes, people in HIVE discord reported that currently Taysen libs are bugged. I suggest you turn them off and wait for a fix or continue without it.
 
Level 24
Joined
Jun 26, 2020
Messages
1,928
Ok, at least this script causes the crash, why could it be? Is a bit edited for me system of @Tasyen
Lua:
if Debug then Debug.beginFile("GetMainSelectedUnit") end
OnInit("GetMainSelectedUnit", function ()
    ---Returns the local current main selected unit, using it in a sync gamestate relevant manner breaks the game.
    ---@return unit
    function GetMainSelectedUnitEx()
        return GetMainSelectedUnit(GetSelectedUnitIndex())
    end

    local containerFrame
    local frames = {}
    local group
    local units = {}
    local filter = Filter(function()
        local unit = GetFilterUnit()
        local prio = BlzGetUnitRealField(unit, UNIT_RF_PRIORITY)
        local found = false
        -- compare the current unit with allready found, to place it in the right slot
        for index, value in ipairs(units) do
            -- higher prio than this take it's slot
            if BlzGetUnitRealField(value, UNIT_RF_PRIORITY) < prio then
                table.insert(units, index, unit)
                found = true
                break
            -- equal prio and better colisions Value
            elseif BlzGetUnitRealField(value, UNIT_RF_PRIORITY) == prio and GetUnitOrderValue(value) > GetUnitOrderValue(unit) then
                table.insert( units, index, unit)
                found = true
                break
            end
        end
        -- not found add it at the end
        if not found then
            table.insert(units, unit)
        end

        unit = nil
        return false
    end)

    ---@return integer | nil
    function GetSelectedUnitIndex()
        -- local player is in group selection?
        if BlzFrameIsVisible(containerFrame) then
            -- find the first visible yellow Background Frame
            for int = 0, #frames do
                if BlzFrameIsVisible(frames[int]) then
                    return int
                end
            end
        end

        return nil
    end

    ---@param unit unit
    ---@return integer
    function GetUnitOrderValue(unit)
        --heroes use the handleId
        if IsUnitType(unit, UNIT_TYPE_HERO) then
            return GetHandleId(unit)
        else
            --units use unitCode
            return GetUnitTypeId(unit)
        end
    end

    ---@param index integer | nil
    ---@return unit
    function GetMainSelectedUnit(index)
        if index then
            GroupEnumUnitsSelected(group, GetLocalPlayer(), filter)
            local unit = units[index + 1]
            --clear table
            repeat until not table.remove(units)
            return unit
        else
            GroupEnumUnitsSelected(group, GetLocalPlayer(), nil)
            return FirstOfGroup(group)
        end
    end

    --init
    local console = BlzGetFrameByName("ConsoleUI", 0)
    local bottomUI = BlzFrameGetChild(console, 1)
    local groupframe = BlzFrameGetChild(bottomUI, 5)
    --globals
    containerFrame = BlzFrameGetChild(groupframe, 0)
    group = CreateGroup()
    -- give this frames a handleId
    for int = 0, BlzFrameGetChildrenCount(containerFrame) - 1 do
        local buttonContainer = BlzFrameGetChild(containerFrame, int)
        frames[int] = BlzFrameGetChild(buttonContainer, 0)
    end
end)
if Debug then Debug.endFile() end
I can't believe that this was the only reason that my map crashed the game.
 
Top