- Joined
- Jan 24, 2015
- Messages
- 26
Been a bit since I last dipped in JASS, and I've run into an error and I'm not sure why.
The error is "Expected '", pointing at the set UnitCount = line.
I'm not entirely sure if the trigger works in the first place, because I'm not entirely sure what my script error is. Anyone more familiar with the language able to pick out what I'm doing wrong?
JASS:
function PolledWaitFix takes real duration returns nothing
local timer t
local real timeRemaining
if (duration > 0) then
set t = CreateTimer()
call TimerStart(t, duration, 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)
set t = null
endif
endfunction
function Trig_Tree_Respawn_Filter takes nothing returns boolean
if (IsUnitType(GetEnumUnit(), UNIT_TYPE_FLYING) == TRUE) then
return false
endif
if (IsUnitType(GetEnumUnit(), UNIT_TYPE_DEAD) == TRUE) then
return false
endif
return true
endfunction
function Trig_Tree_Respawn_Actions takes nothing returns nothing
local destructable Tree = GetTriggerDestructable()
local real TreeX = GetDestructableX(Tree)
local real TreeY = GetDestructableY(Tree)
local group Units
local integer UnitCount
call PolledWaitFix( 300.00 )
loop
set Units = CreateGroup()
set UnitCount = CountUnitsInGroup(GroupEnumUnitsInRange(Units, TreeX, TreeY, 128.0, function Trig_Tree_Respawn_Filter()))
exitwhen UnitCount == 0
call DestroyGroup(Units)
call TriggerSleepAction(1.0)
endloop
call DestroyGroup(Units)
call DestructableRestoreLife( Tree, GetDestructableMaxLife(Tree), true )
endfunction
//===========================================================================
function InitTrig_Tree_Respawn takes nothing returns nothing
set gg_trg_Tree_Respawn = CreateTrigger( )
call TriggerAddAction( gg_trg_Tree_Respawn, function Trig_Tree_Respawn_Actions )
endfunction
The error is "Expected '", pointing at the set UnitCount = line.
I'm not entirely sure if the trigger works in the first place, because I'm not entirely sure what my script error is. Anyone more familiar with the language able to pick out what I'm doing wrong?