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!
Hello, I know that BJ functions aren't liked in spells on Hive. I don't know what to do with PolarProjectionBJ , is there any function that does the same but isn't a BJ? If not can I simply use PolarProjectionBJ and it will be accepted ?
Reason for BJs being disliked is because they typically contain leaks. At least that's what I've gather from looking at the function list.
If you have JNGP open it up, click function list in the Trigger Editor, and search for PolarProjectionBJ. It should tell you what natives, formulas and constants PolarProjectionBJ goes through in order to do it's thing. Also you can check if it leaks anything besides integers and reals, since those don't really leak or need to be destroyed. Then you might find you can use it if nothing else.
Hmm makes sense some sort, but I coulden't possbly create a knockback with this information.
JASS:
function Action takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real x2
local real y2
local integer index = 0
loop
exitwhen index >= 36
set x2 = x+450*Cos(10*index*bj_DEGTORAD)
set y2 = y+450*Sin(10*index*bj_DEGTORAD)
//Do the stuff at that cords
set index = index + 1
endloop
set u = null
endfunction
In this example from the link you gave... Everything seems pretty clear, except from this part:
JASS:
set x2 = x+450*Cos(10*index*bj_DEGTORAD)
set y2 = y+450*Sin(10*index*bj_DEGTORAD)
What is this?? The part with x + 450 is probably the distance from the old point, but what are this Cos and Sin and 10*Index*bj_DEGTORAD ?
COS and SIN and cosine and sine. They're typically found in angle measurements. They deal with real numbers.
As for index, not sure. bj_DEGTORAD is Degrees to Radions, and I forget what exactly it is in technical terms. Surely someone else here knows the full details.
Hmm makes sense some sort, but I coulden't possbly create a knockback with this information.
JASS:
function Action takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real x2
local real y2
local integer index = 0
loop
exitwhen index >= 36
set x2 = x+450*Cos(10*index*bj_DEGTORAD)
set y2 = y+450*Sin(10*index*bj_DEGTORAD)
//Do the stuff at that cords
set index = index + 1
endloop
set u = null
endfunction
In this example from the link you gave... Everything seems pretty clear, except from this part:
JASS:
set x2 = x+450*Cos(10*index*bj_DEGTORAD)
set y2 = y+450*Sin(10*index*bj_DEGTORAD)
What is this?? The part with x + 450 is probably the distance from the old point, but what are this Cos and Sin and 10*Index*bj_DEGTORAD ?
Cos and Sin take angles in radians. If you know basic trigonometry, you should know what they do. To convert an angle measured in degrees to an angled measured in radians, you can simply multiply it by bj_DEGTORAD, which is basically PI/180.
As for what that loop is doing, you'll notice that the integer index is looping from 1-36, meaning 10*index is looping from 10 - 360 (skipping every 10). To convert the angle 10*index to radians, we do 10*index*bj_DEGTORAD. If we visualize a line going toward this angle, Cos will yield its x component and Sin will yield its y component. We can scale these components, or decide how far to go towards an angle, simply by multiplying the desired distance times the Cos and Sin of that angle. For example, say you want to go 5 meters towards northeast (45 degrees). You can convert that to rectangular coordinates like this: x = 5*Cos(45*bj_DEGTORAD). y = 5*Sin(45*BJ_DEGTORAD).
Going back to the above code, we can see that the loop is finding the 36 points 450 distance away from the unit, that are separated by 10 degree increments.
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.