Jump to content

Recommended Posts

I was trying to make my self a custom beard for my custom character so I used this tutorial 

 

I've done everything it said but when I go into game I get this error and this is my brady.lua 

Spoiler

 


local MakePlayerCharacter = require "prefabs/player_common"


local assets = {
    Asset("SCRIPT", "scripts/prefabs/player_common.lua"),
    Asset( "ANIM", "anim/brady_beard.zip" ),
}
local prefabs = 
{
    "book_birds",
    "book_tentacles",
    "book_gardening",
    "book_sleep",
    "book_brimstone",
    "beardhair",
}


-- Custom starting items
local start_inv = 
{

    "tentaclespike"

}

-- When the character is revived from human
local function onbecamehuman(inst)
    -- Set speed when reviving from ghost (optional)
    inst.components.locomotor:SetExternalSpeedMultiplier(inst, "brady_speed_mod", 1)
end

local function onbecameghost(inst)
    -- Remove speed modifier when becoming a ghost
   inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "brady_speed_mod")
end

-- When loading or spawning the character
local function onload(inst)
    inst:ListenForEvent("ms_respawnedfromghost", onbecamehuman)
    inst:ListenForEvent("ms_becameghost", onbecameghost)

    if inst:HasTag("playerghost") then
        onbecameghost(inst)
    else
        onbecamehuman(inst)
    end
end


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

    --reader (from reader component) added to pristine state for optimization
    inst:AddTag("reader")
end

local funtion OnResetBeard(inst)
inst.AnimState:ClearOverrideSymbol("beard")
end

local BEARD_DAYS = { 4, 8, 16 }
local BEARD_BITS = { 1, 3, 9 }
local function OnGrowShortBeard(inst)
inst.AnimState:OverrideSymbol("beard", "brady_beard", "beard_short")
inst.components.beard.bits = BEARD_BITS[1]
end
local function OnGrowMediumBeard(inst)
inst.AnimState:OverrideSymbol("beard", "brady_beard", "beard_medium")
inst.components.beard.bits = BEARD_BITS[2]
end
local function OnGrowLongBeard(inst)
inst.AnimState:OverrideSymbol("beard", "brady_beard", "beard_long")
inst.components.beard.bits = BEARD_BITS[3] 
end


-- This initializes for the server only. Components are added here.
local master_postinit = function(inst)
    inst:AddComponent("beard")
inst.components.beard.onreset = OnResetBeard
inst.components.beard.prize = "beardhair"
inst.components.beard:AddCallback(BEARD_DAYS[1], OnGrowShortBeard)
inst.components.beard:AddCallback(BEARD_DAYS[2], OnGrowMediumBeard)
inst.components.beard:AddCallback(BEARD_DAYS[3], OnGrowLongBeard)
    -- choose which sounds this character will play
    inst.soundsname = "wolfgang"
    
    -- Uncomment if "wathgrithr"(Wigfrid) or "webber" voice is used
    --inst.talker_path_override = "dontstarve_DLC001/characters/"
    
    -- Stats    
    inst.components.health:SetMaxHealth(150)
    inst.components.hunger:SetMax(150)
    inst.components.sanity:SetMax(200)
    
    -- Damage multiplier (optional)
    inst.components.combat.damagemultiplier = 1
    
    -- Hunger rate (optional)
    inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE
    
    inst.OnLoad = onload
    inst.OnNewSpawn = onload
        inst:AddComponent("reader")
    
    inst.components.eater.stale_hunger = TUNING.WICKERBOTTOM_STALE_FOOD_HUNGER
    inst.components.eater.stale_health = TUNING.WICKERBOTTOM_STALE_FOOD_HEALTH
    inst.components.eater.spoiled_hunger = TUNING.WICKERBOTTOM_SPOILED_FOOD_HUNGER
    inst.components.eater.spoiled_health = TUNING.WICKERBOTTOM_SPOILED_FOOD_HEALTH

    inst.components.sanity:SetMax(TUNING.WICKERBOTTOM_SANITY)

    inst.components.builder.science_bonus = 1
    
end

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

 

please help :(
 

 

 

ceea622f14ab529553475ec6c74c4a99.jpg

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...