• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How to use x/y custom script to move certain units.

Status
Not open for further replies.
call SetUnitX(whichUnit, 0)
call SetUnitY(whichUnit, 0)

You can put these two lines into "Custom scrip", as I assume you use GUI.
It would move the unit to coordinates 0/0. Replace whichunit with the unit you need.

If you are not sure by what you have to replace whichunit, you can use a unit variable in GUI:
  • Set myUnit = Triggering Unit
  • Custom script: call SetUnitX(udg_myUnit, 0)
^This will move the unit that is stored in the variable "myUnit" to x-cooridante "0".
 
Level 7
Joined
Mar 6, 2014
Messages
203
call SetUnitX(whichUnit, 0)
call SetUnitY(whichUnit, 0)

You can put these two lines into "Custom scrip", as I assume you use GUI.
It would move the unit to coordinates 0/0. Replace whichunit with the unit you need.

If you are not sure by what you have to replace whichunit, you can use a unit variable in GUI:
  • Set myUnit = Triggering Unit
  • Custom script: call SetUnitX(udg_myUnit, 0)
^This will move the unit that is stored in the variable "myUnit" to x-cooridante "0".

how about i want unit move forward?
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
Irrelevant. Just use your normal GUI location variable, just replace the actual move action.

something like this if you want to try DSG's idea.
  • Actions
  • Actions
    • Set yourUnit = (Triggering unit)
    • Set yourLoc = (Position of yourUnit)
    • Set yourLoc2 = (yourLoc offset by 5.00 towards (Facing of yourUnit) degrees)
    • Custom script: call SetUnitX(udg_yourUnit , GetLocationX(udg_yourLoc2))
    • Custom script: call SetUnitY(udg_yourUnit , GetLocationY(udg_yourLoc2))

Something like that.
 
Status
Not open for further replies.
Top