| 06-11-2006, 11:42 PM | #2 |
The events for a unit being attacked and taking damage are different, so the trigger is probably firing before the buff is applied. |
| 06-12-2006, 12:06 AM | #3 |
So I should use takes damage? |
| 06-12-2006, 01:00 AM | #4 |
Yes. You might even need to add a 0.01 second timer (or wait, although timer would look much smoother) after they take damage to make sure they have the buff. I'm not sure if damage or the buff is applied first, so try it out. |
| 06-12-2006, 01:17 AM | #5 |
Will attacking and attacked unit still work? |
| 06-12-2006, 02:54 AM | #6 |
Possibly, but there should be a Damaging and DamagedUnit or somethings like those. |
| 06-12-2006, 02:57 AM | #7 |
Erm, there is no unit takes damage that I can find. |
| 06-12-2006, 06:48 AM | #8 |
Trigger: Events
![]() Unit - No unit Takes damageIt's a Specific Unit Event, so yes, JASS in order to create the trigger. You could actually do something like. Impale Example Code:function Impale_OrderCast takes nothing returns nothing local unit u = GetTriggerUnit() local unit source = GetEventDamageSource() local unit caster = CreateUnit( GetOwningPlayer(source), [CASTER-RAWCODE], GetUnitX(source), GetUnitY(source), 0 ) local trigger trig = GetTriggeringTrigger() if( (GetUnitAbilityLevel(whichUnit, [IMPALEBUFF-RAWCODE]) > 0) ) call UnitAddAbility( caster, [IMPALE-RAWCODE] ) call IssuePointOrder( caster, "impale", GetUnitX(u), GetUnitY(u) ) endif call RemoveUnit( caster ) call DestroyTrigger( trig ) set u = null set source = null set caster = null endfunction function Impale_DamageCheck takes nothing returns nothing local unit u = GetAttackedUnit() local trigger trig = CreateTrigger() call TriggerAddAction( trig, function Impale_OrderCast ) call TriggerRegisterUnitEvent( trig, u, EVENT_UNIT_DAMAGED ) set u = null set trig = null endfunction function InitTrig_Impale takes nothing reutrns nothing set gg_trg_Impale = CreateTrigger() call TriggerRegisterAnyUnitEventBJ( gg_trg_Impale, EVENT_PLAYER_UNIT_ATTACKED ) call TriggerAddAction( gg_trg_Impale, function Impale_DamageCheck ) endfunction That's just and example, I didn't take the time to actually try it, but something like that should do it. Also if the attack ends up not dealing damage the trigger will still exist, so you'll probably want a timer that will clean up that trigger if it doesn't fire in a set amount of time. |
| 06-12-2006, 09:39 AM | #9 |
Naakaloh's method, while not the best, will work for general intents and purposes (although it does 'leak' a dummy, because it is never killed/removed). It also has a potential leak in the trigger action not being removed (I actually want to check if that is necessary). |
| 06-12-2006, 05:11 PM | #10 | |
Quote:
If the ability is based off of Frost Arrows, then why are you issuing the order of Impale? |
| 06-12-2006, 05:14 PM | #11 |
Blu, yes the triggeraction will leak. |
| 06-12-2006, 06:27 PM | #12 |
I know that trigger actions are supposed to leak, I was just saying I want to test to confirm that. |
