function Trig_Movement_Actions takes nothing returns nothing local unit EnumUnit local integer EnumUnitNumber local real x1 local real x2 local real y1 local real y2 set bj_forLoopAIndex = 1 loop exitwhen bj_forLoopAIndex > udg_Num set x1 = GetUnitX(udg_Ball[bj_forLoopAIndex]) set y1 = GetUnitY(udg_Ball[bj_forLoopAIndex]) set x2 = x1 + udg_Speed[bj_forLoopAIndex] * Cos( udg_Ang[bj_forLoopAIndex] * bj_DEGTORAD ) set y2 = y1 + udg_Speed[bj_forLoopAIndex] * Sin( udg_Ang[bj_forLoopAIndex] * bj_DEGTORAD ) if ( ( ( RectContainsCoords( gg_rct_Gebiet_143, x1, y1 ) ) and ( ( RectContainsCoords( gg_rct_Gebiet_119, x2, y2 ) ) or ( RectContainsCoords( gg_rct_Gebiet_121, x2, y2 ) ) ) ) or ( ( RectContainsCoords( gg_rct_Gebiet_142, x1, y1 ) ) and ( ( RectContainsCoords( gg_rct_Gebiet_117, x2, y2 ) ) or ( RectContainsCoords( gg_rct_Gebiet_116, x2, y2 ) ) ) ) ) then set udg_Ang[bj_forLoopAIndex] = ( 180.00 - udg_Ang[bj_forLoopAIndex] ) call DestroyEffect( AddSpecialEffect( "Abilities\\Weapons\\GryphonRiderMissile\\GryphonRiderMissileTarget.mdl", x1, y1 ) ) else call SetUnitX( udg_Ball[bj_forLoopAIndex], x2 ) call SetUnitY( udg_Ball[bj_forLoopAIndex], y2 ) call SetUnitFacing( udg_Ball[bj_forLoopAIndex], udg_Ang[bj_forLoopAIndex] ) endif set x1 = GetUnitX(udg_Ball[bj_forLoopAIndex]) set y1 = GetUnitY(udg_Ball[bj_forLoopAIndex]) call GroupEnumUnitsInRange( udg_Movement_Group, x1, y1, 50, null ) loop set EnumUnit = FirstOfGroup( udg_Movement_Group ) exitwhen EnumUnit == null call GroupRemoveUnit( udg_Movement_Group, EnumUnit ) if ( ( EnumUnit != udg_Ball[bj_forLoopAIndex] ) and ( GetUnitTypeId( EnumUnit ) == 'H003' ) ) then set EnumUnitNumber = GetUnitUserData(EnumUnit) set x2 = GetUnitX( EnumUnit ) set y2 = GetUnitY( EnumUnit ) call DestroyEffect( AddSpecialEffect( "Abilities\\Weapons\\GryphonRiderMissile\\GryphonRiderMissileTarget.mdl", x2, y2 ) ) set udg_Ang[EnumUnitNumber] = ( 180.00 + bj_RADTODEG * Atan2( y1 - y2, x1 - x2 ) ) set udg_Ang[bj_forLoopAIndex] = ( 180.00 + bj_RADTODEG * Atan2( y2 - y1, x2 - x1 ) ) set udg_Speed[bj_forLoopAIndex] = ( ( udg_Speed[bj_forLoopAIndex] / 2.00 ) - ModuloReal(( udg_Speed[bj_forLoopAIndex] / 2.00 ), 1.00) ) set udg_Speed[EnumUnitNumber] = udg_Speed[bj_forLoopAIndex] set udg_Anim_Speed[EnumUnitNumber] = ( 20.00 * udg_Speed[EnumUnitNumber] ) call SetUnitTimeScalePercent( udg_Ball[EnumUnitNumber], udg_Anim_Speed[EnumUnitNumber] ) set udg_Anim_Speed[bj_forLoopAIndex] = ( 20.00 * udg_Speed[EnumUnitNumber] ) call SetUnitTimeScalePercent( udg_Ball[bj_forLoopAIndex], udg_Anim_Speed[bj_forLoopAIndex] ) set x2 = x2 + 10 * Cos( udg_Ang[EnumUnitNumber] * bj_DEGTORAD ) set y2 = y2 + 10 * Sin( udg_Ang[EnumUnitNumber] * bj_DEGTORAD ) call SetUnitX( udg_Ball[EnumUnitNumber], x2 ) call SetUnitY( udg_Ball[EnumUnitNumber], y2 ) call SetUnitFacing( udg_Ball[EnumUnitNumber], udg_Ang[bj_forLoopAIndex] ) set x2 = x1 + 10 * Cos( udg_Ang[bj_forLoopAIndex] * bj_DEGTORAD ) set y2 = y1 + 10 * Sin( udg_Ang[bj_forLoopAIndex] * bj_DEGTORAD ) call SetUnitX( udg_Ball[bj_forLoopAIndex], x2 ) call SetUnitY( udg_Ball[bj_forLoopAIndex], y2 ) call SetUnitFacing( udg_Ball[bj_forLoopAIndex], udg_Ang[bj_forLoopAIndex] ) endif endloop set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop set EnumUnit = null endfunction