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

Is There a function like SetX and Y?

Status
Not open for further replies.
Level 11
Joined
Aug 6, 2009
Messages
697
I'm using the location as part of a knockback spell but so far everything I've tried hasnt been working.
I've checked walkability and set the offset to negative but it still doesnt work.

  • Unit Group - Pick every unit in HR_Group[LoopIndex[4]] and do (Actions)
    • Loop - Actions
      • Set Unit = (Picked unit)
      • Set TempPoint = (Position of Unit)
      • Set TempReal = (Angle from HR_Point[LoopIndex[4]] to TempPoint)
      • If ((Random integer number between 1 and 3) Equal to 1) then do (Special Effect - Create a special effect attached to the origin of (Picked unit) using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl) else do (Do nothing)
      • Special Effect - Destroy (Last created special effect)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at TempPoint2 of type Walkability is off) Not equal to True
        • Then - Actions
          • Set TempPoint2 = (TempPoint offset by 25.00 towards TempReal degrees)
          • Set TempReal = (X of TempPoint2)
          • Custom script: call SetUnitX(udg_Unit, udg_TempReal)
          • Set TempReal = (Y of TempPoint2)
          • Custom script: call SetUnitY(udg_Unit, udg_TempReal)
          • Custom script: call RemoveLocation(udg_TempPoint2)
        • Else - Actions
          • Set TempPoint2 = (TempPoint offset by -25.00 towards TempReal degrees)
          • Set TempReal = (X of TempPoint2)
          • Custom script: call SetUnitX(udg_Unit, udg_TempReal)
          • Set TempReal = (Y of TempPoint2)
          • Custom script: call SetUnitY(udg_Unit, udg_TempReal)
          • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: call RemoveLocation(udg_TempPoint)
SetUnitPosition checks pathing and will try to displace as much as possible.

Problem is it also issues a "stop" order.

This was what I was looking for but if it uses the stop order then I'm not going to have much use for it :(
 
Last edited:

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
SetUnitPosition checks pathing and will try to displace as much as possible.

Problem is it also issues a "stop" order.

That's not what I am saying. I am saying that the location itself doesn't give a fuck about pathing.

If I got postion(x,y) the x/y values are not changed depending on pathing. However if you create/move something there, pathing might affect the object.

edit: just turn unit collision off?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Your sentence was not very clear. I took it in the scope of the function this topic is about and not location objects in general.

In this case SetUnitPositionLoc will test the pathing of the location when moving the unit.

That said the topic had nothing to do with locations as it was actually about XY coordinates.
 
Status
Not open for further replies.
Top