| 04-17-2007, 12:44 AM | #1 |
Would my local trigger run everytime the event happens when i do this? JASS:function Trig_Guarding_Angel_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A003' endfunction function Trig_Guarding_Angel_Actions takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterUnitEvent( t, GetSpellAbilityUnit(), EVENT_UNIT_DAMAGED ) call TriggerAddAction( t, function Trig_Guarding_Angel_Effect ) set t = null endfunction //=========================================================================== function InitTrig_Guarding_Angel takes nothing returns nothing set gg_trg_Guarding_Angel = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Guarding_Angel, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Guarding_Angel, Condition( function Trig_Guarding_Angel_Conditions ) ) call TriggerAddAction( gg_trg_Guarding_Angel, function Trig_Guarding_Angel_Actions ) endfunction |
| 04-17-2007, 01:03 AM | #2 |
Yes it would. |
| 04-17-2007, 08:54 PM | #3 |
how would i get it to stop? |
| 04-17-2007, 09:35 PM | #4 |
OMFG I CANT READ |
| 04-18-2007, 12:04 AM | #5 |
Your just creating a timer. How would that stop the trigger? Mezzer said my local trigger would run everytime the event occured. |
| 04-18-2007, 04:16 PM | #6 |
damn i cant READ this one should work (if you want Trig_Guarding_Angel_Effect to run only once) JASS:function Trig_Guarding_Angel_Effect takes nothing returns nothing call DestroyTrigger(GetTriggeringTrigger()) //do stuff endfunction if you want Trig_Guarding_Angel_Effect more often things get more complicated ..(you would need a global variable (not MUI) or gamecache or ... ) |
| 04-18-2007, 08:21 PM | #7 |
Would it work if i start a timer and destroy the trigger after the timer expires so that it would run more than once? Edit: Another Question: Is it better to not use the InitTrig_Name? |
| 04-18-2007, 08:57 PM | #8 |
let me think .... i think it would work ..somehow..but ..you might want to ask one of the other "more advanced" guys her too... EDIT2:IGNORE THIS!: JASS:function Trig_Guarding_Angel_Effect takes nothing returns nothing local timer t=GetExpiredTimer() //if t!=null then // call DestroyTrigger(GetTriggeringTrigger()) // call PauseTimer(t) // call DestroyTimer(t) // return //endif // //Do Stuff endfunction function Trig_Guarding_Angel_Actions takes nothing returns nothing local trigger t = CreateTrigger() local timer T=CreateTimer() call TriggerRegisterUnitEvent( t, GetSpellAbilityUnit(), EVENT_UNIT_DAMAGED ) call TriggerAddAction( t, function Trig_Guarding_Angel_Effect ) call TriggerRegisterTimerEventSingle(t,3.0) set t = null set T = null endfunction EDIT: i tried it, but i get a war3critical error when the unit is damaged... EDIT2: found the error ,,cant be fixed -.- |
| 04-18-2007, 09:23 PM | #9 |
I was thinking more like this: JASS:function Trig_Guarding_Angel_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A003' endfunction function Trig_Guarding_Angel_Effect takes nothing returns nothing call SetUnitState( GetDamagedUnit(), UNIT_STATE_LIFE, GetUnitState( GetDamagedUnit(), UNIT_STATE_LIFE ) + GetEventDamage() ) //some game cache storing the damage to heal call PolledWait(15) call TriggerRemoveAction( Trig_Guarding_Angel_Actions ) endfunction function Trig_Guarding_Angel_Actions takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterUnitEvent( t, GetSpellAbilityUnit(), EVENT_UNIT_DAMAGED ) call TriggerAddAction( t, function Trig_Guarding_Angel_Effect ) set t = null endfunction //=========================================================================== function InitTrig_Guarding_Angel takes nothing returns nothing set gg_trg_Guarding_Angel = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Guarding_Angel, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Guarding_Angel, Condition( function Trig_Guarding_Angel_Conditions ) ) call TriggerAddAction( gg_trg_Guarding_Angel, function Trig_Guarding_Angel_Actions ) endfunction would this work? |
| 04-18-2007, 09:37 PM | #10 |
then dont give me the idea you want a timer -.-" WRONG JASS:
...WRONG
|
| 04-18-2007, 09:43 PM | #11 |
About the timers...I was going to make one, but then i remembered PolledWait did the same thing so i just used it. And i want the spell casted once like the cooldown would be higher than my PolledWait if thats what you mean |
| 04-19-2007, 04:02 PM | #12 |
only once during the whole game ?? or how many hits should this spell "absorb" ?? JASS:
call SetUnitState( GetDamagedUnit(), UNIT_STATE_LIFE, GetUnitState( GetDamagedUnit(), UNIT_STATE_LIFE ) + GetEventDamage() )
//use GetTriggerUnit() here
|
| 04-19-2007, 08:42 PM | #13 |
It should absorb until the wait is up |
| 04-20-2007, 11:10 AM | #14 |
JASS:function Trig_Guarding_Angel_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A003' endfunction function Trig_Guarding_Angel_Effect takes nothing returns nothing call SetUnitState( GetTriggerUnit(), UNIT_STATE_LIFE, GetUnitState( GetTriggerUnit(), UNIT_STATE_LIFE ) + GetEventDamage() ) endfunction function Trig_Guarding_Angel_Actions takes nothing returns nothing local trigger t = CreateTrigger() local triggerevent ta call TriggerRegisterUnitEvent( t, GetSpellAbilityUnit(), EVENT_UNIT_DAMAGED ) set ta=TriggerAddAction( t, function Trig_Guarding_Angel_Effect ) call PolledWait(5) call TriggerRemoveAction(t,ta) set t = null endfunction //=========================================================================== function InitTrig_Guarding_Angel takes nothing returns nothing set gg_trg_Guarding_Angel = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Guarding_Angel, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Guarding_Angel, Condition( function Trig_Guarding_Angel_Conditions ) ) call TriggerAddAction( gg_trg_Guarding_Angel, function Trig_Guarding_Angel_Actions ) endfunction |
