• 🏆 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] Converting Unit - Move to point, so that it no longer interrupts orders and animation

Status
Not open for further replies.
Level 12
Joined
Oct 10, 2009
Messages
438
Ohai! First of all, I would love some help in converting this trigger (See below) So it uses the jass command [Move x Y] (I think thats the command) Basically, at the moment, this trigger intterrupts any animations and orders the unit was using, And I do not want it to be so.

<3 if you help

  • Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in KB_Move and do (Actions)
        • Loop - Actions
          • Set KB_Active = True
          • Set MovementDistance = ((Load (Key Distance) of (Key (Picked unit)) from Hastable) + 1.00)
          • Set MovementTime = (Load (Key Duration) of (Key (Picked unit)) from (Last created hashtable))
          • Set MovementNow = (10.00 x MovementTime)
          • Set MovementAngle = (Load (Key Angle) of (Key (Picked unit)) from Hastable)
          • Set Point[0] = (Position of (Picked unit))
          • Set Point[1] = (Point[0] offset by MovementNow towards MovementAngle degrees)
          • Unit - Move (Picked unit) instantly to Point[1]
          • Set MovementTime = (MovementTime - 0.03)
          • Hashtable - Save MovementTime as (Key Duration) of (Key (Picked unit)) in Hastable
          • Set MovementTime = (MovementDistance - MovementNow)
          • Hashtable - Save MovementTime as (Key Distance) of (Key (Picked unit)) in Hastable
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MovementTime Less than or equal to 0.10
            • Then - Actions
              • Unit Group - Remove (Picked unit) from KB_Move
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hastable
            • Else - Actions
          • Custom script: call RemoveLocation(udg_Point[1])
          • Custom script: call RemoveLocation(udg_Point[0])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • KB_Active Equal to False
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Set KB_Active = False
 
Level 10
Joined
Jul 12, 2009
Messages
318
Instead of Unit - Move (Picked unit) instantly to Point[1], use these two lines:
  • Custom script: call SetUnitX(GetEnumUnit(), GetLocationX(udg_Point[1]))
  • Custom script: call SetUnitY(GetEnumUnit(), GetLocationY(udg_Point[1]))
GetEnumUnit() is the JASS corresponding to (Picked unit), and SetUnitX/Y are the functions to move a unit without interruption.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You move an item to the x/y first, then you center a region there. Then you have certain tolerance with the region, if the item is inside the region then the point is pathable. Use one global item and region. Unhide the item before moving it, hode it after the check.

I think there's a system for that.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
but this will only detect points which are pathable for items
so a knockback could be blocked by placing an item behind oneself which would be lame
every item in the region should be picked and hidden first and unhidden afterwards
furthermore a unit could be knocked back through 16x16 spaces (item size imho) which could be abused in some cases
to fix this one could check multiple points around target point
all in all this is not much faster than SetUnitPosition anymore but it does not cancel orders
 
Level 12
Joined
Oct 10, 2009
Messages
438
You move an item to the x/y first, then you center a region there. Then you have certain tolerance with the region, if the item is inside the region then the point is pathable. Use one global item and region. Unhide the item before moving it, hode it after the check.

I think there's a system for that.

Alright, I understand it. +rep

Although, it would be annoying to make xD


Edit: Mind just asploded by Gandalfs comment. Going to take me a few minutes to digest it.
 
Status
Not open for further replies.
Top