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!
I mean so that I can pick them directly from a Unit Production Facility and teleport them and the Waypoint set at the first facility still applies? Is there a solution...
a unit finishes training
set tempPoint1 = rally point of "trainer"
set tempPoint2 = teleport to wherever
unit move trained unit to tempPoint2
unit order unit to move to tempPoint1
remove leaks
a unit finishes training
set tempPoint1 = rally point of "trainer"
set tempPoint2 = teleport to wherever
unit move trained unit to tempPoint2
unit order unit to move to tempPoint1
remove leaks
Use the JASS only functions "SetUnitX" and "SetUnitY".
Their declarations are given below.
JASS:
native SetUnitX takes unit whichUnit,real newX returns nothing
native SetUnitY takes unit whichUnit,real newY returns nothing
What they do is instantly move whichUnit to the new cord. No pathing checks are run in doing so. The units current orders are not interrupted so if it was going to a waypoint it should still keep trying to move there. For a brief moment the unit might act funny and do something like walking in the wrong direction however that should quickly auto correct the next pathfinder tick it is given by the game engine.
If you are not used to JASS scripting you can call these functions like this.
All you need to do is before calling them set the global variable "AUNIT" of type unit to the unit you want to move, the global variable "AREALA" of type real to the X cord of the point you want to move to and the global variable "AREALB" of type real to the Y cord of the point you want to move to.
Use the JASS only functions "SetUnitX" and "SetUnitY".
Their declarations are given below.
JASS:
native SetUnitX takes unit whichUnit,real newX returns nothing
native SetUnitY takes unit whichUnit,real newY returns nothing
What they do is instantly move whichUnit to the new cord. No pathing checks are run in doing so. The units current orders are not interrupted so if it was going to a waypoint it should still keep trying to move there. For a brief moment the unit might act funny and do something like walking in the wrong direction however that should quickly auto correct the next pathfinder tick it is given by the game engine.
If you are not used to JASS scripting you can call these functions like this.
All you need to do is before calling them set the global variable "AUNIT" of type unit to the unit you want to move, the global variable "AREALA" of type real to the X cord of the point you want to move to and the global variable "AREALB" of type real to the Y cord of the point you want to move to.
Thanks for the precise answer.
But what to do when you have multiple Unit Types... I got like 12 different which all need to be moved. And can I somehow check for player colour of moved unit? Do I need to do the Triggercode 12 times ?
So with native I would have to write
which_unit = Orc (Object Editor Name (?))
NewX = xcoordinates
NewY = ycoordinates (how do I look coordinates up btw?)
So with native I would have to write
which_unit = Orc (Object Editor Name (?))
NewX = xcoordinates
NewY = ycoordinates (how do I look coordinates up btw?)
All you need to do is before calling them set the global variable "AUNIT" of type unit to the unit you want to move, the global variable "AREALA" of type real to the X cord of the point you want to move to and the global variable "AREALB" of type real to the Y cord of the point you want to move to.
As the game only runs correct JASS code and like scripting languages it has a very precise syntax.
But what to do when you have multiple Unit Types... I got like 12 different which all need to be moved. And can I somehow check for player colour of moved unit? Do I need to do the Triggercode 12 times ?
You use the same trigger that works for all 12 unit types. Although some form of case like binary search would probably be fastest, you can simply perform a linear test against all of the unit types to see if it is applicable for movement. You probably can check the player colour of units however I would rather recommend checking the owner player (for a value or inside a force (player group)).
Where AUNIT is the unit you want to move and APOINT is the location (point) you want to move it to. Do remember that locations are not destroyed automatically so unless you use a constant location for movement (such as a spawn point) then you will need to remove them after you are done using them to prevent leaks.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.