| 07-20-2007, 12:06 AM | #1 |
Yeah I just spent a whole 3 minutes on making this custom script that SHOULD detect where a wall is. What do you guys think? Anything to improve? Also, any idea how to work from here to find the angle the object will be switched to when it nears the wall in my movement loop? JASS:function GetCliffAngle takes real x, real y returns real local integer co = GetTerrainCliffLevel(x,y) //cliff origin local integer ce = GetTerrainCliffLevel(x+45,y) //cliff east local integer cn = GetTerrainCliffLevel(x,y+45) //cliff north local integer cw = GetTerrainCliffLevel(x-45,y) //cliff west local integer cs = GetTerrainCliffLevel(x,y-45) //cliff south if ce > co and cn <= co and cw <= co and cs <= co then //east return 0. endif if cn > co and ce <= co and cw <= co and cs <= co then //north return 90. endif if cw > co and cn <= co and ce <= co and cs <= co then //west return 180. endif if cs > co and cn <= co and cw <= co and ce <= co then //south return 270. endif return 0. //0 = east, 90 = north, 180 = west, 270 = south endfunction Edit: Whoops I got the locals backwards with the north/east. |
