function zx takes nothing returns nothing
local group g=CreateGroup()
local unit u
call GroupEnumUnitsInRange(g,0,0,512,null)
loop
set u=FirstOfGroup(g)
exitwhen u==null
//这里是单位为零值,即没有单位,(因为下面有RemoveUnit,不断的将u移除)
//如果写为exitwhen g==null(单位组为零值,即没有单位组),因为实际上g没有被移除,
//所以loop不会跳出动作
//换一种写法的话,可以是 exitwhen IsUnitGroupEmptyBJ(g)==true
call KillUnit(u)
call GroupRemoveUnit(g,u)
endloop
endfunction
function InitTrig_tes takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent( t, Player(0), "2", true )
call TriggerAddAction(t,function zx)
endfunction
local group g=CreateGroup()
local unit u
call GroupEnumUnitsInRange(g,0,0,512,null)
loop
set u=FirstOfGroup(g)
exitwhen u==null
//这里是单位为零值,即没有单位,(因为下面有RemoveUnit,不断的将u移除)
//如果写为exitwhen g==null(单位组为零值,即没有单位组),因为实际上g没有被移除,
//所以loop不会跳出动作
//换一种写法的话,可以是 exitwhen IsUnitGroupEmptyBJ(g)==true
call KillUnit(u)
call GroupRemoveUnit(g,u)
endloop
endfunction
function InitTrig_tes takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent( t, Player(0), "2", true )
call TriggerAddAction(t,function zx)
endfunction