| 05-04-2006, 10:24 PM | #1 |
ok so, this code JASS:function Trig_Deaths_Touch_Conditions takes nothing returns boolean return GetUnitTypeId(GetAttacker()) == 'N00W' endfunction function Deaths_Touch_Damaged_Conditions takes nothing returns boolean return GetEventDamageSource()==GetHandleUnit(GetTriggeringTrigger(),"atk") endfunction function Deaths_Touch_Damaged_Actions takes nothing returns nothing local unit u = GetEventDamageSource() local unit v = GetTriggerUnit() local integer lvl = GetUnitAbilityLevel(u,'A03G') local real damage = GetEventDamage()*(.05*lvl) if lvl<1 then call UnitAddAbility(u,'A03E') call SetUnitAbilityLevel(u,'A03G',1) call DestroyEffect(AddSpecialEffectTarget("Timerift Missle.mdx",u,"chest")) elseif lvl<5 then call SetUnitAbilityLevel(u,'A03G',lvl+1) call DestroyEffect(AddSpecialEffectTarget("Timerift Missle.mdx",u,"chest")) endif call UnitDamageTarget(u,v,damage,false,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,null) call BJDebugMsg(R2S(damage)) call FlushHandleLocals(GetTriggeringTrigger()) set u = null set v = null call DestroyTrigger(GetTriggeringTrigger()) endfunction function Deaths_Touch_Change_Conditions takes nothing returns boolean return GetAttacker()==GetHandleUnit(GetTriggeringTrigger(),"atk") and GetTriggerUnit()!=GetHandleUnit(GetTriggeringTrigger(),"atckd") endfunction function Deaths_Touch_Change_Actions takes nothing returns nothing call UnitRemoveAbility(GetHandleUnit(GetTriggeringTrigger(),"atk"),'A03E') call FlushHandleLocals(GetTriggeringTrigger()) call DestroyTrigger(GetTriggeringTrigger()) endfunction function Deaths_Touch_Remove_Trigger takes nothing returns nothing local timer t = GetExpiredTimer() local trigger trig = GetHandleTrigger(t,"trig") local trigger trig2 = GetHandleTrigger(t,"trig2") call FlushHandleLocals(trig) call DestroyTrigger(trig) call FlushHandleLocals(trig2) call DestroyTrigger(trig2) call ClearTimer(t) set trig = null endfunction function Trig_Deaths_Touch_Actions takes nothing returns nothing local unit atk = GetAttacker() local unit atckd = GetTriggerUnit() local trigger trig = CreateTrigger() local trigger trig2 = CreateTrigger() local timer t = CreateTimer() call TriggerRegisterUnitEvent(trig,atckd,EVENT_UNIT_DAMAGED) call TriggerAddCondition(trig,Condition(function Deaths_Touch_Damaged_Conditions)) call TriggerAddAction(trig,function Deaths_Touch_Damaged_Actions) call SetHandleHandle(trig,"atk",atk) call TriggerRegisterAnyUnitEventBJ( trig2, EVENT_PLAYER_UNIT_ATTACKED ) call TriggerAddCondition(trig2,Condition(function Deaths_Touch_Change_Conditions)) call TriggerAddAction(trig2,function Deaths_Touch_Change_Actions) call SetHandleHandle(trig2,"atk",atk) call SetHandleHandle(trig2,"atckd",atckd) call SetHandleHandle(t,"trig",trig) call SetHandleHandle(t,"trig2",trig2) call TimerStart(t,1.,false,function Deaths_Touch_Remove_Trigger) set atk = null set atckd = null endfunction //=========================================================================== function InitTrig_Deaths_Touch takes nothing returns nothing set gg_trg_Deaths_Touch = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Deaths_Touch, EVENT_PLAYER_UNIT_ATTACKED ) call TriggerAddCondition( gg_trg_Deaths_Touch, Condition( function Trig_Deaths_Touch_Conditions ) ) call TriggerAddAction( gg_trg_Deaths_Touch, function Trig_Deaths_Touch_Actions ) endfunction the problem is in teh function Deaths_Touch_Damaged_Actions JASS:call UnitDamageTarget(u,v,damage,false,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,null) with that, WC3 crashes the first time this is run, if i disable that, everything works fine...what gives |
| 05-04-2006, 10:26 PM | #2 |
You can't have a unit damage action in a trigger that fires when a unit is damaged, or it gets stuck in an infinite loop and crashes. |
| 05-04-2006, 10:34 PM | #3 |
yup....its official....im a retard lol, ty |
