Jump to content

need help with transformation of emotions with low sanity


Recommended Posts

Hello. Another user, Yakuzashi, actually already answered this question a few years ago!

His code was:

Spoiler

local assets

	Asset( "ANIM", "anim/NAMEOFEXPORTEDFOLDERnumber1.zip" ),
	Asset( "ANIM", "anim/NAMEOFEXPORTEDFOLDERnumber2.zip" ),
	Asset( "ANIM", "anim/NAMEOFEXPORTEDFOLDERnumber3.zip" ),

 

Spoiler

Somewhere below local assets but not inside master_postinit

local function changemymind(inst)
local sanity = inst.components.sanity.current

if inst:HasTag("playerghost") then return end
if inst.components.health:IsDead() then return end

	-- stage I (0-50 sanity)
	if sanity <= 50 then
		inst.AnimState:SetBuild("NAMEOFEXPORTEDFOLDERnumber1")
	end
	
	-- stage II (51-100 sainity)
	if sanity >= 51 and sanity <= 100 then
		inst.AnimState:SetBuild("NAMEOFEXPORTEDFOLDERnumber2")		
	end
	
	-- stage III (over 100 sanity)
	if sanity >= 101 then
		inst.AnimState:SetBuild("NAMEOFEXPORTEDFOLDERnumber3")		
	end
end

 

Spoiler

master_posinit

inst:ListenForEvent("sanitydelta", changemymind)

 

Hope this helps! And sorry for such a late reply.

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