- Joined
- Sep 21, 2007
- Messages
- 517
The problem is that the trigger itself doesnt seem to cause any of the text messages in the testing trigger i put below.
here is the function:
here is the test trigger:
Please dont comment on me using the BJ, its like a transitional method instead of having to use structs and a global boolean.
thanks for your time
here is the function:
JASS:
library VectorSystem
globals
private constant real DistIntervalCheck = 25.
private constant real radius = 50.
endglobals
function IsPathSafe takes real X, real Y, real angle, real maxDist returns boolean
local real x = X
local real y = Y
local real mx = Cos(angle)*DistIntervalCheck
local real my = Sin(angle)*DistIntervalCheck
local real curDist
local rect r
loop
exitwhen curDist >= maxDist
set x = x + mx
set y = y + my
set r = Rect(x - radius, y - radius, x + radius, y + radius)
if RandomDestructableInRectBJ(r, null) != null then
call RemoveRect(r)
set r = null
return false
endif
call RemoveRect(r)
set r = null
set curDist = curDist + DistIntervalCheck
endloop
return true
endfunction
endlibrary
here is the test trigger:
JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
local unit t = udg_PlayerHero[1]
if IsPathSafe(GetUnitX(t), GetUnitY(t), GetUnitFacing(t), 1000) == true then
call BJDebugMsg("true")
else
call BJDebugMsg("false")
endif
set t = null
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_001, Player(0), "test", true )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
Please dont comment on me using the BJ, its like a transitional method instead of having to use structs and a global boolean.
thanks for your time