- Joined
- Dec 12, 2008
- Messages
- 7,385
JASS:
scope SubZero initializer Init
globals
// CONFIGURABLES
// You must configure the ability ID
private constant integer ABIL_CODE = 'A000'
// The Dummy unit ID should also be configured
private constant integer DUMMY = 'u000'
// The nova will deal damage ONCE to any unit in range
private constant real DMGPERLVL = 70.0
// This is the number of missiles in the nova
private constant integer MISSILES = 16
// The Radius of the Nova
private constant real RADIUS = 600.00
// The speed factor of the nova
private constant real VELOCITY = 12.00
// The height of the missisles
private constant real PROJZ = 35.00
// END CONFIGURABLES
private integer int = 0
endglobals
private struct Data
group h // Nova (Missiles)
group j // Damaged Units
unit k // Caster
real l // Damage per missile
real d // Current Radius
real x // Caster X
real y // Caster Y
integer n // Level
// Unfortunately, I can't null "u" :(
static method filter takes nothing returns boolean
local thistype this = int
local unit u = GetFilterUnit()
call BJDebugMsg("Filtering...")
return GetWidgetLife(u) > 0.405 and /*
*/ IsUnitEnemy(u, GetOwningPlayer(k)) and /*
*/ not IsUnitInGroup(u,j)
endmethod
static method dmg takes nothing returns nothing
local thistype this = int
local unit u = GetEnumUnit()
call UnitDamageTarget(k,u,l,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
call GroupAddUnit(j,u)
set u = null
call BJDebugMsg("Units damaged!")
endmethod
static method move takes nothing returns nothing
local thistype this = int
local unit u = GetEnumUnit()
local real a = GetUnitFacing(u)
local group g = CreateGroup()
local real v = GetUnitX(u)
local real w = GetUnitY(u)
call SetUnitX(u, v+VELOCITY*Sin(bj_DEGTORAD*a))
call SetUnitY(u, w+VELOCITY*Cos(bj_DEGTORAD*a))
call GroupEnumUnitsInRange(g,v,w,128.00, function Data.filter)
if FirstOfGroup(g)!=null then
call ForGroup(g,function Data.dmg)
endif
set d = d + VELOCITY
set u = null
call DestroyGroup(g)
call BJDebugMsg("Units Moved!")
endmethod
static method expire takes nothing returns nothing
local timer t = GetExpiredTimer()
local thistype this = GetTimerData(t)
set int = this
call ForGroup(h,function Data.move)
if d>=RADIUS then
call .destroy()
call ReleaseTimer(t)
endif
call BJDebugMsg("Went through timer expire function..")
endmethod
static method create takes nothing returns thistype
local thistype this = thistype.allocate()
set this.k = GetTriggerUnit()
set this.x = GetUnitX(this.k)
set this.y = GetUnitY(this.k)
set this.j = CreateGroup()
set this.h = CreateGroup()
set this.n = GetUnitAbilityLevel(this.k, ABIL_CODE)
set this.l = DMGPERLVL * this.n
set this.d = 0.00
call BJDebugMsg("Initialized Struct instance data!")
return this
endmethod
method onDestroy takes nothing returns nothing
call DestroyGroup(this.h)
call DestroyGroup(this.j)
set this.k = null
call BJDebugMsg("Struct destroyed!")
endmethod
endstruct
private function Action takes nothing returns nothing
local Data data = Data.create()
local integer i = 0
local timer t = NewTimer()
local unit u
call SetTimerData(t,data)
loop
exitwhen i > MISSILES
set u = CreateUnit(Player(15), DUMMY, data.x, data.y, i * 360.0 / MISSILES)
call GroupAddUnit(data.h,u)
call UnitAddAbility(u,'Arav')
call UnitRemoveAbility(u,'Arav')
call SetUnitFlyHeight(u,PROJZ,0.00)
set i = i + 1
endloop
call BJDebugMsg("Units created!")
call TimerStart(t,0.03,true,function Data.expire)
call BJDebugMsg("Timer Started!")
endfunction
private function Cond takes nothing returns boolean
return GetSpellAbilityId()==ABIL_CODE
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Cond))
call TriggerAddAction(t, function Action)
endfunction
endscope
All it's doing is creating the missiles. They just stand there D:
They don't move at all
Can anyone tell me what's the problem?
I really need help