Jump to content

Need help fixing crash...


Recommended Posts

Hello! So i'm trying to make my character enter the "groggy" state when it's starving and go back to normal when they're not starving. I got it able to enter the "groggy" state when starving but when I try to get them out of it by adding code to remove the "groggy" effect it works fine but when the character dies the game crashes... If anyone can help me I would be so happy because I have no clue why it isn't working...

Here's the code that makes it happen.

-- You're so starving! Don't Starve!
    inst:ListenForEvent("startstarving", function(inst, data)
    inst.components.talker:Say(GetString(inst, "ANNOUNCE_STARVING"))
    inst.components.combat.damagemultiplier = 1
    inst.components.sanity.dapperness = -30 * TUNING.DAPPERNESS_HUGE
    inst.components.grogginess:AddGrogginess(1)
    inst.components.grogginess:SetDecayRate(0)
    end)
    
    -- You're not starving! Good!
    inst:ListenForEvent("stopstarving", function(inst, data)
    inst.components.talker:Say(GetString(inst, "ANNOUNCE_STOPSTARVING"))
    inst.components.combat.damagemultiplier = 2
    inst.components.sanity.dapperness = 0.25 * TUNING.DAPPERNESS_HUGE
    --inst.components.grogginess:SetDecayRate(1) <-- Makes game crash when character dies
    end)

 

Please help me...:sad:

Crash.jpg

Edited by SuperDavid
    inst.components.grogginess:SetWearOffDuration(0) Does nothing
Link to comment
Share on other sites

Well I fixed my problem and now my character gets groggy and dies properly, THANK GOD! Whew... I feel like a mad scientist trying to code this stuff, like dang it's so complicated! :???:

Thank you very much to whoever read all of this or wanted to try to help me, peace guys! :D

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