Jump to content

Could I get somebody to help a little?


Recommended Posts

Okay, so I'm making a character mod for DST. Hell knows there's too many of those, yet here I am adding to the pile.

All I want to know is how to start with hunger lowered from it's max. value, like Wolfgang initially spawns in. I tried digging into the code but it's just too much for me to understand how and when it happens.

Also, could I use this knowledge to apply the same thing to starting with a lower max. life? Just like the max. health penalty for respawning, except you start off with it.

There's probably some other topic asking about this very same issue, but I'm not willing to dig in.

Edited by AdipemDragon
Link to comment
Share on other sites

But... That's just how you set the max hunger for the character... I kinda wanted to know how to initially spawn in with less hunger than the one you set by:

14 hours ago, Arkathorn said:

inst.components.hunger:SetMax(amount)

Yknow, just like Wolfgang initially spawns in with an emptier stomach so you don't have the advantages of his Mighty form right away.

And lastly, could I apply the same thing to spawn in with a lowered max life equivalent with the penalty of respawning via Telltale Heart 3 times?

Link to comment
Share on other sites

You didn't specify what exactly you wanted to achieve at first.

local function OnNewSpawn(inst)
    inst.components.hunger.current = inst.components.hunger.max * 0.75
end

inst.OnNewSpawn = OnNewSpawn

Put the last line in your char's master_postinit.

About the health part I'm not 100% sure, but probably it should be like this:

inst.components.health:SetPenalty(-penalty value here-)

I'm not too sure about the penalty value (if it should be percentage-based or how many 'penalties' should be added), so you can just try and put "3" or "0.5" or something, and see what happens.

Hope this helps.

Link to comment
Share on other sites

@PanAzej

Okay so as it is right now, should I shift around some things or is it good to go?

Here's how that part is:

    ...

    inst.components.combat.damagemultiplier = 1.1
    inst.components.hunger.hungerrate = 1.5 * TUNING.WILSON_HUNGER_RATE
    
    local function OnNewSpawn(inst)
        inst.components.hunger.current = inst.components.hunger.max * 0.5
        inst.components.health:SetPenalty(3)
    end

    inst.OnNewSpawn = OnNewSpawn
    
    inst.OnLoad = onload
    inst.OnNewSpawn = onload
    
end

Edited by AdipemDragon
I sent it too soon and it didn't make any sense.
Link to comment
Share on other sites

Well, after finally figuring out the thing that kept crashing my mod I got to test if that works... And it doesn't...

...

local start_inv = {
    "trinket_21",
    "bird_egg"
}

local function OnNewSpawn(inst)
    inst.components.hunger.current = inst.components.hunger.max * 0.5
    inst.components.health:SetPenalty(3)
end

local function onbecamehuman(inst)
    inst.components.locomotor:SetExternalSpeedMultiplier(inst, "wiego_speed_mod", 0.9)
end

...

Is this layed out correctly? Should I move it right before common_postinit?

Also, the thing that prevented my mod from working was a misplaced dot instead of a comma in the speech file. Guess I overlooked it when I added new description lines.

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