• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Channel animation looping indefinitely

Status
Not open for further replies.
Level 5
Joined
Jul 31, 2020
Messages
103
Hi.

Keeping it short: Channel-based (ANcl) ability, Follow Through Time is set properly. But since there's a requirement for using it, it gets canceled at EVENT_PLAYER_UNIT_SPELL_CAST if the requirement is not met. This is done by ordering the unit to "stop" and that's all. This causes the ability's animation to loop indefinitely, disregarding its Follow Through Time setting. I guess this is accidentally sort of a newsflash for some people if they were looking to do this sort of thing.

Anyway, SetUnitAnimation, ResetUnitAnimation, QueueUnitAnimation have no effect. Changing the unit's facing (slightly, so it's not noticeable) has no effect. Changing the unit's location has no effect. Making the unit move does solve it because it forces it into its "move" animation instead, but this isn't really a solution.

Side information here is that this state does not prevent the unit from, for example, auto-engaging enemy units in range as its order is "stop". It's just playing the animation forever.
 
Did you try AddUnitAnimationProperties(myUnit, "channel", false) ? Assuming that SetUnitAnimation couldn't do it, maybe it could if you first removed the "channel" animProp. (NOTE: There is no "RemoveUnitAnimationProperties" native, instead that last boolean is "boolean add" so if it's false then it removes it if I recall)

If that doesn't work out of the box, maybe try

Code:
AddUnitAnimationProperties(myUnit, "channel", false)
SetUnitAnimation(myUnit, "stand")

My thought here, (a guess without actually testing at the moment) is that since you said SetUnitAnimation didn't work, most likely it did set the "stand" animation but the "channel" animProp was still assigned
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Is it stuck in the Disabled (Paused) state? What you're describing shouldn't happen.

Also, I found that the BlzPauseUnitEx() function is pretty useful for stopping a unit from doing just about anything:
  • Custom script: call BlzPauseUnitEx(udg_YourUnit, true)
  • Custom script: call BlzPauseUnitEx(udg_YourUnit, false)
Using these instead of issuing a "Stop" order has actually solved some issues of mine where Stop wasn't good enough.

I believe this function is only available on patch 1.31+.
 
Level 5
Joined
Jul 31, 2020
Messages
103
Did you try AddUnitAnimationProperties(myUnit, "channel", false) ? Assuming that SetUnitAnimation couldn't do it, maybe it could if you first removed the "channel" animProp. (NOTE: There is no "RemoveUnitAnimationProperties" native, instead that last boolean is "boolean add" so if it's false then it removes it if I recall)

If that doesn't work out of the box, maybe try

Code:
AddUnitAnimationProperties(myUnit, "channel", false)
SetUnitAnimation(myUnit, "stand")

My thought here, (a guess without actually testing at the moment) is that since you said SetUnitAnimation didn't work, most likely it did set the "stand" animation but the "channel" animProp was still assigned
I'll be honest I'm not sure if AddUnitAnimationProperties with the false flag is supposed to just straight up remove that animation from the unit's animation pool, but if it is, it's not actually doing anything from what I've seen after testing it. I tried it right there for the animation looping issue (both suggestions; the prop removal alone/prop removal + SetUnitAnimation to "stand"), no dice, so I tried it out in an empty map with a single unit, basically just tried removing its "walk" animation, but it didn't do that. I could be wrong about what the native is doing, of course, I'm just seeing no effect whatsoever.

Is it stuck in the Disabled (Paused) state? What you're describing shouldn't happen.

Also, I found that the BlzPauseUnitEx() function is pretty useful for stopping a unit from doing just about anything:
  • Custom script: call BlzPauseUnitEx(udg_YourUnit, true)
  • Custom script: call BlzPauseUnitEx(udg_YourUnit, false)
Using these instead of issuing a "Stop" order has actually solved some issues of mine where Stop wasn't good enough.

I believe this function is only available on patch 1.31+.
It's not stuck in a paused state, I never paused it. You can move the unit just fine to stop it from looping the animation, I mentioned that too. Anyway, I'm on 1.32.10 as God intended, so I tried out the BlzPauseUnitEx trick as well. It does stop the loop. It does also force the unit into its T-pose (or "unanimated") state (whch I believe happens due to this pause completely nulling the unit's current order, so it's not even "stop"), which is a minor thing, but I also immediately solved it by adding back the IssueImmediateOrder "stop" after unpausing to restore it back to its idle "stand" animation. Absolutely gorgeous.
 
is supposed to just straight up remove that animation from the unit's animation pool
No generally in the past when I used it, I was adding "gold" animation to a work to make them act as though they were carrying gold, or "alternate" to a shape shifter to make them display their morphed form. What it's doing is adding those tags to the decision logic for what animations to play, I believe, not adding and removing the animations themselves.
 
Status
Not open for further replies.
Top