Jump to content

Recommended Posts

Hello guys, thank you for clicking on this. I have been experiencing great difficulty trying to create a don't starve character, but I finally managed to do it. It's nowhere near complete and I need some help because i have absolutely no idea where to look to add different health, hunger and sanity amounts. In the game. Also a feature i'm adding to the mod is the character also loses sanity quicker than normal so if you guys could help with that, that would would be appreciated.

 

Thank you, - Joey.

In the prefab of your character (Change X, Y and Z to the numbers you want.

 

    inst.components.health.maxhealth = X
    inst.components.hunger.maxhunger = Y
    inst.components.sanity.max = Z
    inst.components.sanity.current = Z

 

For the sanity I'm not so sure but here it is:
 

    inst.components.sanity.night_drain_mult = 1 (Sanity drain from night multiplier)
    inst.components.sanity.neg_aura_mult = 1 (Negative aura multiplier)

Edited by Dictator

In the prefab of your character (Change X, Y and Z to the numbers you want.

 

    inst.components.health.maxhealth = X

    inst.components.hunger.maxhunger = Y

    inst.components.sanity.max = Z

    inst.components.sanity.current = Z

 

For the sanity I'm not so sure but here it is:

 

    inst.components.sanity.night_drain_mult = 1 (Sanity drain from night multiplier)

    inst.components.sanity.neg_aura_mult = 1 (Negative aura multiplier)

 

Thank you for the advise, but i was wondering, should it be under the functions part of the folder, or should it just be at the end of it. (basically im asking is there a specific spot it should be located). I tried what you said but the stats remained exactly the same when i restarted it and started a new world and put it in the functions section.

Edited by Joeyloveswaffles

prefabs -> character.lua (The lua file of your character)

Here is the quote of my .lua (From the section to the final line of the archive)

 

local fn = function(inst)
    
    -- choose which sounds this character will play
    inst.soundsname = "wilson"

    -- a minimap icon must be specified
    inst.MiniMapEntity:SetIcon( "wilson.png" )
    
    inst.components.health.maxhealth = 75
    inst.components.hunger.maxhunger = 125
    inst.components.sanity.max = 250
    inst.components.sanity.current = 250
    inst.components.sanity.night_drain_mult = 2
    inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.2)
    inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.3)
    inst.components.hunger:SetMax(TUNING.WILSON_HUNGER * 1.0)
    inst.components.combat.damagemultiplier = 1.0
    
end

return MakePlayerCharacter("wayne", prefabs, assets, fn)

 

 

prefabs -> character.lua (The lua file of your character)

Here is the quote of my .lua (From the section to the final line of the archive)

 

I pretty much copy pasted exactly that (all i did was change the hunger, sanity and stuff to what i wish them to be and set the multiplier to 1.0 for the moment) but it literally changed nothing. I still have the default 150 hunger, 150 health, and 200 sanity in game. For some reason it will not change even after i went into the bronx.lua (thats the character name) and got rid of what was there for the final lines of the script and replaced them with yours. Is there any reason this may be happening and that i might be missing a small detail of some sort?

I pretty much copy pasted exactly that (all i did was change the hunger, sanity and stuff to what i wish them to be and set the multiplier to 1.0 for the moment) but it literally changed nothing. I still have the default 150 hunger, 150 health, and 200 sanity in game. For some reason it will not change even after i went into the bronx.lua (thats the character name) and got rid of what was there for the final lines of the script and replaced them with yours. Is there any reason this may be happening and that i might be missing a small detail of some sort?

 

Did you changed the "wayne" to the name of your character? Remember, in the past everything needs to be written exactly how it is. Just use lowercase names and will be alright.

Did you changed the "wayne" to the name of your character? Remember, in the past everything needs to be written exactly how it is. Just use lowercase names and will be alright.

 

I left it as is, and even if i had, wouldn't it have caused the whole mod to crash?

No, you have to change the wayne to the name that you are using to script your character.

When i meant i left it as is, (sorry this was improper wording) i meant it says "bronx" instead of "wayne", should have been more clear on that. Sorry.

No, you have to change the wayne to the name that you are using to script your character.

I fixed the problem, thank you for your assistance. I misplaced the mod in the wrong folder. Thank you for the assistance and it has been a great help, now it has the correct amounts of health, hunger and sanity that i want :grin:

Edited by Joeyloveswaffles

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