• 🏆 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] Is there a way to make slide/charge skills follow "pathing"? or a way to disable manual moving units

Status
Not open for further replies.
Level 3
Joined
May 5, 2007
Messages
21
Hello, I'm trying to do a map where unit movement is handled by the "ai" but you can still cast abilities.

my first idea was to set movement speed to 1 so they are able to turn and use a charge spell(based on channel and hidden so only triggers could proc it) to move my units move around.

however I encountered a problem where making a unit slide, its doesn't path and tries to move forward regardless, see example:

d956f4ab19.gif

is there a way to emulate sliding units to follow the same pathing logic as regular moving? if this is to complex, is there already a working slide system like this or is there a better way to disable manual movement for units while still retain the ability to use items/spells?

  • presetup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Move_Hashtable = (Last created hashtable)
      • -------- animation setup --------
      • Set Animation_Index_Max_Count = 1
      • Set Animation_Index_Unit_Type[1] = Footman
      • Set Animation_Index_number_walk[1] = 6
      • Set Animation_Index_number_attack[1] = 4
  • Cast Charge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge
      • (Mana of (Triggering unit)) Greater than or equal to 4.00
    • Actions
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - 4.00)
      • Set temp_location[0] = (Position of (Triggering unit))
      • Set temp_location[1] = (Position of (Target unit of ability being cast))
      • Set temp_group = (Units within 150.00 of temp_location[0] matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is invulnerable) Equal to False) and (((Match)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (temp_group is empty) Equal to False
        • Then - Actions
          • Set temp_unit = (Random unit from temp_group)
          • Hashtable - Save Handle Oftemp_unit as (Key target) of (Key (Triggering unit)) in Move_Hashtable
          • Unit - Order (Triggering unit) to Special - Channel
          • Unit - Make (Triggering unit) face temp_unit over 0.00 seconds
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between temp_location[0] and temp_location[1]) Less than or equal to 150.00
            • Then - Actions
              • Hashtable - Save Handle Of(Target unit of ability being cast) as (Key target) of (Key (Triggering unit)) in Move_Hashtable
              • Unit - Order (Triggering unit) to Special - Channel
            • Else - Actions
              • Unit Group - Add (Triggering unit) to Move_Group_runner
              • Hashtable - Save Handle Of(Target unit of ability being cast) as (Key target) of (Key (Triggering unit)) in Move_Hashtable
              • Set temp_unit = (Triggering unit)
              • Unit - Pause (Triggering unit)
              • For each (Integer A) from 1 to Animation_Index_Max_Count, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Triggering unit)) Equal to Animation_Index_Unit_Type[(Integer A)]
                    • Then - Actions
                      • Set temp_integer = Animation_Index_number_walk[(Integer A)]
                    • Else - Actions
              • Custom script: call SetUnitAnimationByIndex(udg_temp_unit, udg_temp_integer)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (move <gen> is on) Equal to False
                • Then - Actions
                  • Trigger - Turn on move <gen>
                • Else - Actions
      • Custom script: call RemoveLocation(udg_temp_location[0])
      • Custom script: call RemoveLocation(udg_temp_location[1])
      • Custom script: call DestroyGroup(udg_temp_group)
  • move
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Move_Group_runner is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in Move_Group_runner and do (Actions)
            • Loop - Actions
              • Set temp_unit = (Load (Key target) of (Key (Picked unit)) in Move_Hashtable)
              • Set temp_location[0] = (Position of (Picked unit))
              • Set temp_location[1] = (Position of temp_unit)
              • Set temp_location[2] = (temp_location[0] offset by 10.00 towards (Angle from temp_location[0] to temp_location[1]) degrees)
              • Unit - Move (Picked unit) instantly to temp_location[2], facing (Angle from temp_location[0] to temp_location[1]) degrees
              • Set temp_group = (Units within 150.00 of temp_location[2] matching ((((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is alive) Equal to True
                  • (temp_unit is alive) Equal to True
                  • (temp_group is empty) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between temp_location[0] and temp_location[1]) Less than or equal to 150.00
                    • Then - Actions
                      • Animation - Reset (Picked unit)'s animation
                      • Unit Group - Remove (Picked unit) from Move_Group_runner
                      • Unit - Unpause (Picked unit)
                      • Unit - Order (Picked unit) to Special - Channel
                    • Else - Actions
                • Else - Actions
                  • Unit Group - Remove (Picked unit) from Move_Group_runner
                  • Unit - Unpause (Picked unit)
                  • Animation - Reset (Picked unit)'s animation
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Move_Hashtable
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (temp_group is empty) Equal to False
                    • Then - Actions
                      • Set temp_unit = (Random unit from temp_group)
                      • Hashtable - Save Handle Oftemp_unit as (Key target) of (Key (Picked unit)) in Move_Hashtable
                      • Unit - Order (Picked unit) to Special - Channel
                      • Unit - Make (Picked unit) face temp_unit over 0.00 seconds
                    • Else - Actions
              • Custom script: call DestroyGroup(udg_temp_group)
              • Custom script: call RemoveLocation(udg_temp_location[0])
              • Custom script: call RemoveLocation(udg_temp_location[1])
              • Custom script: call RemoveLocation(udg_temp_location[2])

  • damage
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to attack
    • Actions
      • Unit - Cause (Triggering unit) to damage (Load (Key target) of (Key (Triggering unit)) in Move_Hashtable), dealing 5.00 damage of attack type Spells and damage type Normal
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Move_Hashtable


note: units doesn't need to be controllable while it moves, as this will only be occurring if a unit is outside of range of another unit.
 

Attachments

  • charge spell example2.w3x
    24.9 KB · Views: 25
Level 12
Joined
Feb 22, 2010
Messages
1,115
or is there a better way to disable manual movement for units while still retain the ability to use items/spells?

If you replace
  • Unit - Move (Picked unit) instantly to temp_location[2], facing (Angle from temp_location[0] to temp_location[1]) degrees
with
  • Custom script: call SetUnitX(GetEnumUnit(), GetLocationX(udg_temp_location[2]))
  • Custom script: call SetUnitY(GetEnumUnit(), GetLocationY(udg_temp_location[2]))
  • // also set the facing angle
Units can move, use items/abilities while they are being moved. You may also prevent any move/attack/smart orders while unit is sliding (issue a stop order when any of these event occur).

As for movement with triggers while follow pathing, easiest solution I can think is creating an invisible unit, order it to move from point A to point B, make your actual unit follow it with triggered movement. Not sure how good it can work, but I can not think any easy solution.
 
Level 3
Joined
May 5, 2007
Messages
21
If you replace
  • Unit - Move (Picked unit) instantly to temp_location[2], facing (Angle from temp_location[0] to temp_location[1]) degrees
with
  • Custom script: call SetUnitX(GetEnumUnit(), GetLocationX(udg_temp_location[2]))
  • Custom script: call SetUnitY(GetEnumUnit(), GetLocationY(udg_temp_location[2]))
  • // also set the facing angle
Units can move, use items/abilities while they are being moved. You may also prevent any move/attack/smart orders while unit is sliding (issue a stop order when any of these event occur).

As for movement with triggers while follow pathing, easiest solution I can think is creating an invisible unit, order it to move from point A to point B, make your actual unit follow it with triggered movement. Not sure how good it can work, but I can not think any easy solution.

thx for the tip about SetUnitX/y.

hmm creating a prerunner wouldn't be such a bad idea assuming he moves fast enough.. might give it a try
 
Level 8
Joined
May 21, 2019
Messages
435
Natural unit movement speed has a cap of 512, which you cannot exceed. If you're setting position with triggers you can of course go as fast as you want.
Any word on whether Blizzard has considered implementing movement speeds above 512 and movement speed 0?
 
Status
Not open for further replies.
Top