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!
1) How do u create a rect in front of a unit with the angle of the units facing? I tried this:
Unit Group - Pick every unit in (Units in ((Rect(0.00, 0.00, 125.00, 800.00)) offset by ((X of (Casting unit)), (Y of (Casting unit))))
PS: The X and Y of unit are WEU functions
2) Whats the 'Death Damage Delay' in the spell incinerate for?
1) It doesnt matter where units should be, but where the rect should be. (In my spell the casting unit moves instantly to his facing +800 range. Now I want to pick every unit that is in the rect that he passes (125,800) But the Rect must be in front of the casting unit (before he casts the spell) and the facing of the casting unit and size 125, 800
2) Yes, u must go to incenerate in object editor, there u can find it
Ahaha! Someone else needs my über-function! I made a function in JASS called GetUnitsInAngledRectangle which is exactly what you ask for. I will upload it soon. You have no idea how hard it was to make...
1. It's not that difficult. It's pure math, and if I think a little bit at it, and make some geometry I will post you a GUI solution.
2. I can only suppose that it determines the period of time between the death of the unit, and the damage dealt by the spell. So, when the unit dies, it waits for 'Death Damage Delay''s field value, and then it deals the damage.
Ahaha! Someone else needs my über-function! I made a function in JASS called GetUnitsInAngledRectangle which is exactly what you ask for. I will upload it soon. You have no idea how hard it was to make...
Cool, but I dunno anything of JASS, so how do I use it with a GIU spell, I must convert it first to text then. But then how do I know where 2 place it etc
1. It's not that difficult. It's pure math, and if I think a little bit at it, and make some geometry I will post you a GUI solution.
I'll use it if I dont understand the JASS stuff after Daminon explained it
2. I can only suppose that it determines the period of time between the death of the unit, and the damage dealt by the spell. So, when the unit dies, it waits for 'Death Damage Delay''s field value, and then it deals the damage.
Daelin would you like to explain the math behind your method? I would really like to see if your method is the same as mine. Make one or more pictures displaying how you do the geometri. If you like I can do the same. Microsoft Word works good for it.
Well, I am still thinking about an efficient method. Because last night, I tried using some analytical geometry. I can determine the rect, but then, checking when the units are inside... I split the rectangle into two triangles, and then I just tried checking if the point is in any of the triangles. However, that stuff requires determinants, stuff I didn't learn yet. And yes, it is far too complicated.
Conclusion, I am trying to play a little with first grade functions right now. But you were right, it is more complicated than I thought. I hate that my math is a little limited, because I need analitical geometry, and all I learnt was self-teaching. But the solution is somewhere close, I can feel it.
Ok, but how do I use it? How do I make a spell with it? Must I convert my spell to jass and then as a condition I must copy ur JASS and paste it in my spell?
Well, it is more complicated. You have to remake the IsPointInTriangle function four times in the IsPointInRectangle function. Sorry, but that's the only solution.
First we calculate the positions of a right-angled rectangle that tangents the angled one. Then we enum group units in it.
Let's say that we have a unit here, P[Test] grouped. Now my method is to get the angle between P[1] and P[Test], draw a line in that angle and then figure out the maximum distance for that line until it crosses the angled rectangle. Sometimes when An[1] is very small it tends to be 360 to greater than it should be. Therefore we must check if it is grater than 360 and if it is true degrease it with 360. Now we have the true angle.
If An[1] is greater than 180 we know that it can't be inside the angled rectangle.
We can see on the picture that the given unit isn't in the angled rectangle but we have to prove it mathematicly.
To do that we see the line as the hypotenuze of a right-angled triangle. To get it's lenght we need two attributes of the triangle. And we have, An[1] and B/2. Now we can get the hypotenuze by (B / 2) / CosBJ(An[1]).
Know that if An[1] is greater than 90 the hypotenuze formual will be a little bit different, tha angle has to be degreased.
But is it really that simple? What happens if An[1] is like in the picture? Then one of the cathetus is too long to be inside the angled rectangle. To solve this we need to get another angle.
Here we have An[2]. To get the length of the hypotenuze we can only use (B / 2) / CosBJ(An[1]) if An[1] is less or equal to An[2]. Otherwise we must calculate it from the other cathetus with modified vaule of An[1] like this A / CosBJ(90 - An[1]).
Code:
As a summary:
if (An[1] < 90) then
if (An[1] < An[2]) then
Hypotenuze = (B / 2) / CosBJ(An[1])
elseif (An[1] > 90) then
Hypotenuze = A / CosBJ(90 - An[1])
endif
elseif (An[1] > 90) then
if (An[1] < An[2]) then
Hypotenuze = A / CosBJ(An[1] - 90)
elseif (An[1] > 90) then
Hypotenuze = (B / 2) / CosBJ(180 - An[1])
endif
endif
Now we just have to compare the distance from P[Test] to P[1] with P[1] and the hypotenuze.
If the distance is shorter or equal to the hypotenuze then the unit is in the angled rectangle. I hope you understand.
Guess if it was to figure it out. I think I worked 6 hours with paper, pencil, protractor and high school calculator, painting and gauging arcs and lines. The cathetus problem took me 3 hours before I understod it. And the -360-thing was also a time consumer.
Ramza said:
I only dont get why u use Cosinus (Thats the 'cos' right?)
Ehm, if you use the angle as one of the two needed attributes in a triangle to get another one then you have to use trigonometry. And in this case Cosinus is needed.
Cos = short for Cosinus
Sin = short for Sinus
Tan = short for Tangens
CSC = short for Cosecant
SEC = short for Secant
COT = short for Cotangens
Ramza said:
PS: So u dont need JASS after all? or are there some flaws or other leaks or somethingg when u do it like this?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.