function CPolledWait takes real d returns nothing
local timer t
local real timeRemaining
if (d > 0) then
set t = CreateTimer()
call TimerStart(t, d, false, null)
loop
set timeRemaining = TimerGetRemaining(t)
exitwhen timeRemaining <= 0
if (timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD) then
call TriggerSleepAction(0.1 * timeRemaining)
else
call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
endif
endloop
call DestroyTimer(t)
endif
set t = null
endfunction
function HeaderHouseMove takes real x, real y, real angle returns nothing
call SetUnitPosition(udg_TrainerUnit, GetUnitX(udg_TrainerUnit), GetUnitY(udg_TrainerUnit))
call EnableUserControl(false)
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUT, 0.75 , "ReplaceableTextures\\CameraMasks\\Black_mask.blp" , 100. , 100. , 100. , 0.)
call CPolledWait(1.)
call SetUnitX(udg_TrainerUnit, x)
call SetUnitY(udg_TrainerUnit, y)
call SetUnitFacing(udg_TrainerUnit, angle)
call CinematicFadeBJ(bj_CINEFADETYPE_FADEIN, 0.75 , "ReplaceableTextures\\CameraMasks\\Black_mask.blp" , 100. , 100. , 100. , 0.)
call CPolledWait(1.)
call EnableUserControl(true)
endfunction
function ExampleEnter takes nothing returns nothing
local real x = GetRectCenterX(gg_rct_ExampleRect)
local real y = GetRectCenterY(gg_rct_ExampleRect) // +- 100, if it isnt supposed to go inside the rect but outside of it,,
call HeaderHouseMove(x,y, SomeAngle)
// someangle depends on what rect it enters,,
endfunction