Jump to content

Recommended Posts

Hello. I'm creating a custom character mod for Don't Starve Together based on the official mod template. The mod worked before, but after modifying the character sprites and configuration files, the game stopped loading the world correctly.

The problem is that when the mod is active, the server starts loading normally.

Loading stops before the world appears.

The world selection or world generation screen never appears.

What I changed was:

Replacing the character sprite with a custom visual.

Editing the modmain.lua file.

Editing the scripts/prefabs/explorer.lua file.

Generating .tex and .xml files for the portraits and icons.

What I tried after the error was:
Clearing the mod cache, Replacing the modmain.lua file with corrected versions.

Checking the sprite paths and atlas files,

Rebuilding the .tex and .xml files.

The problem persists even after restoring most files to the original template.

Any help would be appreciated.

modmain code: 

PrefabFiles = {
    "explorador",
    "explorador_none",
}

local GLOBAL = GLOBAL
local Asset = GLOBAL.Asset
local STRINGS = GLOBAL.STRINGS
local require = GLOBAL.require

Assets = {

    -- Save slot
    Asset("IMAGE", "images/saveslot_portraits/explorador.tex"),
    Asset("ATLAS", "images/saveslot_portraits/explorador.xml"),

    -- Select screen
    Asset("IMAGE", "images/selectscreen_portraits/explorador.tex"),
    Asset("ATLAS", "images/selectscreen_portraits/explorador.xml"),
    
    Asset("IMAGE", "images/selectscreen_portraits/explorador_silho.tex"),
    Asset("ATLAS", "images/selectscreen_portraits/explorador_silho.xml"),

    -- Big portrait
    Asset("IMAGE", "bigportraits/explorador.tex"),
    Asset("ATLAS", "bigportraits/explorador.xml"),
    
    -- Map icon
    Asset("IMAGE", "images/map_icons/explorador.tex"),
    Asset("ATLAS", "images/map_icons/explorador.xml"),
    
    -- Avatars
    Asset("IMAGE", "images/avatars/avatar_explorador.tex"),
    Asset("ATLAS", "images/avatars/avatar_explorador.xml"),
    
    Asset("IMAGE", "images/avatars/avatar_ghost_explorador.tex"),
    Asset("ATLAS", "images/avatars/avatar_ghost_explorador.xml"),
    
    Asset("IMAGE", "images/avatars/self_inspect_explorador.tex"),
    Asset("ATLAS", "images/avatars/self_inspect_explorador.xml"),
    
    -- Names
    Asset("IMAGE", "images/names_explorador.tex"),
    Asset("ATLAS", "images/names_explorador.xml"),
    
    Asset("IMAGE", "images/names_gold_explorador.tex"),
    Asset("ATLAS", "images/names_gold_explorador.xml"),
}

GLOBAL.AddMinimapAtlas("images/map_icons/explorador.xml")

-- Character select screen
STRINGS.CHARACTER_TITLES.explorador = "Explorador Preguiçoso"
STRINGS.CHARACTER_NAMES.explorador = "Explorador Preguiçoso"
STRINGS.CHARACTER_DESCRIPTIONS.explorador = "*Adrenalina\n*Mente Aberta\n*Apetite Insaciável"
STRINGS.CHARACTER_QUOTES.explorador = "\"Quote\""
STRINGS.CHARACTER_SURVIVABILITY.explorador = "Baixa"

-- Speech
STRINGS.CHARACTERS.EXPLORADOR = require "speech_explorador"

-- Nome no jogo
STRINGS.NAMES.EXPLORADOR = "Explorador Preguiçoso"
STRINGS.SKIN_NAMES.explorador_none = "Explorador Preguiçoso"

-- Ghost skin
local skin_modes = {
    { 
        type = "ghost_skin",
        anim_bank = "ghost",
        idle_anim = "idle",
        scale = 0.75,
        offset = { 0, -25 }
    },
}

GLOBAL.AddModCharacter("explorador", "MALE", skin_modes)

lua code: 

local MakePlayerCharacter = require "prefabs/player_common"

local assets = {
    Asset("SCRIPT", "scripts/prefabs/player_common.lua"),
}

----------------------------------------------------------
-- STATS
----------------------------------------------------------

TUNING.EXPLORADOR_HEALTH = 100
TUNING.EXPLORADOR_HUNGER = 250
TUNING.EXPLORADOR_SANITY = 90

----------------------------------------------------------
-- PERKS
----------------------------------------------------------

TUNING.EXPLORADOR_SPEED_BOOST = 1.2
TUNING.EXPLORADOR_SPEED_TIME = 5

----------------------------------------------------------
-- STARTING ITEMS
----------------------------------------------------------

TUNING.GAMEMODE_STARTING_ITEMS.DEFAULT.EXPLORADOR = {
    "nightsword",
}

local start_inv = {}
for k, v in pairs(TUNING.GAMEMODE_STARTING_ITEMS) do
    start_inv[string.lower(k)] = v.EXPLORADOR
end

local prefabs = {}

----------------------------------------------------------
-- SPEED BOOST
----------------------------------------------------------

local function RemoveSpeed(inst)
    if inst.components.locomotor then
        inst.components.locomotor:RemoveExternalSpeedMultiplier(inst,"explorador_speed")
    end
end

local function OnHealthDelta(inst,data)
    if data.amount < 0 then
        inst.components.locomotor:SetExternalSpeedMultiplier(
            inst,
            "explorador_speed",
            TUNING.EXPLORADOR_SPEED_BOOST
        )

        inst:DoTaskInTime(TUNING.EXPLORADOR_SPEED_TIME,RemoveSpeed)
    end
end

----------------------------------------------------------
-- GHOST / HUMAN
----------------------------------------------------------

local function onbecamehuman(inst)
end

local function onbecameghost(inst)
end

local function onload(inst)
end

----------------------------------------------------------
-- CLIENT
----------------------------------------------------------

local common_postinit = function(inst)

    inst.MiniMapEntity:SetIcon("explorador.tex")

end

----------------------------------------------------------
-- SERVER
----------------------------------------------------------

local master_postinit = function(inst)

    inst.starting_inventory = start_inv[TheNet:GetServerGameMode()] or start_inv.default

    inst.soundsname = "wilson"

    inst.components.health:SetMaxHealth(TUNING.EXPLORADOR_HEALTH)
    inst.components.hunger:SetMax(TUNING.EXPLORADOR_HUNGER)
    inst.components.sanity:SetMax(TUNING.EXPLORADOR_SANITY)

    inst.components.combat.damagemultiplier = 1.5

    inst:ListenForEvent("healthdelta", OnHealthDelta)

end

return MakePlayerCharacter("explorador", prefabs, assets, common_postinit, master_postinit)

Captura de tela 2026-03-05 191009.png

21_Sem_Titulo_20260115101824.png

On 3/6/2026 at 5:11 AM, Sadloy_1 said:

Hello. I'm creating a custom character mod for Don't Starve Together based on the official mod template. The mod worked before, but after modifying the character sprites and configuration files, the game stopped loading the world correctly.

The problem is that when the mod is active, the server starts loading normally.

Loading stops before the world appears.

The world selection or world generation screen never appears.

What I changed was:

Replacing the character sprite with a custom visual.

Editing the modmain.lua file.

Editing the scripts/prefabs/explorer.lua file.

Generating .tex and .xml files for the portraits and icons.

What I tried after the error was:
Clearing the mod cache, Replacing the modmain.lua file with corrected versions.

Checking the sprite paths and atlas files,

Rebuilding the .tex and .xml files.

The problem persists even after restoring most files to the original template.

Any help would be appreciated.

modmain code: 

PrefabFiles = {
    "explorador",
    "explorador_none",
}

local GLOBAL = GLOBAL
local Asset = GLOBAL.Asset
local STRINGS = GLOBAL.STRINGS
local require = GLOBAL.require

Assets = {

    -- Save slot
    Asset("IMAGE", "images/saveslot_portraits/explorador.tex"),
    Asset("ATLAS", "images/saveslot_portraits/explorador.xml"),

    -- Select screen
    Asset("IMAGE", "images/selectscreen_portraits/explorador.tex"),
    Asset("ATLAS", "images/selectscreen_portraits/explorador.xml"),
    
    Asset("IMAGE", "images/selectscreen_portraits/explorador_silho.tex"),
    Asset("ATLAS", "images/selectscreen_portraits/explorador_silho.xml"),

    -- Big portrait
    Asset("IMAGE", "bigportraits/explorador.tex"),
    Asset("ATLAS", "bigportraits/explorador.xml"),
    
    -- Map icon
    Asset("IMAGE", "images/map_icons/explorador.tex"),
    Asset("ATLAS", "images/map_icons/explorador.xml"),
    
    -- Avatars
    Asset("IMAGE", "images/avatars/avatar_explorador.tex"),
    Asset("ATLAS", "images/avatars/avatar_explorador.xml"),
    
    Asset("IMAGE", "images/avatars/avatar_ghost_explorador.tex"),
    Asset("ATLAS", "images/avatars/avatar_ghost_explorador.xml"),
    
    Asset("IMAGE", "images/avatars/self_inspect_explorador.tex"),
    Asset("ATLAS", "images/avatars/self_inspect_explorador.xml"),
    
    -- Names
    Asset("IMAGE", "images/names_explorador.tex"),
    Asset("ATLAS", "images/names_explorador.xml"),
    
    Asset("IMAGE", "images/names_gold_explorador.tex"),
    Asset("ATLAS", "images/names_gold_explorador.xml"),
}

GLOBAL.AddMinimapAtlas("images/map_icons/explorador.xml")

-- Character select screen
STRINGS.CHARACTER_TITLES.explorador = "Explorador Preguiçoso"
STRINGS.CHARACTER_NAMES.explorador = "Explorador Preguiçoso"
STRINGS.CHARACTER_DESCRIPTIONS.explorador = "*Adrenalina\n*Mente Aberta\n*Apetite Insaciável"
STRINGS.CHARACTER_QUOTES.explorador = "\"Quote\""
STRINGS.CHARACTER_SURVIVABILITY.explorador = "Baixa"

-- Speech
STRINGS.CHARACTERS.EXPLORADOR = require "speech_explorador"

-- Nome no jogo
STRINGS.NAMES.EXPLORADOR = "Explorador Preguiçoso"
STRINGS.SKIN_NAMES.explorador_none = "Explorador Preguiçoso"

-- Ghost skin
local skin_modes = {
    { 
        type = "ghost_skin",
        anim_bank = "ghost",
        idle_anim = "idle",
        scale = 0.75,
        offset = { 0, -25 }
    },
}

GLOBAL.AddModCharacter("explorador", "MALE", skin_modes)

lua code: 

local MakePlayerCharacter = require "prefabs/player_common"

local assets = {
    Asset("SCRIPT", "scripts/prefabs/player_common.lua"),
}

----------------------------------------------------------
-- STATS
----------------------------------------------------------

TUNING.EXPLORADOR_HEALTH = 100
TUNING.EXPLORADOR_HUNGER = 250
TUNING.EXPLORADOR_SANITY = 90

----------------------------------------------------------
-- PERKS
----------------------------------------------------------

TUNING.EXPLORADOR_SPEED_BOOST = 1.2
TUNING.EXPLORADOR_SPEED_TIME = 5

----------------------------------------------------------
-- STARTING ITEMS
----------------------------------------------------------

TUNING.GAMEMODE_STARTING_ITEMS.DEFAULT.EXPLORADOR = {
    "nightsword",
}

local start_inv = {}
for k, v in pairs(TUNING.GAMEMODE_STARTING_ITEMS) do
    start_inv[string.lower(k)] = v.EXPLORADOR
end

local prefabs = {}

----------------------------------------------------------
-- SPEED BOOST
----------------------------------------------------------

local function RemoveSpeed(inst)
    if inst.components.locomotor then
        inst.components.locomotor:RemoveExternalSpeedMultiplier(inst,"explorador_speed")
    end
end

local function OnHealthDelta(inst,data)
    if data.amount < 0 then
        inst.components.locomotor:SetExternalSpeedMultiplier(
            inst,
            "explorador_speed",
            TUNING.EXPLORADOR_SPEED_BOOST
        )

        inst:DoTaskInTime(TUNING.EXPLORADOR_SPEED_TIME,RemoveSpeed)
    end
end

----------------------------------------------------------
-- GHOST / HUMAN
----------------------------------------------------------

local function onbecamehuman(inst)
end

local function onbecameghost(inst)
end

local function onload(inst)
end

----------------------------------------------------------
-- CLIENT
----------------------------------------------------------

local common_postinit = function(inst)

    inst.MiniMapEntity:SetIcon("explorador.tex")

end

----------------------------------------------------------
-- SERVER
----------------------------------------------------------

local master_postinit = function(inst)

    inst.starting_inventory = start_inv[TheNet:GetServerGameMode()] or start_inv.default

    inst.soundsname = "wilson"

    inst.components.health:SetMaxHealth(TUNING.EXPLORADOR_HEALTH)
    inst.components.hunger:SetMax(TUNING.EXPLORADOR_HUNGER)
    inst.components.sanity:SetMax(TUNING.EXPLORADOR_SANITY)

    inst.components.combat.damagemultiplier = 1.5

    inst:ListenForEvent("healthdelta", OnHealthDelta)

end

return MakePlayerCharacter("explorador", prefabs, assets, common_postinit, master_postinit)

Captura de tela 2026-03-05 191009.png

21_Sem_Titulo_20260115101824.png

You should recreate the new world and add no caves; this will make it easier to spot problems. If you can't fix it, zip your code and attach it here instead of uploading the individual files.

4 hours ago, Sadloy_1 said:

Worse than that, I use Wilson's base and it was working before I added the sprites.

Captura de tela 2026-03-07 205742.png

I noticed a few issues with your mod:

In modmain, you should use AddModCharacter and AddMinimapAtlas directly instead of using GLOBAL.

In your explorador_none.lua file, it’s looking for explorador.zip, but that file doesn't exist in your anim folder. It’s actually named explorador.zip.zip because you likely have file extensions hidden and didn't notice the double extension.

Also, the explorador.scml file cannot be compiled into a .zip because some files are missing. An SCML file won't compile if the linked .png files are deleted. I suggest copying explorador to explorador_cleared, as that folder has all the necessary images. Any parts you aren't using, like the tail or skirt, simply won't be displayedimage.png.a6573c4229a7cce4674677385e0f06e9.png

I THINK I fixed it, but it still has an error, and I didn't understand the copying part. This is my first time trying to program something. Is copying the explorer folder to explorer_cleared supposed to be copying and renaming? I sent the updated file so you can tell me where I went wrong.

teste.rar

For the sprites you wanted invisible, there weren't enough transparent sprites in there. For example, the skirt only had 1 transparent image when it's supposed to have 5. I added the right amount and tested to see if it worked, and it loaded in fine.

teste.zip

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...