Recommended Posts

Ultroman    397

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.

Share this post


Link to post
Share on other sites
Ultroman    397

If you need help, then I need more information. At least the logs with the error in it, and if you want me to do more than just decipher the error I'll need a zip of your mod, as well.

Share this post


Link to post
Share on other sites
Ultroman    397

In the OnEquip function in the weapon you're doing

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

but in the scope of that function inst is the weapon, which can't talk. Change inst to owner.

Share this post


Link to post
Share on other sites
Ultroman    397

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.

Share this post


Link to post
Share on other sites
Ultroman    397

Well, please do post your solution when you find it, so others can find it here in the future :)

Share this post


Link to post
Share on other sites
Aurorus    5

Now i know what animation this is but dont know how to trigger this

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

 

Share this post


Link to post
Share on other sites
Ultroman    397

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.

Share this post


Link to post
Share on other sites
Ultroman    397

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.

Share this post


Link to post
Share on other sites
Aurorus    5

it works with print but dont work with animation

animation is still triggered by take item from ground

Share this post


Link to post
Share on other sites
Ultroman    397

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")

 

Share this post


Link to post
Share on other sites
Ultroman    397
Posted (edited)

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

Share this post


Link to post
Share on other sites
Aurorus    5
Posted (edited)

i think about error screen like this

image.png

and this bug splat is only for preview and i did it dont analyze this please

Edited by Aurorus

Share this post


Link to post
Share on other sites
Ultroman    397
Posted (edited)

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

Share this post


Link to post
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

Sign in to follow this