[Spell] Problem with SetUnitX and Y

Status
Not open for further replies.
Level 12
Joined
May 16, 2020
Messages
660
Hi guys,

Since I learned that SetUnitX and Y is better than just using "move unit to x", I'm trying to use it whenever possible.

This spell is giving me troubles however. For some reason the to-be moved units always move to the middle of the map, not the specified point. What am I doing wrong?

  • Reverse Polarity
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Reverse Polarity
    • Actions
      • Set VariableSet ReversePolarity_Caster = (Triggering unit)
      • Set VariableSet ReversePolarity_Point[1] = (Position of ReversePolarity_Caster)
      • Set VariableSet ReversePolarity_Point[2] = (ReversePolarity_Point[1] offset by 150.00 towards (Facing of ReversePolarity_Caster) degrees.)
      • Set VariableSet RealityRift_Pos_X = (X of ReversePolarity_Point[2])
      • Set VariableSet RealityRift_Pos_Y = (Y of ReversePolarity_Point[2])
      • -------- --------
      • Special Effect - Create a special effect at ReversePolarity_Point[1] using war3mapImported\Void Rift II Orange.mdl
      • Set VariableSet ReversePolarity_SFX = (Last created special effect)
      • Special Effect - Set Scale of ReversePolarity_SFX to 2.00
      • Special Effect - Set Position - Z of ReversePolarity_SFX to 90.00
      • Special Effect - Destroy ReversePolarity_SFX
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 425.00 of ReversePolarity_Point[1].) and do (Actions)
        • Loop - Actions
          • Set VariableSet ReversePolarity_UnitTemp = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ReversePolarity_UnitTemp is alive) Equal to True
              • (ReversePolarity_UnitTemp is A structure) Equal to False
              • (ReversePolarity_UnitTemp is An Ancient) Equal to False
              • (ReversePolarity_UnitTemp belongs to an enemy of (Owner of ReversePolarity_Caster).) Equal to True
            • Then - Actions
              • Custom script: call SetUnitX(udg_ReversePolarity_UnitTemp, udg_ReversePolarity_Pos_X)
              • Custom script: call SetUnitY(udg_ReversePolarity_UnitTemp, udg_ReversePolarity_Pos_Y)
            • Else - Actions
      • Custom script: call RemoveLocation (udg_ReversePolarity_Point[1])
      • Custom script: call RemoveLocation (udg_ReversePolarity_Point[2])
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I don't see any issues but for Reverse Polarity you probably want to use Move Unit Instantly since the units are stunned anyway. I don't think RP works like Vacuum or other skills that ignore collision when moving units.

Also, very minor optimization, you can change Owner of ReversePolarity_Caster to Triggering Player.
 
Status
Not open for further replies.
Top