Being a fairly educated man I'm quite ashamed to ask for help on this point...
Following Bribe's advice, I am changing my custom movement system from using a giant array of points to just using 2 locations that I move with the MoveLocation JASS command. I hit a bit of a snag and am hoping someone can help me translate the following code so that it doesn't use any points.
The following section of a trigger is meant to get the location of a moving unit (u), and move it by tempSpeed in the direction that it's facing. Because the trigger fires every .02 seconds, it's important that it be written efficiently, which is the point of all the changes. Here's what I have so far:
The last four lines are what needs help. As it's written, tempPointOffset is the point variable that stores where unit "u" will be moved to.
I would like to change the code so that I just move LocationMove1 by tempSpeed in the direction that "u" is facing, but I don't know the geometry to do that (hence the shame). Then I could use the SetUnitX commands to move "u" to LocationMove1.
Thank you very much for your help.
Darwin
Following Bribe's advice, I am changing my custom movement system from using a giant array of points to just using 2 locations that I move with the MoveLocation JASS command. I hit a bit of a snag and am hoping someone can help me translate the following code so that it doesn't use any points.
The following section of a trigger is meant to get the location of a moving unit (u), and move it by tempSpeed in the direction that it's facing. Because the trigger fires every .02 seconds, it's important that it be written efficiently, which is the point of all the changes. Here's what I have so far:
- Custom script: set udg_x = GetUnitX(udg_u)
- Custom script: set udg_y = GetUnitY(udg_u)
- Custom script: call MoveLocation(udg_LocationMove1, udg_x, udg_y)
- Set tempPointOffset = (LocationMove1 offset by tempSpeed towards (Facing of u) degrees)
- Custom script: call SetUnitX (udg_u, GetLocationX (udg_tempPointOffset))
- Custom script: call SetUnitY (udg_u, GetLocationY (udg_tempPointOffset))
- Custom script: call RemoveLocation (udg_tempPointOffset)
The last four lines are what needs help. As it's written, tempPointOffset is the point variable that stores where unit "u" will be moved to.
I would like to change the code so that I just move LocationMove1 by tempSpeed in the direction that "u" is facing, but I don't know the geometry to do that (hence the shame). Then I could use the SetUnitX commands to move "u" to LocationMove1.
Thank you very much for your help.
Darwin