| 08-14-2008, 01:43 PM | #1 |
JASS:function GetTerrainHeightLine takes real fromx,real fromy,real tox,real toy,real range,real time,real speed,real maximum returns boolean local real x=fromx local real y=fromy local real px local real py local real tr=0 local real a=bj_RADTODEG*Atan2(toy-y,tox-x) local real r=time*speed local boolean b=false loop exitwhen tr>=range set px=x+speed*Cos(a*bj_DEGTORAD) set py=y+speed*Sin(a*bj_DEGTORAD) if IsHigherThanMax(px,py,maximum)==true then set b=true else set b=false endif set x=px set y=py set tr=tr+r endloop return b endfunction It doesn't return anything, so I guess it's in the loop part. Here's the IsHigherThanMax function: JASS:function IsHigherThanMax takes real x,real y,real max returns boolean if(GetLocationZ(Location(x,y))>max)then return true else return false endif endfunction I hope you can help me :) |
| 08-14-2008, 01:46 PM | #2 |
You need to initialize tr to something before the exitwhen tr>=range statement. |
| 08-14-2008, 02:04 PM | #3 |
Whoops, yeah, how dumb can I be? -.- But it still doesn't show the debug msgs. |
| 08-14-2008, 02:14 PM | #4 | |
Quote:
Edit: Leak: if(GetLocationZ(Location(x,y))>max)then Also your RAD to DEG to RAD is unnessesary. |
| 08-14-2008, 02:24 PM | #5 |
JASS:function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing if IsHigherThanMax(513.3,127,51)==true then call BJDebugMsg("true1") endif if GetTerrainHeightLine(96.2,124.6,513.3,127,2000000,5,10,51)==true then call BJDebugMsg("true2") else call BJDebugMsg("false1") endif endfunction |
| 08-14-2008, 02:50 PM | #6 |
Just tested; It hits the oplimit. |
| 08-14-2008, 02:52 PM | #7 |
What should I do then? |
| 08-14-2008, 03:05 PM | #8 |
The problem is the 2 million range. Run a binary search to see what range it can handle, if that range is below what you need you can use ExecuteFunc or TriggerExecute to create new threads. Edit: Somwhere between 180000 -> 181000 range it hits the oplimit. |
| 08-14-2008, 03:37 PM | #9 |
But it also didn't display any msgs when the range was 1200... |
| 08-14-2008, 03:41 PM | #10 |
It displayed "false1" for me on an empty map. |
