Jump to content

SOS! Need help!


Recommended Posts

So i was trying to create a new mod for a character:Wochter Goya

Stats:

Health:175

Hunger:185

Sanity:250

Pros:

-sees in the dark

-regens hp on kill but also loses sanity

-regens sanity at night

-is a monster

Cons:

-freezes faster

-gets hungry a bit faster

Those are his stats.

I'll try to add sanity loss at day and custom items later.Also the art will have to wait.

The thing is it crashes all the time i use it.

Please HELP!!!!

Im an inexperienced modder and im completely lost at what to do!

Wochter.zip

Hm, i have a feeling this topic is born dead.

Link to comment
Share on other sites

There's comments next to everything that changed (sentences with -- at the beggining)

Your modinfo is ancient:

Spoiler

From:

Spoiler

 

-- This information tells other players more about the mod
name = "Wocher the Aristocratic Mothman"
description = "A character to use."
author = "LOkust421"
version = "1.1" -- This is the version of the template. Change it to your own number.

-- This is the URL name of the mod's thread on the forum; the part after the ? and before the first & in the url
forumthread = "/files/file/950-extended-sample-character/"


-- This lets other players know if your mod is out of date, update it to match the current version in the game
api_version = 2

dont_starve_compatible = true

reign_of_giants_compatible = true


icon_atlas = "modicon.xml"
icon = "modicon.tex"

--configuration_options = {}

 

To:

Spoiler

-- This information tells other players more about the mod
name = "Wocher the Aristocratic Mothman"
description = "A character to use."
author = "LOkust421"
version = "1.1" -- This is the version of the template. Change it to your own number.

priority = 0 -- Loading priority for your mod, 0 for characters

-- This is the URL name of the mod's thread on the forum; the part after the ? and before the first & in the url
forumthread = "/files/file/950-extended-sample-character/"


-- This lets other players know if your mod is out of date, update it to match the current version in the game
api_version = 10 -- From 2 to 10, shows your mod is up to date

dst_compatible = true -- Unless you are making a don't starve singleplayer mod this should be here
dont_starve_compatible = false -- And this should be false
reign_of_giants_compatible = true
all_clients_require_mod = true -- Character mods need this set to true

icon_atlas = "modicon.xml"
icon = "modicon.tex"

--server_filter_tags = {}

--configuration_options = {}

 

 

 

Now onto the crashes:

Spoiler

You misspelt the name of speech_wochter.lua in the scripts folder. You wrote speech_wocher instead. Changed it to speech_wochter.lua.

[00:05:21]: [string "../mods/Wochter/modmain.lua"]:32: module 'speech_wochter' not found:

 

You misspelt wochter.lua again, in scripts/prefabs. You wrote wocher.lua instead. Changed it to wochter.lua.

[00:00:23]: [string "scripts/mainfunctions.lua"]:90: Error loading file prefabs/wochter

    no file '../mods/Mod-Character-Rebalancing-2/scripts/prefabs/wochter.lua' (checked with custom loader)

 

You didnt close the function that you started at line 64.

[00:00:19]: error calling LoadPrefabFile in mod Wochter (Wocher the Aristocratic Mothman): 
[string "scripts/mainfunctions.lua"]:90: Error loading file prefabs/wochter
[string "../mods/Wochter/scripts/prefabs/wochter.lua"]:80: ')' expected (to close '(' at line 64) near 'return'

From:

Spoiler

    instanceinst:ListenForEvent("killed", function(inst, data)
    inst.components.health:DoDelta(15)
    inst.components.sanity:DoDelta(-3)
    -- inst.components.hunger:DoDelta(0)end)

To:

Spoiler

    instanceinst:ListenForEvent("killed", function(inst, data)
    inst.components.health:DoDelta(15)
    inst.components.sanity:DoDelta(-3)
    -- inst.components.hunger:DoDelta(0)end)
    end) -- This end was missing here. Parenthesis because you opened one above.

 

You named the main function (fn) wrong, it should be master_postinit AND common_postinit, separated. The difference is master runs for the server only and common for server and client. Also the assets.

[00:01:58]: [string "../mods/Wochter/scripts/prefabs/wochter.lua"]:57: attempt to index field 'health' (a nil value)

From:

Spoiler


local MakePlayerCharacter = require "prefabs/player_common"


local assets = {

        Asset( "ANIM", "anim/player_basic.zip" ),
        Asset( "ANIM", "anim/player_idles_shiver.zip" ),
        Asset( "ANIM", "anim/player_actions.zip" ),
        Asset( "ANIM", "anim/player_actions_axe.zip" ),
        Asset( "ANIM", "anim/player_actions_pickaxe.zip" ),
        Asset( "ANIM", "anim/player_actions_shovel.zip" ),
        Asset( "ANIM", "anim/player_actions_blowdart.zip" ),
        Asset( "ANIM", "anim/player_actions_eat.zip" ),
        Asset( "ANIM", "anim/player_actions_item.zip" ),
        Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ),
        Asset( "ANIM", "anim/player_actions_bugnet.zip" ),
        Asset( "ANIM", "anim/player_actions_fishing.zip" ),
        Asset( "ANIM", "anim/player_actions_boomerang.zip" ),
        Asset( "ANIM", "anim/player_bush_hat.zip" ),
        Asset( "ANIM", "anim/player_attacks.zip" ),
        Asset( "ANIM", "anim/player_idles.zip" ),
        Asset( "ANIM", "anim/player_rebirth.zip" ),
        Asset( "ANIM", "anim/player_jump.zip" ),
        Asset( "ANIM", "anim/player_amulet_resurrect.zip" ),
        Asset( "ANIM", "anim/player_teleport.zip" ),
        Asset( "ANIM", "anim/wilson_fx.zip" ),
        Asset( "ANIM", "anim/player_one_man_band.zip" ),
        Asset( "ANIM", "anim/shadow_hands.zip" ),
        Asset( "SOUND", "sound/sfx.fsb" ),
        Asset( "SOUND", "sound/wilson.fsb" ),
        Asset( "ANIM", "anim/beard.zip" ),

        Asset( "ANIM", "anim/wochter.zip" ),
}
local prefabs = {}
local start_inv = {
    -- Custom starting items
}

local fn = function(inst)
    
    -- choose which sounds this character will play
    inst.soundsname = "wilson"

    -- Minimap icon
    inst.MiniMapEntity:SetIcon( "wochter.tex" )
    
    -- Stats
    local light = inst.entity:AddLight()
    inst.Light:Enable(false)
    inst.Light:SetRadius(10)
    inst.Light:SetFalloff(0.75)
    inst.Light:SetIntensity(.6)
    inst.Light:SetColour(235/255,12/255,12/255)
    inst:AddTag("monster")
    inst.components.health:SetMaxHealth(175)
    inst.components.hunger:SetMax(185)
    inst.components.sanity:SetMax(250)
    inst.components.temperature.maxtemp = ( 20 )
    inst.components.sanity.neg_aura_mult = 0
    inst.components.sanity.night_drain_mult = 0
    inst:AddComponent("healthRegen")
    instanceinst:ListenForEvent("killed", function(inst, data)
    inst.components.health:DoDelta(15)
    inst.components.sanity:DoDelta(-3)
    -- inst.components.hunger:DoDelta(0)end)
    end) -- This end was missing here. Parenthesis because you opened one above.
    
    -- Damage multiplier (optional)
    inst.components.combat.damagemultiplier = 2
    
    -- Hunger rate (optional)
    inst.components.hunger.hungerrate = 1.2 * TUNING.WILSON_HUNGER_RATE
    
    -- Movement speed (optional)
    inst.components.locomotor.walkspeed = 6
    inst.components.locomotor.runspeed = 8
end

return MakePlayerCharacter("wochter", prefabs, assets, fn, start_inv)
 

To:

Spoiler

local MakePlayerCharacter = require "prefabs/player_common"


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

local prefabs = {}

-- Custom starting items
local start_inv = {
    
}

-- This initializes for both the server and client. Tags can be added here.
local common_postinit = function(inst)
    -- Minimap icon
    inst.MinimapEntity:SetIcon("wochter.tex")
end

local master_postinit = function(inst)
    -- choose which sounds this character will play
    inst.soundsname = "wilson"
    
    -- Stats
    local light = inst.entity:AddLight()
    inst.Light:Enable(false)
    inst.Light:SetRadius(10)
    inst.Light:SetFalloff(0.75)
    inst.Light:SetIntensity(.6)
    inst.Light:SetColour(235/255,12/255,12/255)
    inst:AddTag("monster")
    inst.components.health:SetMaxHealth(175)
    inst.components.hunger:SetMax(185)
    inst.components.sanity:SetMax(250)
    inst.components.temperature.maxtemp = ( 20 )
    inst.components.sanity.neg_aura_mult = 0
    inst.components.sanity.night_drain_mult = 0
    inst:AddComponent("healthRegen")
    instanceinst:ListenForEvent("killed", function(inst, data)
    inst.components.health:DoDelta(15)
    inst.components.sanity:DoDelta(-3)
    -- inst.components.hunger:DoDelta(0)end)
    end) -- This end was missing here. Parenthesis because you opened one above.
    
    -- Damage multiplier (optional)
    inst.components.combat.damagemultiplier = 2
    
    -- Hunger rate (optional)
    inst.components.hunger.hungerrate = 1.2 * TUNING.WILSON_HUNGER_RATE
    
    -- Movement speed (optional)
    inst.components.locomotor.walkspeed = 6
    inst.components.locomotor.runspeed = 8
end

return MakePlayerCharacter("wochter", prefabs, assets, common_postinit, master_postinit, start_inv)
 

 

And some things about your modmain:

From:

Spoiler

PrefabFiles = {
    "wochter",
}

Assets = {
    Asset( "IMAGE", "images/saveslot_portraits/wochter.tex" ),
    Asset( "ATLAS", "images/saveslot_portraits/wochter.xml" ),

    Asset( "IMAGE", "images/selectscreen_portraits/wochter.tex" ),
    Asset( "ATLAS", "images/selectscreen_portraits/wochter.xml" ),
    
    Asset( "IMAGE", "images/selectscreen_portraits/wochter_silho.tex" ),
    Asset( "ATLAS", "images/selectscreen_portraits/wochter_silho.xml" ),

    Asset( "IMAGE", "bigportraits/wochter.tex" ),
    Asset( "ATLAS", "bigportraits/wochter.xml" ),
    
    Asset( "IMAGE", "images/map_icons/wochter.tex" ),
    Asset( "ATLAS", "images/map_icons/wochter.xml" ),

}

local require = GLOBAL.require

-- The character select screen lines
GLOBAL.STRINGS.CHARACTER_TITLES.wochter = "The Aristocratic Mothman"
GLOBAL.STRINGS.CHARACTER_NAMES.wochter = "Wochter"
GLOBAL.STRINGS.CHARACTER_DESCRIPTIONS.wochter = "*is stronger at night\n*Starts with his rapier\n*hates light"
GLOBAL.STRINGS.CHARACTER_QUOTES.wochter = "\"Quote\""

-- Custom speech strings
GLOBAL.STRINGS.CHARACTERS.wochter = require "speech_wochter"

-- Let the game know character is male, female, or robot
table.insert(GLOBAL.CHARACTER_GENDERS.MALE, "wochter")


AddMinimapAtlas("images/map_icons/wochter.xml")
AddModCharacter("wochter")

 

 

To:

Spoiler

PrefabFiles = {
    "wochter",
}

Assets = {
    Asset( "IMAGE", "images/saveslot_portraits/wochter.tex" ),
    Asset( "ATLAS", "images/saveslot_portraits/wochter.xml" ),

    Asset( "IMAGE", "images/selectscreen_portraits/wochter.tex" ),
    Asset( "ATLAS", "images/selectscreen_portraits/wochter.xml" ),
    
    Asset( "IMAGE", "images/selectscreen_portraits/wochter_silho.tex" ),
    Asset( "ATLAS", "images/selectscreen_portraits/wochter_silho.xml" ),

    Asset( "IMAGE", "bigportraits/wochter.tex" ),
    Asset( "ATLAS", "bigportraits/wochter.xml" ),
    
    Asset( "IMAGE", "images/map_icons/wochter.tex" ),
    Asset( "ATLAS", "images/map_icons/wochter.xml" ),

}

local require = GLOBAL.require -- All this is just stuff to make your life easier when writing code
local STRINGS = GLOBAL.STRINGS
local resolvefilepath = GLOBAL.resolvefilepath

local Ingredient = GLOBAL.Ingredient
local RECIPETABS = GLOBAL.RECIPETABS
local Recipe = GLOBAL.Recipe
local TECH = GLOBAL.TECH

-- The character select screen lines
STRINGS.CHARACTER_TITLES.wochter = "The Aristocratic Mothman"
STRINGS.CHARACTER_NAMES.wochter = "Wochter"
STRINGS.CHARACTER_DESCRIPTIONS.wochter = "*is stronger at night\n*Starts with his rapier\n*hates light"
STRINGS.CHARACTER_QUOTES.wochter = "\"Quote\""

-- Custom speech strings
GLOBAL.STRINGS.CHARACTERS.WOCHTER = require "speech_wochter" -- Capitalized wochter

STRINGS.NAMES.WOCHTER = "Wochter" -- Added this

AddMinimapAtlas("images/map_icons/wochter.xml")

AddModCharacter("wochter", "MALE") -- Removed the table.insert and moved the gender to here
 

 

Commented out the minimap icon in common_postinit for now because it crashes and I can't be arsed right now so your guy doesn't have a minimap icon.

Removed the healthRegen component because it doesn't exist.

[00:02:03]: [string "scripts/entityscript.lua"]:52: module 'components/healthRegen' not found:
    no file '../mods/Mod-Character-Rebalancing-2/scripts/components/healthRegen.lua' (checked with custom loader)

From:

Spoiler

local MakePlayerCharacter = require "prefabs/player_common"


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

local prefabs = {}

-- Custom starting items
local start_inv = {
    
}

-- This initializes for both the server and client. Tags can be added here.
local common_postinit = function(inst)
    -- Minimap icon
    inst.MiniMapEntity:SetIcon("wochter.tex")
end

local master_postinit = function(inst)
    -- choose which sounds this character will play
    inst.soundsname = "wilson"
    
    -- Stats
    local light = inst.entity:AddLight()
    inst.Light:Enable(false)
    inst.Light:SetRadius(10)
    inst.Light:SetFalloff(0.75)
    inst.Light:SetIntensity(.6)
    inst.Light:SetColour(235/255,12/255,12/255)
    inst:AddTag("monster")
    inst.components.health:SetMaxHealth(175)
    inst.components.hunger:SetMax(185)
    inst.components.sanity:SetMax(250)
    inst.components.temperature.maxtemp = ( 20 )
    inst.components.sanity.neg_aura_mult = 0
    inst.components.sanity.night_drain_mult = 0
    inst:AddComponent("healthRegen")
    instanceinst:ListenForEvent("killed", function(inst, data)
    inst.components.health:DoDelta(15)
    inst.components.sanity:DoDelta(-3)
    -- inst.components.hunger:DoDelta(0)end)
    end) -- This end was missing here. Parenthesis because you opened one above.
    
    -- Damage multiplier (optional)
    inst.components.combat.damagemultiplier = 2
    
    -- Hunger rate (optional)
    inst.components.hunger.hungerrate = 1.2 * TUNING.WILSON_HUNGER_RATE
    
    -- Movement speed (optional)
    inst.components.locomotor.walkspeed = 6
    inst.components.locomotor.runspeed = 8
end

return MakePlayerCharacter("wochter", prefabs, assets, common_postinit, master_postinit, start_inv)
 

To:

Spoiler

local MakePlayerCharacter = require "prefabs/player_common"


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

local prefabs = {}

-- Custom starting items
local start_inv = {
    
}

-- This initializes for both the server and client. Tags can be added here.
local common_postinit = function(inst)
    -- Minimap icon
    --inst.MiniMapEntity:SetIcon("wochter.tex")
end

local master_postinit = function(inst)
    -- choose which sounds this character will play
    inst.soundsname = "wilson"
    
    -- Stats
    local light = inst.entity:AddLight()
    inst.Light:Enable(false)
    inst.Light:SetRadius(10)
    inst.Light:SetFalloff(0.75)
    inst.Light:SetIntensity(.6)
    inst.Light:SetColour(235/255,12/255,12/255)
    inst:AddTag("monster")
    inst.components.health:SetMaxHealth(175)
    inst.components.hunger:SetMax(185)
    inst.components.sanity:SetMax(250)
    inst.components.temperature.maxtemp = ( 20 )
    inst.components.sanity.neg_aura_mult = 0
    inst.components.sanity.night_drain_mult = 0
    instanceinst:ListenForEvent("killed", function(inst, data)
    inst.components.health:DoDelta(15)
    inst.components.sanity:DoDelta(-3)
    -- inst.components.hunger:DoDelta(0)end)
    end) -- This end was missing here. Parenthesis because you opened one above.
    
    -- Damage multiplier (optional)
    inst.components.combat.damagemultiplier = 2
    
    -- Hunger rate (optional)
    inst.components.hunger.hungerrate = 1.2 * TUNING.WILSON_HUNGER_RATE
    
    -- Movement speed (optional)
    inst.components.locomotor.walkspeed = 6
    inst.components.locomotor.runspeed = 8
end

return MakePlayerCharacter("wochter", prefabs, assets, common_postinit, master_postinit, start_inv)
 

 

Removed instanceinst:ListenForEvent because that's not a thing. inst:ListenForEvent is.

[00:00:40]: [string "../mods/Wochter/scripts/prefabs/wochter.lua"]:39: variable 'instanceinst' is not declared

From:

Spoiler

local MakePlayerCharacter = require "prefabs/player_common"


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

local prefabs = {}

-- Custom starting items
local start_inv = {
    
}

-- This initializes for both the server and client. Tags can be added here.
local common_postinit = function(inst)
    -- Minimap icon
    --inst.MiniMapEntity:SetIcon("wochter.tex")
end

local master_postinit = function(inst)
    -- choose which sounds this character will play
    inst.soundsname = "wilson"
    
    -- Stats
    local light = inst.entity:AddLight()
    inst.Light:Enable(false)
    inst.Light:SetRadius(10)
    inst.Light:SetFalloff(0.75)
    inst.Light:SetIntensity(.6)
    inst.Light:SetColour(235/255,12/255,12/255)
    inst:AddTag("monster")
    inst.components.health:SetMaxHealth(175)
    inst.components.hunger:SetMax(185)
    inst.components.sanity:SetMax(250)
    inst.components.temperature.maxtemp = ( 20 )
    inst.components.sanity.neg_aura_mult = 0
    inst.components.sanity.night_drain_mult = 0
    instanceinst:ListenForEvent("killed", function(inst, data)
    inst.components.health:DoDelta(15)
    inst.components.sanity:DoDelta(-3)
    -- inst.components.hunger:DoDelta(0)end)
    end) -- This end was missing here. Parenthesis because you opened one above.
    
    -- Damage multiplier (optional)
    inst.components.combat.damagemultiplier = 2
    
    -- Hunger rate (optional)
    inst.components.hunger.hungerrate = 1.2 * TUNING.WILSON_HUNGER_RATE
    
    -- Movement speed (optional)
    inst.components.locomotor.walkspeed = 6
    inst.components.locomotor.runspeed = 8
end

return MakePlayerCharacter("wochter", prefabs, assets, common_postinit, master_postinit, start_inv)
 

To:

Spoiler

local MakePlayerCharacter = require "prefabs/player_common"


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

local prefabs = {}

-- Custom starting items
local start_inv = {
    
}

-- This initializes for both the server and client. Tags can be added here.
local common_postinit = function(inst)
    -- Minimap icon
    --inst.MiniMapEntity:SetIcon("wochter.tex")
end

local master_postinit = function(inst)
    -- choose which sounds this character will play
    inst.soundsname = "wilson"
    
    -- Stats
    local light = inst.entity:AddLight()
    inst.Light:Enable(false)
    inst.Light:SetRadius(10)
    inst.Light:SetFalloff(0.75)
    inst.Light:SetIntensity(.6)
    inst.Light:SetColour(235/255,12/255,12/255)
    inst:AddTag("monster")
    inst.components.health:SetMaxHealth(175)
    inst.components.hunger:SetMax(185)
    inst.components.sanity:SetMax(250)
    inst.components.temperature.maxtemp = ( 20 )
    inst.components.sanity.neg_aura_mult = 0
    inst.components.sanity.night_drain_mult = 0
    inst:ListenForEvent("killed", function(inst, data)
    inst.components.health:DoDelta(15)
    inst.components.sanity:DoDelta(-3)
    -- inst.components.hunger:DoDelta(0)end)
    end) -- This end was missing here. Parenthesis because you opened one above.
    
    -- Damage multiplier (optional)
    inst.components.combat.damagemultiplier = 2
    
    -- Hunger rate (optional)
    inst.components.hunger.hungerrate = 1.2 * TUNING.WILSON_HUNGER_RATE
    
    -- Movement speed (optional)
    inst.components.locomotor.walkspeed = 6
    inst.components.locomotor.runspeed = 8
end

return MakePlayerCharacter("wochter", prefabs, assets, common_postinit, master_postinit, start_inv)
 

 

As for the rest of the crashes you are missing things like avatars in the images folders, which I can't fix so good luck until you get that fixed.

Look at Abigail by Arcade and Silhh if you want to know whats missing. Specially check in their modmain.lua, the assets table: http://steamcommunity.com/sharedfiles/filedetails/?id=647062183

Also your modicon.png should either not exist or be called preview.png for the steam workshop.

Also add a license, guy: http://choosealicense.com/licenses/mit/

Also get your mod on GitHub it makes everyone's lives easier: https://github.com/

 

Not sure why you are using a light if you are not enabling it: inst.Light:Enable(false)

 

Also your character is insanely overpowered. If you want to change it:

Your base stats are insane. 610 when added up, when Wilson is 500 base and the biggest is Wolfgang with 800 and WX-78 with 900.

Speed rarely changes in the base game, even less permanently unless its the walking cane. The maximum is WX-78 after hes struck with lightning for 1.5x Wilson speed.

No one in the game other than Willow with a durability based equippable lighter and WX-78 when struck with lightning have lighting by default.

The maxtemp would make it impossible to overheat. Then again, it would also make it impossible to build up temperature in the winter.

The damage multiplier is insane. Biggest is Wolfgang with full hunger which is 2.0x base damage followed by Wigfrid which is 1.25x base damage.

Your character doesn't get sanity drain from the night or monsters. Lowest is Wendy with 0.75x.

The hunger rate increase is miniscule to make up for all that.

 

Or you could just wait until I get to balancing your mod with mine, some time next year because Arcade has 40 something characters.

 

Zip with all the changes is at the bottom of the post.

Wochter.zip

Edited by DrSmugleaf
Link to comment
Share on other sites

MAN!

I cant thanc you enough for helping me out.

im still new to modding.

i have balanced it out with stats

and i added a daytime sanity debuf.

i also decreased the hunger to 100

and the sanity to 195 

AND the damage to 1.4, then again he is a fencing genious

thanks again man

what do you think about the on kill heal?

and do you khnow any good weapon mod guides?

thanks in advance!

 

Wochter.zip

Edited by Architect421
Link to comment
Share on other sites

I can't find the daytime sanity debuff you mention in the zip.

 

1 hour ago, Architect421 said:

what do you think about the on kill heal?

It's pretty similar to Wigfrid's (data/scripts/prefabs/wathgrithr.lua) bonus, only on kill instead of on doing damage, so that's fine if that's what you were going for. Only thing is it makes your character weaker vs bosses compared to Wigfrid and stronger at healing from small kills, like rabbits, birds or spiders. If you want, you can do different things for different kills, with data.victim:HasTag("smallcreature"). Here's how Wigfrid does it:

Spoiler

local function IsValidVictim(victim)
    return victim ~= nil
        and not ((victim:HasTag("prey") and not victim:HasTag("hostile")) or
                victim:HasTag("veggie") or
                victim:HasTag("structure") or
                victim:HasTag("wall") or
                victim:HasTag("companion"))
        and victim.components.health ~= nil
        and victim.components.combat ~= nil
end

local function onkilled(inst, data)
    local victim = data.victim
    if IsValidVictim(victim) then
        -- local delta = victim.components.combat.defaultdamage * 0.25
        -- inst.components.health:DoDelta(delta, false, "battleborn")
        -- inst.components.sanity:DoDelta(delta)

        if not victim.components.health.nofadeout and (victim:HasTag("epic") or math.random() < .1) then
            local time = victim.components.health.destroytime or 2
            local x, y, z = victim.Transform:GetWorldPosition()
            local scale = (victim:HasTag("smallcreature") and smallScale)
                        or (victim:HasTag("largecreature") and largeScale)
                        or medScale
            inst:DoTaskInTime(time, spawnspirit, x, y, z, scale)
        end
    end
end

 

 

1 hour ago, Architect421 said:

and do you khnow any good weapon mod guides?

For weapons you are probably better off looking at one from a mod or the base game. Abigail's Galaxy Sword code is like this:

Spoiler

local assets=
{
    Asset("ANIM", "anim/galaxysword.zip"),
    Asset("ANIM", "anim/swap_galaxysword.zip"),
  
    Asset("ATLAS", "images/inventoryimages/galaxysword.xml"),
    Asset("IMAGE", "images/inventoryimages/galaxysword.tex"),
}

local prefabs = 
{

}

local function OnEquip(inst, owner)
    owner.AnimState:OverrideSymbol("swap_object", "swap_galaxysword", "swap_galaxysword")
    owner.AnimState:Show("ARM_carry")
    owner.AnimState:Hide("ARM_normal")
end
  
local function OnUnequip(inst, owner)
    owner.AnimState:Hide("ARM_carry")
    owner.AnimState:Show("ARM_normal")
end
 
 local function onattack(weapon, attacker, target)
    -- if target ~= nil and target.components.burnable ~= nil and math.random() < TUNING.TORCH_ATTACK_IGNITE_PERCENT * target.components.burnable.flammability then
        -- target.components.burnable:Ignite(nil, attacker)
    -- end
	
    local atkfx = SpawnPrefab("explode_small")
    if atkfx then
	    local follower = atkfx.entity:AddFollower()
	    follower:FollowSymbol(target.GUID, target.components.combat.hiteffectsymbol, 0, 0, 0 )
    end
end

local function fn()
  
    local inst = CreateEntity()
 
    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddNetwork()
     
    MakeInventoryPhysics(inst)   
      
    inst.AnimState:SetBank("galaxysword")
    inst.AnimState:SetBuild("galaxysword")
    inst.AnimState:PlayAnimation("idle")
 
    inst:AddTag("sharp")
 
    if not TheWorld.ismastersim then
        return inst
    end
 
    inst.entity:SetPristine()
     
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(70)
    inst.components.weapon:SetOnAttack(onattack)
	  
    inst:AddComponent("inspectable")
      
    inst:AddComponent("inventoryitem")
	inst.components.inventoryitem.keepondeath = true
    inst.components.inventoryitem.imagename = "galaxysword"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/galaxysword.xml"
      
    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip( OnEquip )
    inst.components.equippable:SetOnUnequip( OnUnequip )
	inst.components.inventoryitem.keepondeath = true
	     
    return inst
end

STRINGS.NAMES.GALAXYSWORD = "Galaxy Sword"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.GALAXYSWORD = "Prismatic alignment!"

return  Prefab("common/inventory/galaxysword", fn, assets, prefabs) 

 

 

And the spear from the base game:

Spoiler

local assets =
{
    Asset("ANIM", "anim/spear.zip"),
    Asset("ANIM", "anim/swap_spear.zip"),
}

local function onequip(inst, owner)
    owner.AnimState:OverrideSymbol("swap_object", "swap_spear", "swap_spear")
    owner.AnimState:Show("ARM_carry")
    owner.AnimState:Hide("ARM_normal")
end

local function onunequip(inst, owner)
    owner.AnimState:Hide("ARM_carry")
    owner.AnimState:Show("ARM_normal")
end

local function fn()
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddNetwork()

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("spear")
    inst.AnimState:SetBuild("spear")
    inst.AnimState:PlayAnimation("idle")

    inst:AddTag("sharp")
    inst:AddTag("pointy")

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(TUNING.SPEAR_DAMAGE)

    -------

    inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetMaxUses(TUNING.SPEAR_USES)
    inst.components.finiteuses:SetUses(TUNING.SPEAR_USES)

    inst.components.finiteuses:SetOnFinished(inst.Remove)

    inst:AddComponent("inspectable")

    inst:AddComponent("inventoryitem")

    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)

    MakeHauntableLaunch(inst)

    return inst
end

return Prefab("spear", fn, assets)

 

 

Your character still crashes because it's missing assets like avatars. Here's the assets that Abigail by Arcade/Silhh uses, inside modmain.lua:

Spoiler

Assets = {
    Asset( "IMAGE", "images/saveslot_portraits/sdabigail.tex" ),
    Asset( "ATLAS", "images/saveslot_portraits/sdabigail.xml" ),

    Asset( "IMAGE", "images/selectscreen_portraits/sdabigail.tex" ),
    Asset( "ATLAS", "images/selectscreen_portraits/sdabigail.xml" ),
	
    Asset( "IMAGE", "images/selectscreen_portraits/sdabigail_silho.tex" ),
    Asset( "ATLAS", "images/selectscreen_portraits/sdabigail_silho.xml" ),

    Asset( "IMAGE", "bigportraits/sdabigail.tex" ),
    Asset( "ATLAS", "bigportraits/sdabigail.xml" ),
	
	Asset( "IMAGE", "images/map_icons/sdabigail.tex" ),
	Asset( "ATLAS", "images/map_icons/sdabigail.xml" ),
	
	Asset( "IMAGE", "images/avatars/avatar_sdabigail.tex" ),
    Asset( "ATLAS", "images/avatars/avatar_sdabigail.xml" ),
	
	Asset( "IMAGE", "images/avatars/avatar_ghost_sdabigail.tex" ),
    Asset( "ATLAS", "images/avatars/avatar_ghost_sdabigail.xml" ),
	
	Asset( "IMAGE", "images/avatars/self_inspect_sdabigail.tex" ),
    Asset( "ATLAS", "images/avatars/self_inspect_sdabigail.xml" ),
	
	Asset( "IMAGE", "images/names_sdabigail.tex" ),
    Asset( "ATLAS", "images/names_sdabigail.xml" ),
	
    Asset( "IMAGE", "bigportraits/sdabigail_none.tex" ),
    Asset( "ATLAS", "bigportraits/sdabigail_none.xml" ),
	
	Asset( "ATLAS", "images/hud/sdabigailtab.xml" ),
	Asset( "IMAGE", "images/hud/sdabigailtab.tex" ),

}

 

 

Link to comment
Share on other sites

7 minutes ago, Architect421 said:

thancs but it stiill doesnt work , no error message , nohing 

Error messages are in C:\Users\(Your User)\Documents\Klei\DoNotStarveTogether\client_log.txt

Look towards the bottom to find it, it will be similar to the lines I pasted on my first response, like " [00:00:23]: [string "scripts/mainfunctions.lua"]:90: Error loading file prefabs/wochter "

 

If you still can't find it then either upload the character mod again or upload/paste the client_log, but it should be crashing because of missing assets, like avatars.

Edited by DrSmugleaf
Link to comment
Share on other sites

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
 Share

×
  • Create New...