function Trig_Bash_Create_Actions takes nothing returns nothing
local location MyPoint
[b]Wait[/b]
call TriggerSleepAction( 0.30 )
call CreateItemLoc( 'I005', PolarProjectionBJ(GetUnitLoc(GetAttackedUnitBJ()), 100.00, GetRandomReal(0, 360.00)) )
[b]Calc the offset[/b]
set MyPoint = PolarProjectionBJ(GetUnitLoc(GetAttackedUnitBJ()), 250.00, AngleBetweenPoints(GetUnitLoc(GetAttacker()), GetUnitLoc(GetAttackedUnitBJ())))
[b]Check min x of region[/b]
if ( GetLocationX(MyPoint) < GetRectMinX(gg_rct_Coin_Bash) ) then
set MyPoint = Location(GetRectMinX(gg_rct_Coin_Bash), GetLocationY(MyPoint))
else
call DoNothing( )
endif
[b]Check max x of region[/b]
if ( GetLocationX(MyPoint) > GetRectMaxX(gg_rct_Coin_Bash) ) then
set MyPoint = Location(GetRectMaxX(gg_rct_Coin_Bash), GetLocationY(MyPoint))
else
call DoNothing( )
endif
[b]Check min y of region[/b]
if ( GetLocationY(MyPoint) < GetRectMinY(gg_rct_Coin_Bash) ) then
set MyPoint = Location(GetLocationX(MyPoint), GetRectMinY(gg_rct_Coin_Bash))
else
call DoNothing( )
endif
[b]Check max y of region[/b]
if ( GetLocationY(MyPoint) > GetRectMaxY(gg_rct_Coin_Bash) ) then
set MyPoint = Location(GetLocationX(MyPoint), GetRectMaxY(gg_rct_Coin_Bash))
else
call DoNothing( )
endif
[b]Move the unit to MyPoint[/b]
call SetUnitPositionLoc( GetAttackedUnitBJ(), MyPoint )
endfunction