- Joined
- Feb 11, 2011
- Messages
- 1,860
Hello,
I have this script that I am using for a spell. Anyway, it is meant to check if the boss's life is less than 33%. Here it is:
The rest of the script isn't important. When I set the boss's life to 30% (using a test trigger), the game crashes instead of displaying "It worked!". Any ideas?
Thanks!
I have this script that I am using for a spell. Anyway, it is meant to check if the boss's life is less than 33%. Here it is:
JASS:
scope BurningDownpour initializer InitTrigger
private function cond takes nothing returns boolean
if (udg_Boss_Unit != null) and ((GetWidgetLife(udg_Boss_Unit) / GetUnitState(udg_Boss_Unit, UNIT_STATE_MAX_LIFE)) <= 0.33) then
call BJDebugMsg("It works!")
endif
return false
endfunction
private function InitTrigger takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEventPeriodic(t, 5)
call TriggerAddCondition(t, Condition(function cond))
set t = null
endfunction
endscope
Thanks!