Jump to content

Needed help with modding the mightiness mechanic


Recommended Posts

Hello! For the past few days I've been making a DST mod for a character

I wanted him to have three states, that would depend on his sanity level with changing sprites and a damage multiplier, but even after looking up previous posts, looking into wolfgangs code and some mods I knew had a simmilar mechanic I still can't really understand it, outside a few more obvious lines

I'd be glad if someone would help me with either setting it up or leading me onto the right path, maybe even draw somehing for helpers if I get it right

It's my first time really making anything like this and I did get a bit too excited, expecting the coding to be easier, while now I'm stuck not being even exacly sure where to put it all (it's charactername.lua, right?)

Im using the most popular ESCTemplate

I'm also sending whatever I could tryhard at making so feel free to laugh at my awful attempts at coding this

Thank you for reading my post and have a good day/night!

nowy 1.txt

Link to comment
Share on other sites

can you send me your mod file so i can try it 

local characterlook1 = false
local characterlook2 = false

local function character_normal(inst)
    inst.AdmiNState:SetBuild("character")--replace character with your character name
    characterlook1 = false
    characterlook2 = false
end
local function characterlook1(inst)
    inst.AdmiNState:SetBuild("characterlook1") -- replace characterlook1 with build file u want to use
    characterlook1 = true
    characterlook2 = false
end

local function characterlook2(inst)
    inst.AdmiNState:SetBuild("characterlook2") -- replace characterlook2 with build file u want to use
    characterlook1 = false
    characterlook2 = true
end

local function AllMightiness(inst)-- change numbers as you like

    if inst.HasTag("playerghost") then
        return
    end

    if inst.components.sanity.current <= 50 then
    inst.components.locomotor.walkspeed = TUNING.WILSON.WALK_SPEED * 1.25
    inst.components.combat.damagemultipler = 0.75
    characterlook1(inst)
    inst.components.talker:Say("I am using characterlook1")
    inst.SoundEmitter:PlaySound("dontstarve/characters/wendy/talk")
    end

    if inst.components.sanity.current <= 75 then
        inst.components.locomotor.walkspeed = TUNING.WILSON.WALK_SPEED * 1.33
        inst.components.combat.damagemultipler = 1
        characterlook2(inst)
        inst.components.talker:Say("I am using characterlook2")
        inst.SoundEmitter:PlaySound("dontstarve/characters/wendy/talk")
    end

    if inst.components.sanity.current >= 75 then
        inst.components.locomotor.walkspeed = TUNING.WILSON.WALK_SPEED * 1.5
        inst.components.combat.damagemultipler = 1.5
        character_normal(inst)
        inst.components.talker:Say("I am using character_normal")
        inst.SoundEmitter:PlaySound("dontstarve/characters/wendy/talk")
    end
end

inst:ListenForEven("AllMightiness", AllMightiness)

 

the first and long one in character.lua and second one is under master_postinit

Edited by AkaiNight
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...