Jump to content

Character stats reset on resurrection


Recommended Posts

Good afternoon y'all! I have a rather bizarre bug currently occuring. I have a modded character (well--another's mod that I'm further modding) with a handful of modded stats. However, whenever I die as said character and then am resurrected, my speed stats are reset. I've resurrected with a telltale heart, and with a touchstone--doesn't matter which, my stats are messed up either way. Here's the lua script for the stats:

local function master_postinit(inst)
    
    -- choose which sounds this character will play
    inst.soundsname = "wolfgang"
    
    -- minimap icon
    inst.MiniMapEntity:SetIcon( "heavy.tex" )
    
    -- stats
    inst.components.locomotor.walkspeed = 3.08
    inst.components.locomotor.runspeed = 4.62
    inst.components.health:SetMaxHealth(300)
    inst.components.hunger:SetMax(300)
    inst.components.combat.damagemultiplier = 2
    inst.components.hunger.hungerrate = 1.5 * TUNING.WILSON_HUNGER_RATE
    -- withstands cold 4x more than wilson
    inst.components.temperature.inherentinsulation = 45
    inst.components.temperature.overheattemp = 65
    
    -- works faster
    inst:AddComponent("worker")
    inst.components.worker:SetAction(ACTIONS.CHOP, 2)
    inst.components.worker:SetAction(ACTIONS.MINE, 2)
    inst.components.worker:SetAction(ACTIONS.HAMMER, 2)
    
    -- food
    inst.components.eater.strongstomach = false
    
    --/outdated code, and wrong...
    --/why did I ever thought to edit the tuning class back in the day?
    --/don't uncomment the code below, it will crash the game.
    --TUNING.STACK_SIZE_LARGEITEM = 15
    --TUNING.STACK_SIZE_MEDITEM = 30
    --TUNING.STACK_SIZE_SMALLITEM = 60
    --TUNING.EVERGREEN_CHOPS_SMALL = 4
    --TUNING.EVERGREEN_CHOPS_NORMAL = 8
    --TUNING.EVERGREEN_CHOPS_TALL = 12
    --TUNING.ROCKS_MINE = 4
    --TUNING.ROCKS_MINE_MED = 3
    --TUNING.ROCKS_MINE_LOW = 2
    --TUNING.MARBLEPILLAR_MINE = 8
    --TUNING.MARBLETREE_MINE = 6
end

Let me know if y'all need any of the other code to figure this out. Thanks for your help!

Link to comment
Share on other sites

Does your character have a "local function onbecamehuman(inst)" in their yourcharacter.lua? If they do maybe you can put these

inst.components.locomotor.walkspeed = 3.08
    inst.components.locomotor.runspeed = 4.62

inside their too then they get their speed back when they die & ressurect? 

Also, this code

-- works faster
    inst:AddComponent("worker")
    inst.components.worker:SetAction(ACTIONS.CHOP, 2)
    inst.components.worker:SetAction(ACTIONS.MINE, 2)
    inst.components.worker:SetAction(ACTIONS.HAMMER, 2)

Doesn't makes your character work faster, I think :).

Link to comment
Share on other sites

I appreciate the help, but that code did not work.

Or rather, there isn't currently any onbecamehuman functions. I tried plugging it in but it didn't work.

And yeah, the worker code has been busted for ages. Don't really care about that one though, it made the character overpowered something fierce.

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