• 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.

Custom script that i need...

Status
Not open for further replies.
Level 14
Joined
Aug 8, 2010
Messages
1,022
Hello, guys! It's quick and simple. How was the exact thing i had to type to get a location's X and Y and move a unit to it? I need this because the GUI action "Unit - Move unit (Instantly)" resets the action of the moved unit (makes it stop moving, channeling, etc.) but i don't need this. I need the unit to only be moved, not stopped. So this custom script solves my problem, but i forgot what was the exact function call (cuz' GUI is my side)...

Help, please! :D
 
ruler, you put "call" before custom script. It should be the other way around. ;)

  • Set MyUnit = (Triggering Unit)
  • Set TempPoint = Position of (My Unit)
  • Custom script: call SetUnitX(udg_MyUnit, GetLocationX(udg_TempPoint))
  • Custom script: call SetUnitY(udg_MyUnit, GetLocationY(udg_TempPoint))
  • Custom script: call RemoveLocation(udg_TempPoint)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
  • Custom script: call SetUnitX(udg_MyUnit, GetLocationX(udg_TempPoint))
  • Custom script: call SetUnitY(udg_MyUnit, GetLocationY(udg_TempPoint))
Although this is the script that he wanted, this could be further improvised, if you want;

  • Custom script: call SetUnitX(udg_YourUnit, GetUnitX(udg_YourUnit) + udg_OffsetValue * Cos(udg_MovingAngle * bj_DEGTORAD))
  • Custom script: call SetUnitY(udg_YourUnit, GetUnitY(udg_YourUnit) + udg_OffsetValue * Sin(udg_MovingAngle * bj_DEGTORAD))
You can eliminate the use of Locations, which is replaced by Reals.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Yyyyyyyyyeah... after defskull mentioned the idea of replacing locations with reals, i just simply stopped understanding what you guys are talking about. Jass is a real mindfucker for me. :D Besides... Cos, Sin, Pow, what the hell are those? I know they are math thingies (i am not sure for Pow), however, i don't yet have the privilege to know them... Fkn 9-th grade is coming...
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
No, it's not. It's a very light function and using locations would require using those functions too.
In other words to compare my method and Purge, mine is more efficient
But to compare mine and vector, vector is more efficient ?
But I think there would be some serious calculations involved if we use vector, is it ? Or no ?
If it is, well I think my method works the best (for this current stage).

Yyyyyyyyyeah... after defskull mentioned the idea of replacing locations with reals, i just simply stopped understanding what you guys are talking about. Jass is a real mindfucker for me. :D Besides... Cos, Sin, Pow, what the hell are those? I know they are math thingies (i am not sure for Pow), however, i don't yet have the privilege to know them... Fkn 9-th grade is coming...
No need to throw out those curses ^_^
Just follow the Custom script, it's not that hard.
You should not try to understand it now, once you get used to it, you need to understand it.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
In other words to compare my method and Purge, mine is more efficient
But to compare mine and vector, vector is more efficient ?
But I think there would be some serious calculations involved if we use vector, is it ? Or no ?
If it is, well I think my method works the best (for this current stage).
It's always better not to use locations.
Using vectors would be as simple as
JASS:
SetUnitX(Unit, GetUnitX(Unit) + Vector.x)
SetUnitY(Unit, GetUnitY(Unit) + Vector.y)
atleast for the loop part. Though it probably wouldn't be more efficient if the angle isn't constant.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
It's always better not to use locations.
Using vectors would be as simple as
JASS:
SetUnitX(Unit, GetUnitX(Unit) + Vector.x)
SetUnitY(Unit, GetUnitY(Unit) + Vector.y)
atleast for the loop part. Though it probably wouldn't be more efficient if the angle isn't constant.

Haha, you should at least show us where that "Vector.x/y" comes from @.@"
I mean how it is formed.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
No need to throw out those curses ^_^
Just follow the Custom script, it's not that hard.
You should not try to understand it now, once you get used to it, you need to understand it.
Curses? Where? I don't know a civilized word with the meaning of "mindfuck". :eekani: Perhaps "mindsap" or something...

About the custom script - i kinda got it... :p
 
Status
Not open for further replies.
Top