• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Spell] Unit animation while being moved instantly.

Status
Not open for further replies.
Level 3
Joined
Nov 22, 2014
Messages
50
I Created a trigger that makes a unit charge on an other unit while accelerating. Although this works fine, the unit does not show a move animation, so it looks more like a roller skater charge. Which is far less cool.

Is there any way to make the unit show it's 'walk fast' animation while charging?
This skill is used by units that have a walk fast animation. (Like mammoth)

The lower part of the trigger is the target unit that got thrown in the air by paladons jump system.

  • Charge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge
    • Actions
      • Animation - Play (Triggering unit)'s Walk Fast animation
      • Set ChargingInteger1 = (ChargingInteger1 + 1)
      • Set ChargingInteger2 = (ChargingInteger2 + 1)
      • Set ChargingUnitArray[ChargingInteger1] = (Triggering unit)
      • Set ChargingTargetArray[ChargingInteger1] = (Target unit of ability being cast)
      • Set ChargingSpeed[ChargingInteger1] = 0
      • Unit - Turn collision for (Triggering unit) Off
      • Trigger - Turn on ChargeFollowUp <gen>

  • ChargeFollowUp
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to ChargingInteger1, do (Actions)
        • Loop - Actions
          • Set Temp_Point = (Position of ChargingUnitArray[(Integer A)])
          • Set Temp_Point2 = (Position of ChargingTargetArray[(Integer A)])
          • Set ChargingSpeed[(Integer A)] = (ChargingSpeed[(Integer A)] + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between Temp_Point and Temp_Point2) Greater than or equal to 50.00
            • Then - Actions
              • Set Temp_Point3 = (Temp_Point offset by (Real(ChargingSpeed[(Integer A)])) towards (Angle from Temp_Point to Temp_Point2) degrees)
              • Unit - Move ChargingUnitArray[(Integer A)] instantly to Temp_Point3, facing Temp_Point2
              • Set Temp_Unitgroup = (Units within 250.00 of Temp_Point matching ((((Matching unit) is dead) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((Owner of (Matching unit)) Equal to Player 12 (Brown)))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random integer number between 1 and 15) Equal to 1
                • Then - Actions
                  • Special Effect - Create a special effect at Temp_Point3 using Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
              • Unit Group - Pick every unit in Temp_Unitgroup and do (Actions)
                • Loop - Actions
                  • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 5.00)
              • Custom script: call DestroyGroup( udg_Temp_Unitgroup )
              • Custom script: call RemoveLocation( udg_Temp_Point3 )
            • Else - Actions
              • Sound - Play ThunderClapCaster <gen> at 100.00% volume, located at Temp_Point with Z offset 0.00
              • Unit - Set life of ChargingTargetArray[(Integer A)] to ((Life of ChargingTargetArray[(Integer A)]) - (100.00 + (5.00 x (Real(ChargingSpeed[(Integer A)])))))
              • Unit - Order ChargingUnitArray[(Integer A)] to Stop
              • Animation - Reset ChargingUnitArray[(Integer A)]'s animation
              • Unit - Turn collision for ChargingUnitArray[(Integer A)] On
              • Set JDA_JumpHigh_Distance = 0.50
              • Set JDA_DestroyTrees_Dash = False
              • Set JDA_Collusion = False
              • Set JDA_Unit = ChargingTargetArray[(Integer A)]
              • Set JDA_Speed = 14.00
              • Set JDA_SpecialEffect = Abilities\Spells\Undead\ReplenishMana\SpiritTouchTarget.mdl
              • Set JDA_Animation = walk
              • Set JDA_AnimationSpeed = 0.60
              • Set JDA_TargetPoint = (Temp_Point offset by (200.00 + (5.00 x (Real(ChargingSpeed[(Integer A)])))) towards (Angle from Temp_Point to Temp_Point2) degrees)
              • Trigger - Run Jump System 1 <gen> (checking conditions)
              • Set ChargingInteger2 = (ChargingInteger2 - 1)
              • Set ChargingTargetArray[(Integer A)] = No unit
              • Set ChargingUnitArray[(Integer A)] = No unit
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ChargingInteger2 Equal to 0
                • Then - Actions
                  • Set ChargingInteger1 = 0
                  • Trigger - Turn off (This trigger)
                • Else - Actions
          • Custom script: call RemoveLocation( udg_Temp_Point )
          • Custom script: call RemoveLocation( udg_Temp_Point2 )
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
That GUI trigger to play the animation just plays it once.
This custom script plays it everytime until it's interrupted.
  • Custom script: call SetUnitAnimationByIndex(unit, index)
And you have to know the Index too, not that hard (Try WC3 Viewer tree view) or Magos' model editor, and try animation editor and you find the list, the first animation in the list is the first index and so on... (Don't forget to predate the variable unit by udg_ if it shows error)

And if you wanna be sure the animation is not interrupted by move action. Use X-Y movement.
This :
  • Custom script: call SetUnitX(GetTriggerUnit(), udg_'positionrealXvariable')
  • Custom script: call SetUnitY(GetTriggerUnit(), udg_'positionrealYvariable')
If you're not using GetTriggerUnit() which means Triggering Unit, change it by your unit variable. And you should predate these two custom scripts by the next position X and Y. Like this
  • Set NextPositionX = (X of point 'Your point')
Peace
 
Level 3
Joined
Nov 22, 2014
Messages
50
Yes, even that first line solves the problem, thanks for helping me out.

The second part is not even necessary, I can click around all I want wen the trigger resolves, the animation does not stop.
 
Status
Not open for further replies.
Top