1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  4. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  5. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  6. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  7. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  8. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

How to make the charging unit plays walk animation

Discussion in 'Triggers & Scripts' started by makai, Oct 13, 2014.

  1. makai

    makai

    Joined:
    Apr 30, 2010
    Messages:
    320
    Resources:
    2
    Models:
    2
    Resources:
    2
    yeah, i have no idea on how to do this..

    because of this

    • Time - Every 0.04 seconds of game time
    e



    Trigger
    • 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: Oct 13, 2014
  2. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,165
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    • 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.
     
  3. makai

    makai

    Joined:
    Apr 30, 2010
    Messages:
    320
    Resources:
    2
    Models:
    2
    Resources:
    2
    • Custom script: call SetUnitAnimationByIndex(udg_HCS_Caster[udg_HCS_Integers[1], 3)


    can you correct me on this?
     
  4. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,165
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Are you sure udg_HCS_Caster[udg_HCS_Integers[1] is the correct unit? Print the name of HCS_Caster[udg_HCS_Integers[1] and look if it prints the correct name.
    Are you sure "3" is the correct index?
     
  5. makai

    makai

    Joined:
    Apr 30, 2010
    Messages:
    320
    Resources:
    2
    Models:
    2
    Resources:
    2
    • 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]]
     
  6. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,165
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Mind to attach your map?
     
  7. makai

    makai

    Joined:
    Apr 30, 2010
    Messages:
    320
    Resources:
    2
    Models:
    2
    Resources:
    2
    sure thing! i need to edit a few thing first..
     
  8. HesitationSnow

    HesitationSnow

    Joined:
    Nov 24, 2012
    Messages:
    215
    Resources:
    1
    Spells:
    1
    Resources:
    1
    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 :).
     
  9. makai

    makai

    Joined:
    Apr 30, 2010
    Messages:
    320
    Resources:
    2
    Models:
    2
    Resources:
    2
    @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..
     

    Attached Files:

  10. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,193
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    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]))
     
  11. makai

    makai

    Joined:
    Apr 30, 2010
    Messages:
    320
    Resources:
    2
    Models:
    2
    Resources:
    2

    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..
     
  12. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,193
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    When you use Channel, remember to adjust follow through time. Follow through time is how long the unit will keep playing the animation and keeps the order of the ability.