Expelliarmus
Where to change the sig?
- Reaction score
- 48
JASS:
private struct Data
unit caster
group dummy
real speed
static method create takes nothing returns Data
local Data d = Data.allocate()
set d.caster = GetTriggerUnit()
set d.dummy = CreateGroup()
return d
endmethod
endstruct
globals
private timer time = CreateTimer()
private integer Total = 0
private Data array Ar
private boolean Boolean = false
private group Nothing = CreateGroup()
private unit Temp_Unit = null
private unit FoG = null
endglobals
function Conditions takes nothing returns boolean
return GetSpellAbilityId() == AbilID
endfunction
function Stun takes nothing returns boolean
local unit u = GetFilterUnit()
local unit d
if not Boolean and IsUnitEnemy(u, GetOwningPlayer(Temp_Unit)) == true then
set Boolean = true
set d = CreateUnit( GetOwningPlayer(Temp_Unit), DummyCID, GetUnitX(u), GetUnitY(u), bj_UNIT_FACING )
call UnitApplyTimedLife( d, Generic, 1.00 )
call UnitAddAbility( d, StunID )
call IssueTargetOrder( d, Order, u )
endif
set u = null
return false
endfunction
function handlerFunc takes nothing returns nothing
local Data d
local integer i = 0
local real x
local real y
local real xx
local real yy
local real angle
local group dummy = CreateGroup()
set Temp_Unit = d.caster
call BJDebugMsg("callback") //not at all showing this
loop
exitwhen i >= Total
set d = Ar<i>
call GroupAddGroup(d.dummy, dummy)
loop
set FoG = FirstOfGroup(dummy)
set Boolean = false
exitwhen FoG == null
call GroupRemoveUnit(dummy, FoG)
set xx = GetUnitX(FoG)- GetUnitX(Temp_Unit)
set yy = GetUnitY(FoG) - GetUnitY(Temp_Unit)
set angle = Atan2(yy,xx) + Increment * bj_DEGTORAD
debug call BJDebugMsg(R2S(angle))
// movement
set x = GetUnitX(d.caster) + Distance * Cos(angle )
set y = GetUnitY(d.caster) + Distance * Sin(angle )
call SetUnitPosition(FoG, x, y)
// Stun
call GroupEnumUnitsInRange(Nothing, GetUnitX(FoG), GetUnitY(FoG), Radius, Condition(function Stun))
if Boolean then
call KillUnit(FoG)
call GroupRemoveUnit(d.dummy, FoG)
endif
endloop
set i = i + 1
call BJDebugMsg(I2S(i))
endloop
if Total - 1 == 0 then
call PauseTimer(time)
endif
set FoG = null
set Temp_Unit = null
call DestroyGroup(dummy)
set dummy = null
endfunction
function Actions takes nothing returns nothing
local Data d = Data.create()
local integer i = 1
local real angle
local real x
local real y
local unit dummy
set d.speed = 360.0 / Rocks(GetUnitAbilityLevel( d.caster, AbilID))
loop
exitwhen i > Rocks(GetUnitAbilityLevel( d.caster, AbilID))
set angle = i * d.speed
set x = GetUnitX(d.caster) + Distance * Cos(angle * bj_DEGTORAD)
set y = GetUnitY(d.caster) + Distance * Sin(angle * bj_DEGTORAD)
set dummy = CreateUnit( GetOwningPlayer(d.caster), DummyID, x, y, angle )
call UnitApplyTimedLife( dummy, Generic , Duration )
call SetUnitPathing( dummy, false )
call GroupAddUnit( d.dummy, dummy)
set i = i + 1
endloop
set Total = Total + 1
set Ar[Total - 1] = d
if Total - 1 == 0 then
call TimerStart(time, Interval, true, function handlerFunc)
call BJDebugMsg("First instance timer")
endif
endfunction</i>
thanks