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
native SetUnitX takes unit whichUnit,real newX returns nothing
native SetUnitY takes unit whichUnit,real newY returns nothing
call SetUnitX(udg_AUNIT, udg_AREALA)
call SetUnitY(udg_AUNIT, udg_AREALB)
Use the JASS only functions "SetUnitX" and "SetUnitY".
Their declarations are given below.
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.JASS:native SetUnitX takes unit whichUnit,real newX returns nothing native SetUnitY takes unit whichUnit,real newY returns nothing
If you are not used to JASS scripting you can call these functions like this.
JASS:call SetUnitX(udg_AUNIT, udg_AREALA) call SetUnitY(udg_AUNIT, udg_AREALB)
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.
No you do as I told you.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?)
Before calling these two lines of custom script.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.
call SetUnitX(udg_AUNIT, udg_AREALA)
call SetUnitY(udg_AUNIT, udg_AREALB)
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)).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 can get them from a location (point). I am not sure if GUI has the functions but they do certainly exist in JASS.(how do I look coordinates up btw?)
native GetLocationX takes location whichLocation returns real
native GetLocationY takes location whichLocation returns real
call SetUnitX(udg_AUNIT, GetLocationX(udg_APOINT))
call SetUnitY(udg_AUNIT, GetLocationY(udg_APOINT))
That was an example of doing it in GUI..Can you give an example code I did not learn jess yet though I have a basic understanding of Coding. Would be really nice XD
No it was not.That was an example of doing it in GUI..
Violates his requirements of this...unit move trained unit to tempPoint2
Since rally points need not target points.teleport them and the Waypoint set at the first facility still applies
You can command workers to build and harvest Lumber or mine Gold by setting the Rally Point of the Town Hall on trees or the Gold Mine.
Rally Points can be set on any unit.
Rally Points set on transports or Orc Burrows will cause the newly built units to load into them.