Da_HP_Geek
New Member
- Reaction score
- 8
I got some problem with this Esnare Spell. I just Ensnare 1, when I will Ensnare all in the AoE... Pllz tell me whats wrong or edit in the map and save it!
JASS:
scope MassEnsnare initializer EnsnareInit
globals
private integer MAIN_ABILITY = 039;A000039;
private integer DUMMY_UNIT = 039;h000039;
private group UnitGroup = CreateGroup()
private unit u
private unit dummy
endglobals
private function DetectSpell takes nothing returns boolean
if GetSpellAbilityId() == MAIN_ABILITY then
return true
endif
return false
endfunction
private function FilterUnits takes nothing returns boolean
local unit ta = GetFilterUnit()
return IsUnitAliveBJ(ta) == true and IsUnitOwnedByPlayer(ta, GetOwningPlayer(u)) == false and IsPlayerAlly(GetOwningPlayer(ta), GetOwningPlayer(u)) == false
endfunction
private function DoThis takes nothing returns nothing
call IssueTargetOrder(dummy, "ensnare", GetEnumUnit())
endfunction
private function Actions takes nothing returns nothing
local location UL
local location LOC = GetSpellTargetLoc()
set u = GetTriggerUnit()
set UL = GetUnitLoc(u)
set dummy = CreateUnitAtLoc(GetOwningPlayer(u), 039;h000039;, GetUnitLoc(u), bj_UNIT_FACING)
call GroupEnumUnitsInRangeOfLoc(UnitGroup, LOC, 300.00, Condition(function FilterUnits))
call ForGroup(UnitGroup, function DoThis)
call GroupClear(UnitGroup)
endfunction
private function EnsnareInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function DetectSpell))
call TriggerAddAction(t, function Actions)
endfunction
endscope