// Quickly copied this function from a post by Doomhammer on thehelper. Don't know if it works, but it probably does.
function IsUnitInRect takes unit u, rect r returns boolean
return (GetUnitX(u) > GetRectMinX(r)-32 and GetUnitX(u) < GetRectMaxX(r)+32) and (GetUnitY(u) > GetRectMinY(r)-32 and GetUnitY(u) < GetRectMaxY(r)+32)
endfunction
function Trig_Spell_Actions takes nothing returns nothing
if (GetSpellAbilityId() == 'A000') then // If the ability being cast is your custom ability, then continue
if (not IsUnitInRect(GetTriggerUnit(), udg_Region)) then // If the unit is not in the specified region, then continue
call IssueImmediateOrder(GetTriggerUnit(), "stop") // Order the unit to stop
endif
endif
endfunction
//===========================================================================
function InitTrig_Spell takes nothing returns nothing
set gg_trg_Spell = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Spell, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddAction( gg_trg_Spell, function Trig_Spell_Actions )
endfunction