# [General]Angle between

Status
Not open for further replies.

#### Aeroblyctos

Level 37
Hey,

How I make angle between East and South? And what about North and East?

Warcraft 3 angles are:

North: 90
East: 0
South: 180
West: 270

D

#### Deleted member 219079

Get a random real between 270 and 360. 0 to 90 for north to east.

#### Wietlol

Level 24
I dont really understand your question.

Angle is a real value between 0 and 360 that indeed starts to east and increases against the clock.

An angle to east is equal to 0 AND 360 as these are the same.
An angle to north is equal to 90.
An angle to west is equal to 180.
An angle to south is equal to 270.

If you want an angle to a point somewhere to the south-east, you have an angle pointing to 270 til 360 degrees.
415 degrees is exacly the middle.

Pointing north east is somewhere between 0 and 90 and 45 is the middle.

If you want the angle between the east of the map and the south of the map it could be a bit different.
If the map is a square, it is no big problem, but if it is not then you need something to determine it.
In GUI there is a function that can calculate the angle between 2 points.
I don't know how to get the size of the map because I haven't got an editor right now but that shouldnt be a problem.

This might have answered your question but I don't really know what you mean.

#### Aeroblyctos

Level 37
Doesn't seem to work. Northwest and southwest points bugs at the moment.

Here test map. All carrion swarms should shoot to the dark place(middle).

#### Attachments

• angles.w3x
76.3 KB · Views: 79

#### Aeroblyctos

Level 37
I'm sure this is not quite correct. IIRC North is 90°, right. But south is 270° for sure. And Probably West is 0°, and East 180°.

In wc3 everything is different.

#### Wietlol

Level 24
In WC3:
E: 0*/360*
N: 90*
W: 180*
S: 270*

Go to the terrain editor and change direction of units and find out what I just said XD

#### IcemanBo

Level 38
Ok, I also mixed up West/East. But tested now again, so...

North: 90°
East: 0°
South: 270°
West: 180°

So you only mixed up South/West.

Edit: Did not see your post above.

#### Wietlol

Level 24
You switched north-west and south-west.
The trigger you need is this:
(degrees work fine)
(Only switch the reals in the random real part. Nothing more.)
• v corners
• Events
• Time - Every 0.50 seconds of game time
• Conditions
• Actions
• -------- === NORTHWEST === --------
• Set TempInteger = 1
• Set TempLoc = (Center of 1 <gen>)
• Set TempLoc2 = (TempLoc offset by 150.00 towards (Random real number between 270.00 and 360.00) degrees)
• Unit - Create 1 Enemy Ability Dummy Unit 1 (TEMPLATE) for Neutral Hostile at TempLoc facing TempLoc2
• Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
• Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm TempLoc2
• Custom script: call RemoveLocation(udg_TempLoc)
• Custom script: call RemoveLocation(udg_TempLoc2)
• -------- === NORTHEAST === --------
• Set TempInteger = 2
• Set TempLoc = (Center of 2 <gen>)
• Set TempLoc2 = (TempLoc offset by 150.00 towards (Random real number between 180.00 and 270.00) degrees)
• Unit - Create 1 Enemy Ability Dummy Unit 1 (TEMPLATE) for Neutral Hostile at TempLoc facing TempLoc2
• Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
• Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm TempLoc2
• Custom script: call RemoveLocation(udg_TempLoc)
• Custom script: call RemoveLocation(udg_TempLoc2)
• -------- === SOUTHWEST === --------
• Set TempInteger = 3
• Set TempLoc = (Center of 3 <gen>)
• Set TempLoc2 = (TempLoc offset by 150.00 towards (Random real number between 90.00 and 180.00) degrees)
• Unit - Create 1 Enemy Ability Dummy Unit 1 (TEMPLATE) for Neutral Hostile at TempLoc facing TempLoc2
• Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
• Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm TempLoc2
• Custom script: call RemoveLocation(udg_TempLoc)
• Custom script: call RemoveLocation(udg_TempLoc2)
• -------- === SOUTHEAST === --------
• Set TempInteger = 4
• Set TempLoc = (Center of 4 <gen>)
• Set TempLoc2 = (TempLoc offset by 150.00 towards (Random real number between 0.00 and 90.00) degrees)
• Unit - Create 1 Enemy Ability Dummy Unit 1 (TEMPLATE) for Neutral Hostile at TempLoc facing TempLoc2
• Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
• Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm TempLoc2
• Custom script: call RemoveLocation(udg_TempLoc)
• Custom script: call RemoveLocation(udg_TempLoc2)

#### bajaist

Level 5

Note: If it's above 360 it goes down to 0, but the value is still above 360. So 720 = 0, 540 = 180
Yup, angle + 2*k*pi

#### Wietlol

Level 24
Im happy enough that WC3 doesnt use radians.

D

Level 23
yet Jass does

#### JustNrik

Level 4
How can North be 90º and West 270º? Fuck Logic.

Whatever.

0 and 360 - East - 0 and 2pi
45 - Northeast - pi/4
90 - North - pi/2
135 - Northwest 3pi/4
180 - West - pi
225 - Southwest - 5pi/4
270 - South - 3pi/2
315 - Southeast - 7pi/4

Just as bajaist posted

#### Wietlol

Level 24
Well I havent seen radians so far in JASS.
I do use them in C# but I prefer degrees.

#### deathismyfriend

Level 29
Well I havent seen radians so far in JASS.
I do use them in C# but I prefer degrees.

Unless you always use the functions that are there for locations then jass is always in radians. You may also use radtodeg and degtorad as mentioned above. They convert radians to and from degrees.

#### Aeroblyctos

Level 37
Yes indeed guys. I got it to work.

Thanks a lot!

Status
Not open for further replies.

Replies
9
Views
1K
Replies
9
Views
951
Replies
3
Views
680
Replies
9
Views
932
Replies
7
Views
879