Jump to content

[SOLVED] How to disable certain idle from playing for character?


Recommended Posts

Hello, I need help :).

So, the "idle_inaction_sanity" anim glitches with my character's texture making her legs go all weird

Sadness.png

So... I want to disable it from playing for her. So, I tried doing something like this in SGwilson

State{
        name = "funnyidle",
        tags = { "idle", "canrotate" },

        onenter = function(inst)
            if inst.components.temperature:GetCurrent() < 5 then
                inst.AnimState:PlayAnimation("idle_shiver_pre")
                inst.AnimState:PushAnimation("idle_shiver_loop")
                inst.AnimState:PushAnimation("idle_shiver_pst", false)
            elseif inst.components.temperature:GetCurrent() > TUNING.OVERHEAT_TEMP - 10 then
                inst.AnimState:PlayAnimation("idle_hot_pre")
                inst.AnimState:PushAnimation("idle_hot_loop")
                inst.AnimState:PushAnimation("idle_hot_pst", false)
            elseif inst.components.hunger:GetPercent() < TUNING.HUNGRY_THRESH then
                inst.AnimState:PlayAnimation("hungry")
                inst.SoundEmitter:PlaySound("dontstarve/wilson/hungry")    
            elseif inst.components.sanity:GetPercent() < .5 and not inst:HasTag("amazon") then
                inst.AnimState:PlayAnimation("idle_inaction_sanity")
            else
                return
            elseif inst:HasTag("groggy") then
                inst.AnimState:PlayAnimation("idle_groggy01_pre")
                inst.AnimState:PushAnimation("idle_groggy01_loop")
                inst.AnimState:PushAnimation("idle_groggy01_pst", false)
            else
                inst.AnimState:PlayAnimation("idle_inaction")
            end
        end,

but that did nothing *cries*...

I would really love if someone could help me because I have no idea what i'm doing wrong! Thanks you so much forr reading my problem & have a wonderful day/night :D:D!!!!

Edited by SuperDavid
Link to comment
Share on other sites

AddStategraphPostInit("wilson", function(sg)
	local _funnyidle_onenter = sg.states.funnyidle.onenter
	sg.states.funnyidle.onenter = function(inst)
		_funnyidle_onenter(inst)
		if inst:HasTag("amazon") and inst.AnimState:IsCurrentAnimation("idle_inaction_sanity") then
			inst.AnimState:PlayAnimation("idle_inaction")
		end
	end
end)

 

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