Jump to content

Need HELP: make Woodie gain Sanity over time depend on how many wood in his inventory (like Warbucks)


Recommended Posts

I Looked at Warbucks Lua file and found some lines:

Spoiler

local function sanityfn(inst)
    local delta = 0
    local oinc_amount = inst.components.inventory:Count("oinc") + (inst.components.inventory:Count("oinc10") * 10) + (inst.components.inventory:Count("oinc100") * 100)
    
    if oinc_amount >= 200 then
        delta = TUNING.SANITYAURA_MED    
    elseif oinc_amount >= 50 then
        delta = TUNING.SANITYAURA_SMALL         
    elseif oinc_amount >= 20 then
        delta = TUNING.SANITYAURA_TINY * 2 
    elseif oinc_amount >= 10 then
        delta = TUNING.SANITYAURA_TINY  
    end

    return delta
end

-- and this lineunder local fn = function(inst)
inst.components.sanity.custom_rate_fn = sanityfn

Then i made some change then copy to woodie (DST) Lua file (oh, i used a Woodie mod called Woodie Unchained. I copy the code to that woodie lua file not the original DST lua file)

Spoiler

local function sanityfn(inst)
    local delta = 0
    local log_amount = inst.components.inventory:Count("log") + (inst.components.inventory:Count("livinglog") * 10)
    
    if log_amount >= 200 then
        delta = TUNING.SANITYAURA_HUGE
    elseif log_amount >= 100 then
        delta = TUNING.SANITYAURA_LARGE 
    elseif log_amount >= 50 then
        delta = TUNING.SANITYAURA_MED 
    elseif log_amount >= 20 then
        delta = TUNING.SANITYAURA_SMALL
    elseif log_amount >= 10 then
        delta = TUNING.SANITYAURA_TINY  
    end

    return delta
end

--And copy this line under: local function master_postinit(inst)
inst.components.sanity.custom_rate_fn = sanityfn

and it's crashed the game (It's not that SIMPLE :D)

PLEASE, HELP! if you can, much appreciated!!!

Thanks for reading.

Link to comment
Share on other sites

10 minutes ago, penguin0616 said:

crash log

Where can i find that file? Sorry

Here is what happen:

after copy those code to the lua file, i create a new world with only that mod active, world generated > chose Woodie > proceed to the Florid Postern, game frozen for like a minute then this appeared:

image.thumb.png.b4bfcd784068ab0d5b25d8bda3aca288.png

And i was send back to the menu, the login phase.

Link to comment
Share on other sites

  

9 hours ago, AndRay said:

use the Has method

Thanks for your suggestion. 

I now settle with the idea of "Plant Trees - Gain Sanity" (Evergreen, Birchnut, Twiggy Tree & Lune Tree), because simple code :D, and it kinda fit Woodie too.

P/s: I mod this because when i play Woodie (as my main now), i always in Insanity stage (Transfrom too much :D), need a way to get back to normal, and i don't want to just tune the Dapperness to HUGE, because you still need nightmare fuel & Beard Hair sometime :D.

Edited by Psychomaniac
Link to comment
Share on other sites

On 11/7/2020 at 1:49 PM, Psychomaniac said:

  

Thanks for your suggestion. 

I now settle with the idea of "Plant Trees - Gain Sanity" (Evergreen, Birchnut, Twiggy Tree & Lune Tree), because simple code :D, and it kinda fit Woodie too.

P/s: I mod this because when i play Woodie (as my main now), i always in Insanity stage (Transfrom too much :D), need a way to get back to normal, and i don't want to just tune the Dapperness to HUGE, because you still need nightmare fuel & Beard Hair sometime :D.

Sorry for necroing, bit isn't better for you to just eat roasted green mushroom? I mean the ruin got plenty of it and you may set up green mushroom farm.

Link to comment
Share on other sites

33 minutes ago, TheTruth said:

Sorry for necroing

You're well come :D!!!

It's just a point of view matter, you can play DST as Wes with no up-side and still fine because there 're are always ways to get things done.

But since i'm a F.A.S or F.A.P (Forever Alone Survivor, Forever Alone Player, i like to play ALONE) and i don't wan to switch my main, so i try to mod them to have all the up- side of every char, i currently play Woodie with the Woodie unchained mod, and i added some more ability that i feel needs, like : Wicker's book stuff, Wormwood's ability to plant seed into the ground and gain sanity when planting, ability to fertilizer in winter, a custom crafting tab with new recipe to craft the un-craftable stuff like berry bush, twig bush, juicy berry bush, fire fly, living wood.... you name it.

I just want a jack-of-all-trades char :D

P/s: and tree a like every where, so when i want sanity just chop down some, get the woods, plant the seed > stop tree guard, reproduce forest, gain sanity.

Edited by Psychomaniac
  • Like 1
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...