• 🏆 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!

[Trigger] Animation issues

Status
Not open for further replies.
Level 4
Joined
Dec 25, 2012
Messages
66
[SOLVED] Animation issues

Here's my GUI-only version of Jump-trigger:
Base: Healing Ward

  • Events:
  • Unit - a unit starts the effect of ability
  • Conditions:
  • Ability being cast equals Leap
  • Actions:
  • Set leapCaster = Casting unit
  • Set leapStart = position of leapCaster
  • Set leapFinish = Target point of ability being cast
  • Unit - make leapCaster Invulnerable
  • Unit - turn collision off for leapCaster
  • Unit - Add Crow form to leapCaster
  • Unit - Remove Crow form from leapCaster
  • Animation - Change leapCaster flying height to 500 rate 700
  • Animation - Set leapCaster animation speed to 25%
  • Animation - play leapCaster Spell animation
  • Unit - Set leapCaster movement speed to Default speed *10
  • Unit - order leapCaster to move (leapFinish)
  • /*Wait till peak of jump*/
  • Wait (((Distance between leapStart and leapFinish)/(Current move speed of leapCaster))/2) sec
  • /*Start Landing*/
  • Animation - change leapCaster flying height to 0 rate 700
  • Wait (((Distance between leapStart and leapFinish)/(Current move speed of leapCaster))/2) sec
  • Animation - Set leapCaster anim speed to 100%
  • Animation - Reset leapCaster animation
  • Unit - set leapCaster move speed to default speed of leapCaster
  • /*Make unit vunerable on landing/*
  • Unit - make leapCaster vulnerable
  • Unit - turn collision on for leapCaster
  • /*Clear leaks*/
  • Custom Script - call RemoveLocation(udg_leapStart)
  • Custom Script - call RemoveLocation(udg_leapFinish)
Works fine, except that the Spell animation I planned for unit (Margol) to slowly play while airbourne does not play. Instead, walk animation does, and does at the 100% speed. Any suggestions on how to fix this are appreciated!
 
Last edited:
Level 4
Joined
Dec 25, 2012
Messages
66
Use
  • Animation - add "Spell" animation tag to leapCaster
and when it's done remove it.

Another method would be to pause the caster, and then play animation.

Thanks a lot! Gotta try it out now.

Also, I did try to Pause unit before playing animation sequence, however, it renders the unit unable to execute Move to position order.

Trigger updated (see title post)

Use
  • Animation - add "Spell" animation tag to leapCaster
and when it's done remove it.

Another method would be to pause the caster, and then play animation.

Add aniamtion tag doesnt seem to work. Where in the trigger shall I put it first?
 
Last edited by a moderator:
Level 37
Joined
Mar 6, 2006
Messages
9,240
Don't pause the caster, that is bad method.

You order the unit to move after requeting an animation, the walk order overrides the animation.

Use
  • Custom script: call UnitSetAnimationByIndex(udg_leapCaster, index)
The index is an integer, you have to test different numbers to find the correct one. Start from 0, then try 1,2 and so on.
 
Level 4
Joined
Dec 25, 2012
Messages
66
Don't pause the caster, that is bad method.

You order the unit to move after requeting an animation, the walk order overrides the animation.

Use
  • Custom script: call UnitSetAnimationByIndex(udg_leapCaster, index)
The index is an integer, you have to test different numbers to find the correct one. Start from 0, then try 1,2 and so on.

call UnitAddAbilityBJ( 'Arav', udg_leapCaster )
call UnitRemoveAbilityBJ( 'Arav', udg_leapCaster )
call SetUnitFlyHeightBJ( udg_leapCaster, 500.00, 800.00 )
call SetUnitTimeScalePercent( udg_leapCaster, 25.00 )
call UnitSetAnimationByIndex(udg_leapCaster,0) - I'm getting an error here - missing function name. Syntax?
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
it depends on the index, if you try to input number that has animation he will play stand 1(default) animation, you can "datamine" them with a loop changing the index every 10 seconds or so and print it at the same time and you will get all the animations you want
 
Level 4
Joined
Dec 25, 2012
Messages
66
it depends on the index, if you try to input number that has animation he will play stand 1(default) animation, you can "datamine" them with a loop changing the index every 10 seconds or so and print it at the same time and you will get all the animations you want

That is not the issue here. Animations simply do not play. I just tried to implement jump using loops and Unit - move instantly. Doesn't look smooth and eats up a lot of time, also those damned "Waits". I guess if it keeps like this I'll have to leave trigger as it is...
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Move unit instantly functions gives the unit stop order, which then aborts any animation and starts stand animation. Use SetUnitX and SetUnitY instead. Using those, animations won't be interrupted, but you need to do pathing check not to move units out of map, throught trees and into impassable places.
 
Level 4
Joined
Dec 25, 2012
Messages
66
Move unit instantly functions gives the unit stop order, which then aborts any animation and starts stand animation. Use SetUnitX and SetUnitY instead. Using those, animations won't be interrupted, but you need to do pathing check not to move units out of map, throught trees and into impassable places.

Since Leap is based upon healing ward, game
automatically disables targeting where a unit (healing ward) can't be placed (e.g. outside map or on top of impassable terrain/inside trees).

I've found some decent solution to this issue. Looks like "Move" order resets unit's animation sequence and speed repeatedly. To counter that, the following trigger was created:

  • Unit - A unit begins to cast the spell
  • Ability being cast equals Leap
  • For each integer A from 1 to 10 do Actions
  • Actions:
  • Play leapCaster spell aniimation
  • wait 0.01 sec
thus effectively locking caster's animation in place. Good enough to look like a jump, not like an air walk.

Final set of triggers:

  • Unit - A unit begins to cast the spell
  • Ability being cast equals Leap
  • For each integer A from 1 to 10 do Actions
  • Actions:
  • Play leapCaster spell aniimation
  • wait 0.01 sec
  • Events:
  • Unit - a unit starts the effect of ability
  • Conditions:
  • Ability being cast equals Leap
  • Actions:
  • Set leapCaster = Casting unit
  • Set leapStart = position of leapCaster
  • Set leapFinish = Target point of ability being cast
  • //Play "prepare to jump" animation
  • Animation - play leapCaster spell animation
  • Wait 0.4 sec
  • Unit - make leapCaster Invulnerable
  • Unit - turn collision off for leapCaster
  • Unit - Add Crow form to leapCaster
  • Unit - Remove Crow form from leapCaster
  • Animation - Change leapCaster flying height to 500 rate 700
  • Animation - Set leapCaster animation speed to 25%
  • Animation - play leapCaster Spell animation
  • Unit - Set leapCaster movement speed to Default speed *10
  • Unit - order leapCaster to move (leapFinish)
  • /*Wait till peak of jump*/
  • Wait (((Distance between leapStart and leapFinish)/(Current move speed of leapCaster))/2) sec
  • /*Start Landing*/
  • Animation - change leapCaster flying height to 0 rate 700
  • Wait (((Distance between leapStart and leapFinish)/(Current move speed of leapCaster))/2) sec
  • Animation - Set leapCaster anim speed to 100%
  • Animation - Reset leapCaster animation
  • Unit - set leapCaster move speed to default speed of leapCaster
  • /*Make unit vunerable on landing/*
  • Unit - make leapCaster vulnerable
  • Unit - turn collision on for leapCaster
  • /*Clear leaks*/
  • Custom Script - call RemoveLocation(udg_leapStart)
  • Custom Script - call RemoveLocation(udg_leapFinish)
Works fine, now I'll have to figure out how to make it mui, taking into account those damn waits (custom script - set unit leapCaster perhaps?). Nevertheless, thanks a lot for pointing out that Move order overrides the Animation - play animation.

P.S. Small replay of trigger in action is included (1.26).
 

Attachments

  • JumpDemo.w3g
    13.4 KB · Views: 55
Last edited:
Status
Not open for further replies.
Top