

![]() |
![]() |
|
|||||||
![]() |
![]() |
| Challenges Weekly competition topics and submissions |
![]() |
|
|
LinkBack | Thread Tools |
![]() |
![]() |
|
|
#1 (permalink) |
|
Arbiter
Senior Member
Retired Staff Member ![]() ![]() ![]() Blessed Join Date: Apr 2004
Posts: 2,092
![]() ![]() ![]() |
Howdy,
I saw this in a thread here, but I believe the idea is quite old. Here's my variant. Hack: Set Formation Support 8 types of formations: 1) Line 2) Chevron 3) Inverted Chevron Here's how this should work. Have a hotkey cycle the various formations. Select a unit, press a hotkey (save this unit in your hack). Next, move your mouse a distance away and then press hotkey again. Now, "imagine" drawing a line from the unit you saved, to the current X,Y of the mouse (world cords, not screen cords). Find the length of this line and set it as SPACE_AMOUNT. Then move the selected units into that formation using the line as a directional pointer. That is all that is required. Ie. if your selected unit is in the middle of the screen, and you click DUE North of him, and say your formation is line. The pattern they should be moved to is: Code:
(mouse click here)
/\
|
|
|
X X X X X X X X X X X X
None. Good luck.
__________________
![]() My signature is back!! Hell YES! Click the link, I DEMAND YOU! :-D http://www.bwhacks.com/forums/showthread.php?t=24873 |
|
|
|
![]() |
![]() |
|
Advertisement
|
|
![]() |
![]() |
|
|
#2 (permalink) | ||
|
The Sexy Penguin
Senior Member
Retired Staff Member ![]() ![]() ![]() Prophet |
Chevron:
Code:
X
X X
X X
X X
Code:
X X
X X
X X
X
Code:
X
X
X
X
X
X
X
Code:
X
X
X
X
X
X
X
__________________
Quote:
LCS, 707, BELPHEGOR YEEEEEEEH BITCH Quote:
|
||
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#3 (permalink) | ||
|
The Sexy Penguin
Senior Member
Retired Staff Member ![]() ![]() ![]() Prophet |
If anyone is going to make the formations movable I'd approach it like this:
First get the coordinates of the leader unit (the center one / the one at the point of the formation) and get the difference between the unit's XY and the action / movement's XY. Then add the difference in XY to all, this is pretty much an application of some simple math (translations on a graph). Here is an Example of this where the unit at the center of the formation is located at (0,0) and the action is at (0,3). You'd add 0 to the X value and 3 to the Y value of each point (See the first two images attached). If the main unit's located a (0,0) and another is at (-1,-1) and you move to (-5,6) the other point would move to (-6,5) because you add -5 to each X value and 6 to each Y value (See the third image).
__________________
Quote:
LCS, 707, BELPHEGOR YEEEEEEEH BITCH Quote:
Last edited by LCSBSSRHXXX : 01-30-2007 at 12:54 AM. |
||
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#4 (permalink) | ||
|
The Sexy Penguin
Senior Member
Retired Staff Member ![]() ![]() ![]() Prophet |
Now to rotate the formation of units you need to get the new points using the equation to rotate get the new set of points (X',Y').
Code:
X'=(cos(θ)*X) - (sin(θ)*Y) Y'=(sin(θ)*X) + (cos(θ)*Y) θ=theta (the angle that you want to rotate it). Edit: Drawings are done, I only did an example with 3 points because it's less math but it will still give you a good idea of how to approach it. Basically you click at (4,4) and it gets the angle by doing the inverse cosine of the adjacent side over the hypotenuse, which gives you theta, once you have the angle you just use the rotation equation posted above.
__________________
Quote:
LCS, 707, BELPHEGOR YEEEEEEEH BITCH Quote:
Last edited by LCSBSSRHXXX : 01-30-2007 at 12:54 AM. |
||
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#6 (permalink) |
|
Arbiter
Senior Member
Retired Staff Member ![]() ![]() ![]() Blessed Join Date: Apr 2004
Posts: 2,092
![]() ![]() ![]() |
Nah, i think that's ok.
__________________
![]() My signature is back!! Hell YES! Click the link, I DEMAND YOU! :-D http://www.bwhacks.com/forums/showthread.php?t=24873 |
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#8 (permalink) |
|
Arbiter
Senior Member
Retired Staff Member ![]() ![]() ![]() Blessed Join Date: Apr 2004
Posts: 2,092
![]() ![]() ![]() |
Too everyone: Please post if you plan on entering.
__________________
![]() My signature is back!! Hell YES! Click the link, I DEMAND YOU! :-D http://www.bwhacks.com/forums/showthread.php?t=24873 |
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#9 (permalink) | |||
|
The Sexy Penguin
Senior Member
Retired Staff Member ![]() ![]() ![]() Prophet |
Quote:
![]()
__________________
Quote:
LCS, 707, BELPHEGOR YEEEEEEEH BITCH Quote:
|
|||
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#12 (permalink) |
|
Arbiter
Senior Member
Retired Staff Member ![]() ![]() ![]() Blessed Join Date: Apr 2004
Posts: 2,092
![]() ![]() ![]() |
By the way, rotation is not required, that is merly extra credit.
__________________
![]() My signature is back!! Hell YES! Click the link, I DEMAND YOU! :-D http://www.bwhacks.com/forums/showthread.php?t=24873 |
|
|
|
![]() |
![]() |