- Joined
- May 4, 2007
- Messages
- 2,260
Hi guys, I want to use atan2, but i don't know how ... i saw the formula but i just can't use it right ... so i am using GetUnitFacing() instead, which is really bad =S
Can some1 help me out plz ?
EDIT EDIT EDIT
I managed to do something, but it is a little buggy =S Sometimes i create two lines of "eff" when i should only create one
Can any1 help me ? =S
Can some1 help me out plz ?
JASS:
private function Actions takes nothing returns nothing
local unit att = GetAttacker()
local player p = GetOwningPlayer(att)
local real angle = GetUnitFacing(att) //I want to use Atan2 but i dunno how ... plz help !!
local unit ef
local integer counter = 0
local real distance = 100
local real x
local real y
local group g = CreateGroup()
local unit dum
local unit vic
loop
exitwhen(counter > 6)
set x = GetUnitX(att) + distance * Cos(angle * bj_DEGTORAD)
set y = GetUnitY(att) + distance * Sin(angle * bj_DEGTORAD)
set ef = CreateUnit(p, EFFECTID, x, y, 0.0)
call UnitApplyTimedLife(ef, 'BTLF', 1.0)
//now to select purge and damage enemy units
call GroupEnumUnitsInRange(g, GetUnitX(ef), GetUnitY(ef), AOE, Filter(null))
loop
set vic = FirstOfGroup(g)
exitwhen (vic == null)
if IsUnitEnemy(vic, p) then
set dum = CreateUnit( p, DUMID, GetUnitX(ef), GetUnitY(ef), 0)
call UnitApplyTimedLife(dum, 'BTLF', 2.5)
call UnitAddAbility(dum, SPELLID)
call SetUnitAbilityLevel(dum, SPELLID, GetUnitAbilityLevel(att, BOOKID))
call IssueTargetOrder(dum, SPELLORDER, vic)
call SetUnitState(vic, UNIT_STATE_LIFE, GetWidgetLife(vic) - (25 * GetUnitAbilityLevel(GetAttacker(), BOOKID)))
endif
call GroupRemoveUnit(g, vic)
endloop
set distance = distance + 100
set counter = counter + 1
endloop
call DestroyGroup(g)
set att = null
set ef = null
set dum = null
set g = null
set p = null
endfunction
EDIT EDIT EDIT
I managed to do something, but it is a little buggy =S Sometimes i create two lines of "eff" when i should only create one
JASS:
local real angle = (180.0 / 3.14159) * Atan2(GetUnitY(GetTriggerUnit()) - GetUnitY(att), GetUnitX(GetTriggerUnit()) - GetUnitX(att))