JASS:
function Cond takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function Mass_Sleep takes nothing returns nothing
local group g
local unit u
local unit cast
local unit dumb
local location p
set cast = GetTriggerUnit()
set p = GetSpellTargetLoc()
set g = GetUnitsInRangeOfLocAll(800.00, p)
loop
set u = FirstOfGroup(g)
exitwhen u==null
if IsUnitEnemy(u, GetOwningPlayer(cast))==true then
call GroupRemoveUnit(g,u)
set dumb = CreateUnitAtLoc(GetOwningPlayer(cast), 'h000', GetUnitLoc(u), 0.00)
call IssueTargetOrderBJ(dumb, "sleep", u)
call UnitApplyTimedLifeBJ (1.50, 'BTLF', dumb)
set dumb = null
endif
endloop
set g = null
set u = null
set cast = null
set p = null
endfunction
function InitTrig_masssleep takes nothing returns nothing
local trigger t
set t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Cond))
call TriggerAddAction(t, function Mass_Sleep)
endfunction
This is included in one tutorial about Jass
y is it not working?
I made like author says
A000 is a silence with 0.1 duration
h000 is a dummy with locust, invul, sleep
A001 is a sleep
and named trigger masssleep
this tutorial was written 6 years ago so something wrong?