local unit u = GetLastCreatedUnit()
call RemoveUnit( u )
set u = null
This is the correct order. You should not set the variable to null before removing the unit (which isnt possible if the variable is already null).
http://wc3r.forumcircle.com/viewtopic.php?p=157171
Short tutorial i found.
Basically you just import it and change the name to war3mapMap.tga
Of course you need the right format for it before.
(Last created special effect)
refers to the BJ-function of AddSpecialEffect where the last created effect is stored in a global variable.
You have to save it directly like this:
set udg_TargetUnit_Effect[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))+1] = AddSpecialEffectTarget(s...
You Should know that (Angle from Point[1] to Point[2]) returns values between -180° and 180° (as far as i remember)
so you should convert that to 0-360° first of all.
Then you should get the difference between Real[1] and Real[2] and get it's absolute value.
then you can check if it is smaller...
Ye, thats how the Atan2 (and Atan) function works.
Atan2(.caster.getY() - .Y, .caster.getX() - .X)
Here .Y is the Origin and .caster.getY() is the target. Switch the positions so it is
Atan2(.Y -.caster.getY(),.X - .caster.getX())
or just do
Atan2(.caster.getY() - .Y, .caster.getX() - .X) + bj_PI
remove bj_RADTODEG from you calculations.
It converts the angle vom radians to degrees ( Atan2 returns radians) but Cos and Sin take radians. bj_RADTODEG is just for GUI users.
Just remember 2*Pi := 360°
Question:
Am i missing something or is this:
method angle takes Vector3D v returns real
return Acos(dotProduct(v))
endmethod
wrong? normally cos(a) = dotproduct / product of lengths <=> a = Acos(dotproduct / product of lengths)
so this would only work for vectors that have a...
Just to note it:
It is not even O(n²), which is also bad, but not as bad.... I mean You have to check every Unit for near units. So you check n times for some units, i think in the worst case it would be O(n * n/4) but always, if there are always 1/4*n units near each unit. Or did i miss...