Code
bool PolarUnit(unit u,real angle,real dist){
real x=GetUnitX(u)+dist*Cos(angle)
real y=GetUnitY(u)+dist*Sin(angle)
if((x>MINX)&&(x<MAXX)&&(y>MINY)&&(y<MAXY)){
return false
}else{
SetUnitX(u,x)
SetUnitY(u,y)
return true
}
}
или
Code
function RectX takes real x returns real
local real xm = GetRectMinX(bj_mapInitialPlayableArea)+50
if(x<xm)then
return xm
endif
set xm = GetRectMaxX(bj_mapInitialPlayableArea)-50
if(x>xm)then
return xm
endif
return x
endfunction
function RectY takes real y returns real
local real ym = GetRectMinY(bj_mapInitialPlayableArea)+50
if(y<ym)then
return ym
endif
set ym = GetRectMaxY(bj_mapInitialPlayableArea)-50
if(y>ym)then
return ym
endif
return y
endfunction