Jump to content

Recommended Posts

Have you tried

inst.components.talker:Say(GetString(inst, "ANNOUNCE_COLD"))

I can't find anywhere where it actually reacts to cold by playing an animation, so I'm guessing there may be some code listening for announcements and pushing the fitting animation for it if there is one. Sort of like an emote, but automatic.

Link to comment
Share on other sites

Oh well, worth a try. I can't find it anywhere. Find out what the animation is called (it should be in the animation build for the player) and do a search through the game code for that name. It must be triggered somewhere.

Link to comment
Share on other sites

If you just want it to happen once when the character equips it, you can put the lines into the OnEquip function of the item. If you want it to continuously trigger the animation, then you have to start a periodic task, which you then stop in OnUnequip.

Link to comment
Share on other sites

That's odd. OnEquip should be called every time you equip it. Try putting a print-statement in the onequip function to verify. If your onequip is indeed called, there may be something else going on behind the scenes we don't know about.

Link to comment
Share on other sites

I have no idea, m8. I'm just guessing things here. Now you've established that whatever code you need can be triggered in onequip, but apparently it doesn't work unless you pick it up from the ground. Unless you've added a check for whether "owner" is false, it should be crashing if there is no owner. Just to be sure, you did change the lines to this, right?

owner.AnimState:PlayAnimation("idle_shiver_pre")
owner.AnimState:PushAnimation("idle_shiver_loop")

 

Link to comment
Share on other sites

I'd guess it's somehow in a state where it can't play the animation, then.

Try this:

-- This line outside and above both functions.
local freezetask = nil

-- This in onequip
freezetask = owner:DoPeriodicTask(5.0, function(inst)
	inst.AnimState:PlayAnimation("idle_shiver_pre")
	inst.AnimState:PushAnimation("idle_shiver_loop")
end)

-- This in onunequip
freezetask:Cancel()

 

That should keep playing the animation every 5 seconds, if it's in a state where it can. Since they're called something with "idle", I guess your character has to be idle for it to play (complete speculation, though).

You can adjust the 5 seconds to whatever you like.

Edited by Ultroman
Link to comment
Share on other sites

Ah, ok.

Oops, I just saw a bug in my previous code. I've fixed it in the previous post (changed it from owner.AnimState to inst.AnimState, since the scope changed from the code we had previously).

Edited by Ultroman
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...