Код
function Trig_rect_Conditions takes nothing returns boolean
local real x = GetWidgetX(GetFilterUnit())
local real y = GetWidgetY(GetFilterUnit())
return x >= GetRectMinX(udg_t) and x <= GetRectMaxX(udg_t) and y >= GetRectMinY(udg_t) and y <= GetRectMaxY(udg_t)
endfunction
function Trig_rect_Actions takes nothing returns nothing
call CreateUnit(GetOwningPlayer(GetTriggerUnit(), 'hfoo', GetRectCenterX(udg_t), GetRectCenterY(udg_t), 270.)
endfunction
function InitTrig_rect takes nothing returns nothing
local trigger trig = CreateTrigger()
local integer i = 0
loop
call TriggerRegisterPlayerUnitEvent(trig, Player(i), EVENT_PLAYER_UNIT_USE_ITEM, null)
exitwhen i == 11
set i = i + 1
endloop
call TriggerAddCondition(trig, Condition(function Trig_rect_Conditions))
call TriggerAddAction(gg_trg_rect, function Trig_rect_Actions)
set trig = null
endfunction