- Joined
- Oct 11, 2012
- Messages
- 711
Don't know why the following trigger does not work. The event just did not fire.... Need help please
Edit: figured out why it did not work... I declared a local variable as following that made the trigger unable to execute:
JASS:
function bangmang takes nothing returns nothing
call SetUnitInvulnerable(gg_unit_H00F_0198,false)
call DisableTrigger(LoadTriggerHandle(udg_chongfeng1,5,0))
call DestroyTrigger(LoadTriggerHandle(udg_chongfeng1,5,0))
call FlushChildHashtable(udg_chongfeng1,5)
call ReleaseTimer(GetExpiredTimer())
endfunction
function Trig_bangmang_Actions takes nothing returns boolean
local timer t =NewTimer()
call DisplayTimedTextToForce(udg_wanjiazu,1.,"|cFFFF0000Debug!|r")
call SetUnitState(gg_unit_H00F_0198, UNIT_STATE_LIFE, GetUnitState(gg_unit_H00F_0198, UNIT_STATE_MAX_LIFE))
call UnitRemoveBuffs(gg_unit_H00F_0198,false,true)
call DisplayTimedTextToForce(udg_wanjiazu,30,"TRIGSTR_15427")
call SetUnitInvulnerable(gg_unit_H00F_0198,true)
call SaveTriggerHandle(udg_chongfeng1,5,0,GetTriggeringTrigger())
call TimerStart(t,60.,false,function bangmang)
set t=null
return false
endfunction
function InitTrig_bangmang takes nothing returns nothing
set gg_trg_bangmang=CreateTrigger()
call TriggerRegisterUnitStateEvent(gg_trg_bangmang,gg_unit_H00F_0198,UNIT_STATE_LIFE,LESS_THAN,80000.)
call TriggerAddCondition(gg_trg_bangmang,Condition(function Trig_bangmang_Actions))
endfunction
Edit: figured out why it did not work... I declared a local variable as following that made the trigger unable to execute:
local real x = xbase + 450. * Cos((I2R(angleUp)*60.) * bj_DEGTORAD)
Last edited: