|
function AI_1_g_func takes nothing returns nothing
local integer i = GetRandomInt(1,udg_count)
local unit u = GetFilterUnit()
if GetUnitState(u,UNIT_STATE_LIFE)>0.01 then
call IssuePointOrderById(u,851983,GetUnitX(udg_AI_Unit),GetUnitY(udg_AI_Unit))
endif
set u = null
endfunction
function AI_1_t takes nothing returns nothing
local group g
set udg_count = GetStoredInteger(udg_gc,"trigger","AI_1_Count")
if udg_count>0 then
set g = CreateGroup()
call GroupEnumUnitsOfPlayer(g,Player(PLAYER_NEUTRAL_AGGRESSIVE),Condition(function AI_1_g_func))
set udg_count = 0
call DestroyGroup(g)
endif
set g = null
endfunction
function Set_AI_1 takes unit u returns nothing//注册怪物追寻
local integer ih = h2i(u)
local integer i = GetStoredInteger(udg_gc,"trigger","AI_1_Count")+1
if GetStoredInteger(udg_gc,I2S(ih),"AI_1_Count")<=0 then
set udg_AI_Unit=u
call StoreInteger(udg_gc,I2S(ih),"AI_1_Count",i)
call StoreInteger(udg_gc,"trigger","AI_1_Count",i)
endif
endfunction
function Death_AI_1 takes unit u returns nothing//删除怪物追寻
local integer ih = h2i(u)
local integer i = GetStoredInteger(udg_gc,I2S(ih),"AI_1_Count")
local integer max = GetStoredInteger(udg_gc,"trigger","AI_1_Count")
set udg_AI_Unit=udg_AI_Unit[max]
set udg_AI_Unit[max]=null
call FlushStoredInteger(udg_gc,I2S(ih),"AI_1_Count")
call StoreInteger(udg_gc,"trigger","AI_1_Count",max-1)
endfunction
if GetStoredInteger(udg_gc,I2S(ih),"AI_1_Count")>0 then//删除AI系统怪物寻找
call Death_AI_1(u)
endif
怪物自动追人的J,帮忙看下错误,谢谢! |
|