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

How to make the charging unit plays walk animation

Status
Not open for further replies.
Level 9
Joined
Apr 30, 2010
Messages
324
yeah, i have no idea on how to do this..

because of this

  • Time - Every 0.04 seconds of game time
e



  • HCS2
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • For each (Integer HCS_Integers[2]) from 1 to HCS_Integers[1], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HCS_Check[HCS_Integers[2]] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • HCS_Distance[HCS_Integers[2]] Greater than 100.00
                • Then - Actions
                  • Set MVC_Point[0] = (Position of HCS_Caster[HCS_Integers[2]])
                  • Set MVC_Point[2] = (Position of HCS_Target[HCS_Integers[2]])
                  • Set HCS_Distance[HCS_Integers[1]] = (Distance between MVC_Point[0] and MVC_Point[2])
                  • Set HCS_Distance[HCS_Integers[2]] = (HCS_Distance[HCS_Integers[1]] - HCS_Speed[HCS_Integers[2]])
                  • Set HCS_Ange[HCS_Integers[1]] = (Angle from MVC_Point[0] to MVC_Point[2])
                  • Set MVC_Point[1] = (MVC_Point[0] offset by HCS_Speed[HCS_Integers[2]] towards HCS_Ange[HCS_Integers[2]] degrees)
                  • Animation - Play HCS_Caster[HCS_Integers[1]]'s walk animation
                  • Unit - Move HCS_Caster[HCS_Integers[2]] instantly to MVC_Point[1], facing HCS_Ange[HCS_Integers[2]] degrees
                  • Unit - Create 1 MVC_UnitType[6] for (Owner of HCS_Caster[HCS_Integers[2]]) at MVC_Point[1] facing HCS_Ange[HCS_Integers[2]] degrees
                  • Set RAS_Dummy = (Last created unit)
                  • Set RAS_Duration = 0.40
                  • Set RAS_HeightInc = False
                  • Set RAS_Color = 100.00
                  • Trigger - Run RemoveA <gen> (checking conditions)
                  • Set HCS_Timer[HCS_Integers[2]] = (HCS_Timer[HCS_Integers[2]] + 0.04)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • HCS_Timer[HCS_Integers[2]] Greater than or equal to HCS_Interval[HCS_Integers[2]]
                    • Then - Actions
                      • Set HCS_Timer[HCS_Integers[2]] = 0.00
                      • Set MVC_PickGroup = (Units within 130.00 of MVC_Point[1] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of HCS_Caster[HCS_Integers[2]])) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matchi
                      • Unit Group - Pick every unit in MVC_PickGroup and do (Actions)
                        • Loop - Actions
                          • Set MVC_Point[2] = (Position of (Picked unit))
                          • Set MVC_Point[3] = (MVC_Point[2] offset by (HCS_Speed[HCS_Integers[2]] x (HCS_Interval[HCS_Integers[2]] / 0.04)) towards HCS_Ange[HCS_Integers[2]] degrees)
                          • Unit - Move (Picked unit) instantly to MVC_Point[3]
                          • Unit - Cause HCS_Caster[HCS_Integers[2]] to damage (Picked unit), dealing HCS_Damage[HCS_Integers[2]] damage of attack type Spells and damage type Universal
                          • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Custom script: call RemoveLocation (udg_MVC_Point[2])
                          • Custom script: call RemoveLocation (udg_MVC_Point[3])
                      • Custom script: call DestroyGroup (udg_MVC_PickGroup)
                    • Else - Actions
                  • Custom script: call RemoveLocation (udg_MVC_Point[0])
                  • Custom script: call RemoveLocation (udg_MVC_Point[1])
                  • Custom script: call RemoveLocation (udg_MVC_Point[2])
                • Else - Actions
                  • Set HCS_Check[HCS_Integers[2]] = False
                  • Unit - Turn collision for HCS_Caster[HCS_Integers[2]] On
                  • Animation - Change HCS_Caster[HCS_Integers[2]]'s animation speed to 100.00% of its original speed
                  • Animation - Reset HCS_Caster[HCS_Integers[2]]'s animation
                  • Set HCS_Timer[HCS_Integers[2]] = 0.00
                  • Set HCS_Integers[0] = (HCS_Integers[0] - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • HCS_Integers[0] Equal to 0
                    • Then - Actions
                      • Set HCS_Integers[1] = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
            • Else - Actions
 
Last edited by a moderator:
  • Animation - Play HCS_Caster[HCS_Integers[1]]'s walk animation
^Intsead of this in the loop, make following at cast, or whenever you give your unit an index:
  • Custom script: call SetUnitAnimationByIndex(YourUnit, AnimationIndex)
About the Custom script:
YourUnit: Replace it with your unit variable.
AnimationIndex: Replace it with a number. Just make few tests to find the correct number for WalkAnimation. Start with 0.
 
Level 9
Joined
Apr 30, 2010
Messages
324
  • Set HCS_Caster[HCS_Integers[1]] = (Triggering unit)
i think the index is 2.. or 3.. animation index is animation order in mdlvis if i am not wrong..

EDIT: NEVER MIND.. i forgot to put another bracket after [1] ---> [1]]
 
Level 6
Joined
Nov 24, 2012
Messages
218
I haven't touched WC3 in ages but I recall making dozens of charge moves, some with fading after-images and such.
I'm really sorry but I don't remember them very well.
For me, when I used GUI, I made 2 kinds of charges mainly.
The first is your way, with the "move unit instantly" GUI function.
That one does not ignore collision, and also interrupts/does not allow the unit to cast channeling spells while moving.
I think it also interrupts animations, which may be your issue (I'm not 100% sure here, my memory isn't the best).
The other charge I made was the same, but using custom script line for the move unit instantly, to a set unit location function.
Sorry, don't remember specific function. I'm sure you can find it. SetUnitPoint? Or you could always SetUnitX and SetUnitY, takes a bit more work.
The JASS unit movement function ignores collision, and doesn't interrupt stuff, allowing me to play an animation such as walk, uninterrupted.
Sometimes you might get stuck with this charge ability since it ignores collision so what I did was spawn an item your location at the end of the charge duration.
Then I get that item's location (spawned items always follows collision standards, so you can't get stuck in the middle of a slope increase/decrease terrain, etc).
Then move the unit to that item instantly, and remove the item.
Also this charge lets you cast instant spells and channel abilities uninterrupted so it may or may not be a good idea depending on what you're going for.
There are easy workarounds for that though like make the unit "stop" and replay walk animation if it tries to cast something during dash, etc.
Yep. I think that's it. Also, a lot of times I don't want to do all of that, so I just do your dash way, without walk animation.
But it goes so fast, people who play that hero don't see anything wrong.
Since I kind of cover for it by creating fading afterimages dummies of the unit and these afterimages can play the walk animation since they're not moving.
Sometimes my hero goes 100% transparent while the visual movement is all shown by the fading images too if I want the charge to be ninja-style.
Good luck :).
 
Level 9
Joined
Apr 30, 2010
Messages
324
@HesitationSnow : yeah, sometimes i do also like the ninja style.. + camera lock system.. haha... it is nice eye candy.. take a look at mine..

@IcemanBo: here you go.. for some weird reason, when i use Channel ability as the base spell, it won't play the animation.. I don't have any idea why.. so i use chain lightning as the base spell.. any idea?



NOTE: THIS TRIGGER IS NOT ORIGINALLY CREATED BY ME, IT IS BY NEROVESPER.. I JUST MODIFIED IT..
 

Attachments

  • Charge Charge Charge.w3x
    24.3 KB · Views: 82
Level 37
Joined
Mar 6, 2006
Messages
9,240
Move unit instantly action gives the unit stop order and thus resets the animation to stand.

Use these instead
  • Custom script: call SetUnitX(udg_HCS_Caster[udg_HCS_Integers[2]], GetLocationX(udg_MVC_Point[1]))
  • Custom script: call SetUnitY(udg_HCS_Caster[udg_HCS_Integers[2]], GetLocationY(udg_MVC_Point[1]))
 
Level 9
Joined
Apr 30, 2010
Messages
324
Move unit instantly action gives the unit stop order and thus resets the animation to stand.

Use these instead
  • Custom script: call SetUnitX(udg_HCS_Caster[udg_HCS_Integers[2]], GetLocationX(udg_MVC_Point[1]))
  • Custom script: call SetUnitY(udg_HCS_Caster[udg_HCS_Integers[2]], GetLocationY(udg_MVC_Point[1]))


thank you for the knowledge.. but i have a spell which does not move the unit instantly.. but when i use Channel ability as the base ability, it won't play the animation.. i already triggered the animation by index..
 
Status
Not open for further replies.
Top