As of now, the spell will pick the spell ability level -1 targets and cast entangling roots on them, but will not pick another group and do it again.
Its suppose to pick X targets and cast the root spell on them every 3 seconds, where X is the hero's ability level. It iterates every 3 seconds, but will not pick another group.
udg_HelpInts[7] is just a global slot holding the value of the ability level.
Any help is appreciated.
Its suppose to pick X targets and cast the root spell on them every 3 seconds, where X is the hero's ability level. It iterates every 3 seconds, but will not pick another group.
udg_HelpInts[7] is just a global slot holding the value of the ability level.
Any help is appreciated.
JASS:
function KoSC takes nothing returns boolean
return GetSpellAbilityId() == 'A03U'
endfunction
function isroot takes nothing returns boolean
return GetOwningPlayer(GetEnumUnit()) != GetOwningPlayer(GetSpellAbilityUnit())
endfunction
function root takes nothing returns nothing
local unit u = GetSpellAbilityUnit()
local unit n = GetEnumUnit()
local unit z
if(udg_HelpInts[7] > 0) then
if(GetOwningPlayer(n) != GetOwningPlayer(u)) then
set z = CreateUnit(GetOwningPlayer(u), 'nbda', GetUnitX(n), GetUnitY(n), 0)
call IssueTargetOrder(z, "entanglingroots", n)
call UnitApplyTimedLife(z,'BTLF', 3)
set z = null
set udg_HelpInts[7] = udg_HelpInts[7] - 1
endif
endif
set u = null
set n = null
endfunction
function KoSA takes nothing returns nothing
local unit u = GetSpellAbilityUnit()
local location l
local group g
local integer j = 30
local integer c = GetUnitAbilityLevel(u,'A03U')
loop
exitwhen j <= 0 or GetUnitState(u, UNIT_STATE_LIFE) <= 0
set l = GetUnitLoc(u)
set g = GetUnitsInRangeOfLocMatching(800,l, Condition(function isroot))
set udg_HelpInts[7] = c
call DisplayTextToPlayer(Player(0),0,0,"start funct")
call ForGroupBJ(g, function root)
call DisplayTextToPlayer(Player(0),0,0,"end funct")
call RemoveLocation(l)
call DestroyGroup(g)
call DisplayTextToPlayer(Player(0),0,0,I2S(j))
call TriggerSleepAction(3)
set j = j-3
endloop
call RemoveLocation(l)
call DestroyGroup(g)
set u = null
set l = null
set g = null
endfunction
//===========================================================================
function InitTrig_Ko_Spir takes nothing returns nothing
set gg_trg_Ko_Spir = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ko_Spir, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Ko_Spir, Condition( function KoSC ) )
call TriggerAddAction( gg_trg_Ko_Spir, function KoSA )
endfunction