- Joined
- Jun 26, 2020
- Messages
- 1,921
I made an spell based in the Leech Seed of the Dota hero Rooftrellen
So I used the relativistic missiles instead of using a unit that fires the heal missiles like I did before, but for some reason after the second instance it create much more missiles than it must do and goes to random places and heights, what's wrong?
vJASS:
scope Quell initializer Init
private struct Heal extends Missiles
method onFinish takes nothing returns boolean
call SetUnitState(this.target,UNIT_STATE_LIFE,GetUnitState(this.target,UNIT_STATE_LIFE)+this.damage)
return true
endmethod
endstruct
struct Quell extends array
implement Alloc
static group g=CreateGroup()
unit caster
unit target
player owner
real damage
integer counter
timer t
method destroy takes nothing returns nothing
call ReleaseTimer(this.t)
set this.caster=null
set this.target=null
set this.owner=null
set this.t=null
call this.deallocate()
endmethod
method period takes nothing returns nothing
local real x=GetUnitX(this.target)
local real y=GetUnitY(this.target)
local real z=50+GetUnitFlyHeight(this.target)
local unit u
local Heal missile
call UnitDamageTarget(this.caster,this.target,this.damage,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget("war3mapImported\\Holy Light.mdx",this.target,"origin"))
call GroupEnumUnitsInRange(thistype.g,x,y,500,null)
loop
set u=FirstOfGroup(thistype.g)
exitwhen u==null
if not IsUnitType(u,UNIT_TYPE_MECHANICAL) and not IsUnitType(u,UNIT_TYPE_STRUCTURE) and IsUnitAlly(u,this.owner) then
set missile=Heal.create(x,y,z,GetUnitX(u),GetUnitY(u),50+GetUnitFlyHeight(u))
set missile.speed=900.00
set missile.arc=8.627
set missile.model="Abilities\\Weapons\\FaerieDragonMissile\\FaerieDragonMissile.mdl"
set missile.damage=this.damage
set missile.target=u
call missile.launch()
endif
call GroupRemoveUnit(thistype.g,u)
endloop
endmethod
static method callperiodic takes nothing returns nothing
local thistype this=GetTimerData(GetExpiredTimer())
set this.counter=this.counter+1
if this.counter<6 and UnitAlive(this.target) then
call this.period()
else
call this.destroy()
endif
endmethod
static method create takes unit caster, unit target returns thistype
local thistype this=thistype.allocate()
set this.caster=caster
set this.target=target
set this.owner=GetOwningPlayer(this.caster)
if Spell=='A07F' then
set this.damage=15.00+20.00*Level
else
set this.damage=15.00+15.00*Level
endif
call this.period()
set this.counter=0
set this.t=NewTimerEx(this)
call TimerStart(this.t,1.00,true,function thistype.callperiodic)
return this
endmethod
endstruct
//-- --
private function Actions takes nothing returns nothing
if Spell=='A09G' then
if Level<3 then
set Spell='A07F'
else
set Level=Level-2
set Spell='A082'
endif
endif
if Spell=='A07F' or Spell=='A082' then
call Quell.create(Caster,GetSpellTargetUnit())
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
call RegisterAnyPlayerUnitEvent(EVENT_PLAYER_UNIT_SPELL_EFFECT,function Actions)
endfunction
endscope