Jump to content

How do I make my character have a sanity aura?

Recommended Posts

Hi, I would like some help with creating a sanity aura for a character that I am currently making but, I think I screwed the order wrong or something. I'm not entirely the best at coding so yeah (it's gonna look a bit ugly).

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

local function OnSanityDelta(inst, data)
    CurrentSanity = inst.components.sanity:GetPercent()
    if inst.sleepingbag == nil then
        if CurrentSanity <= 0.15 then
            inst.components.sanityaura.aura = TUNING.MIZUKII_AURARATE * 0
        elseif CurrentSanity <= 0.5 then
            inst.components.sanityaura.aura = TUNING.MIZUKII_AURARATE * 0.5
            inst.components.sanityaura.aura = TUNING.MIZUKII_AURARATE
        inst.components.sanityaura.aura = TUNING.MIZUKII_AURARATE * 2

-- This initializes for the server only. Components are added here.
local master_postinit = function(inst)
    -- Set starting inventory
    inst.starting_inventory = start_inv[TheNet:GetServerGameMode()] or start_inv.default
    --Sanity Aura
    inst.components.sanityaura.max_distsq = TUNING.MIZUKII_AURASIZE
    inst.components.sanityaura.aura = TUNING.MIZUKII_AURARATE
    inst.components.sanityaura.fallofffn = Mizukii_aurafallofffn
    -- choose which sounds this character will play
    inst.soundsname = "willow"
    -- Uncomment if "wathgrithr"(Wigfrid) or "webber" voice is used
    --inst.talker_path_override = "dontstarve_DLC001/characters/"
    -- Stats    
    -- Damage multiplier (optional)
    inst.components.combat.damagemultiplier = .75
    -- Hunger rate (optional)
    inst.components.hunger.hungerrate = 1.15 * TUNING.WILSON_HUNGER_RATE
    inst.OnLoad = onload
    inst.OnNewSpawn = onload

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

Whenever I try and test this character in-game, the game won't load at all so yeah, i definitely scrwed something up lol. Any help with this coding mess I have created would be much appreciated.

Link to comment
Share on other sites

That usually means something is wrong with the character. There may be an error in the log? That may show us the issue.


How to get logs:

Open DST, go to the world that you were testing in. Above the delete button, there is an 'Open Cluster_X' button, click that. Then go into Master, and then open the log. Check for any errors

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

  • Create New...