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

Bladestorm that moves to specific point

Status
Not open for further replies.
Level 4
Joined
May 10, 2018
Messages
12
Hello! I want to make a Bladestorm ability where the hero targets a point, and then moves to that point while dealing damage to units in the heros path, unable to attack or cast spells until it is complete.
I have seen similar abilities in other maps but I can't seem to figure out how they do it!
I don't want the hero to teleport/move to the point instantly!
I tried using the channel ability but it doesn't move the hero unfortunately

Any ideas or threads I could look at? I can't seem to find any for what I am looking for and I'm kinda stumped!
 
Level 7
Joined
Sep 4, 2016
Messages
116
You could use channel (or some ability that targets a point) to start the ability, but then detect that with a trigger, then give the unit your Bladestorm ability, and (in the trigger), command the unit to move to the target location during the bladestorm.
If you want to prevent interruption of trajectory, you can turn on a trigger that detects if the unit was ordered to do anything before reaching its target location, and correct it to once again move to the target location.

May not be a super elegant solution, but I think it could work.
 
Level 4
Joined
May 10, 2018
Messages
12
You could use channel (or some ability that targets a point) to start the ability, but then detect that with a trigger, then give the unit your Bladestorm ability, and (in the trigger), command the unit to move to the target location during the bladestorm.
If you want to prevent interruption of trajectory, you can turn on a trigger that detects if the unit was ordered to do anything before reaching its target location, and correct it to once again move to the target location.

May not be a super elegant solution, but I think it could work.
I thought about that but I didn't think of the check for orders bit, will play with that and see what happens!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,534
Here you go, it's not perfect but it gets the job done:
  • Leap Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Leap
    • Actions
      • -------- Set static variables: --------
      • Set VariableSet Leap_Index = (Leap_Index + 1)
      • Set VariableSet Leap_Caster[Leap_Index] = (Triggering unit)
      • Set VariableSet Leap_PointA = (Position of Leap_Caster[Leap_Index])
      • Set VariableSet Leap_PointB = (Target point of ability being cast)
      • Set VariableSet Leap_Angle[Leap_Index] = (Angle from Leap_PointA to Leap_PointB)
      • Set VariableSet Leap_MaxDistance[Leap_Index] = (Distance between Leap_PointA and Leap_PointB)
      • Set VariableSet Leap_DistanceTraveled[Leap_Index] = 0.00
      • -------- --------
      • -------- Add a minimum distance (optional): --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Leap_MaxDistance[Leap_Index] Less than 100.00
        • Then - Actions
          • Set VariableSet Leap_MaxDistance[Leap_Index] = 100.00
        • Else - Actions
      • -------- --------
      • -------- Define speed, damage, and area of effect: --------
      • Set VariableSet Leap_Speed[Leap_Index] = 10.00
      • Set VariableSet Leap_Damage[Leap_Index] = (5.00 x (Real((Level of (Ability being cast) for Leap_Caster[Leap_Index]))))
      • Set VariableSet Leap_AreaOfEffect[Leap_Index] = 200.00
      • -------- --------
      • -------- Remove memory leaks: --------
      • Custom script: call RemoveLocation(udg_Leap_PointA)
      • Custom script: call RemoveLocation(udg_Leap_PointB)
      • -------- --------
      • -------- Start the leap effect: --------
      • Trigger - Turn on Leap Periodic <gen>
  • Leap Periodic
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Leap_Loop) from 1 to Leap_Index, do (Actions)
        • Loop - Actions
          • -------- Stun the caster and play an animation: --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Leap_DistanceTraveled[Leap_Loop] Less than or equal to 0.00
            • Then - Actions
              • -------- Stun the caster (make sure you understand how this function works before using it everywhere): --------
              • Custom script: call BlzPauseUnitEx(udg_Leap_Caster[udg_Leap_Loop], true)
              • -------- --------
              • -------- This plays an animation without it getting interrupted: --------
              • Custom script: call SetUnitAnimationByIndex(udg_Leap_Caster[udg_Leap_Loop], 13)
            • Else - Actions
          • -------- --------
          • -------- Get next position: --------
          • Set VariableSet Leap_DistanceTraveled[Leap_Loop] = (Leap_DistanceTraveled[Leap_Loop] + Leap_Speed[Leap_Loop])
          • Set VariableSet Leap_PointA = (Position of Leap_Caster[Leap_Loop])
          • Set VariableSet Leap_PointB = (Leap_PointA offset by Leap_Speed[Leap_Loop] towards Leap_Angle[Leap_Loop] degrees.)
          • -------- --------
          • -------- Check if caster can move to the next position: --------
          • Custom script: set udg_IsTerrainWalkable = IsTerrainWalkableLoc(udg_Leap_PointB)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IsTerrainWalkable Equal to True
            • Then - Actions
              • -------- Move caster: --------
              • Custom script: call SetUnitX(udg_Leap_Caster[udg_Leap_Loop], GetLocationX(udg_Leap_PointB) )
              • Custom script: call SetUnitY( udg_Leap_Caster[udg_Leap_Loop], GetLocationY(udg_Leap_PointB) )
              • -------- --------
              • -------- Damage nearby enemy units: --------
              • Set VariableSet Leap_Group = (Units within Leap_AreaOfEffect[Leap_Loop] of Leap_PointB.)
              • Unit Group - Pick every unit in Leap_Group and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) belongs to an enemy of (Owner of Leap_Caster[Leap_Loop]).) Equal to True
                      • ((Picked unit) is alive) Equal to True
                      • ((Picked unit) is A structure) Equal to False
                      • ((Picked unit) is A flying unit) Equal to False
                      • ((Picked unit) is invulnerable) Equal to False
                    • Then - Actions
                      • Unit - Cause Leap_Caster[Leap_Loop] to damage (Picked unit), dealing Leap_Damage[Leap_Loop] damage of attack type Spells and damage type Normal
                    • Else - Actions
            • Else - Actions
              • -------- Damage nearby enemy units: --------
              • Set VariableSet Leap_Group = (Units within Leap_AreaOfEffect[Leap_Loop] of Leap_PointA.)
              • Unit Group - Pick every unit in Leap_Group and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) belongs to an enemy of (Owner of Leap_Caster[Leap_Loop]).) Equal to True
                      • ((Picked unit) is alive) Equal to True
                      • ((Picked unit) is A structure) Equal to False
                      • ((Picked unit) is A flying unit) Equal to False
                      • ((Picked unit) is invulnerable) Equal to False
                    • Then - Actions
                      • Unit - Cause Leap_Caster[Leap_Loop] to damage (Picked unit), dealing Leap_Damage[Leap_Loop] damage of attack type Spells and damage type Normal
                    • Else - Actions
          • -------- --------
          • -------- Remove memory leaks: --------
          • Custom script: call RemoveLocation(udg_Leap_PointA)
          • Custom script: call RemoveLocation(udg_Leap_PointB)
          • Custom script: call DestroyGroup(udg_Leap_Group)
          • -------- --------
          • -------- Leap is finished: --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Leap_DistanceTraveled[Leap_Loop] Greater than or equal to Leap_MaxDistance[Leap_Loop]
            • Then - Actions
              • -------- Unstun the caster and reset it's animation: --------
              • Custom script: call BlzPauseUnitEx(udg_Leap_Caster[udg_Leap_Loop], false)
              • Animation - Reset Leap_Caster[Leap_Loop]'s animation
              • -------- --------
              • -------- Remove this current instance of the spell from the loop: --------
              • Set VariableSet Leap_Angle[Leap_Loop] = Leap_Angle[Leap_Index]
              • Set VariableSet Leap_Caster[Leap_Loop] = Leap_Caster[Leap_Index]
              • Set VariableSet Leap_Speed[Leap_Loop] = Leap_Speed[Leap_Index]
              • Set VariableSet Leap_DistanceTraveled[Leap_Loop] = Leap_DistanceTraveled[Leap_Index]
              • Set VariableSet Leap_MaxDistance[Leap_Loop] = Leap_MaxDistance[Leap_Index]
              • Set VariableSet Leap_Damage[Leap_Loop] = Leap_Damage[Leap_Index]
              • Set VariableSet Leap_AreaOfEffect[Leap_Loop] = Leap_AreaOfEffect[Leap_Index]
              • Set VariableSet Leap_Index = (Leap_Index - 1)
              • Set VariableSet Leap_Loop = (Leap_Loop - 1)
              • -------- --------
              • -------- Disable the periodic interval if no leaps are active: --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Leap_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
You probably want to end it prematurely if the hero dies during the "leap". It was originally based on Mirana's Leap hence the name.
 

Attachments

  • Leap Example.w3m
    24 KB · Views: 15
Last edited:
Status
Not open for further replies.
Top