| 12-16-2006, 02:43 PM | #1 |
This is a complete trigger for a spell called Scorching Blade. JASS:function Trig_ScorchingBlade_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A004' endfunction function Trig_ScorchingBlade_OnHit takes nothing returns nothing local trigger te = GetTriggeringTrigger() local unit u = GetHandleUnit(te, "u") local integer l = GetHandleInt(te, "l") local integer times = GetHandleInt(te, "times") local unit v = GetAttackedUnitBJ() set times = times - 1 if times==0 then call TriggerRemoveAction(te,GetHandleTriggerAction(te,"act")) call FlushHandleLocals(te) call DestroyTrigger(te) else call UnitDamageTarget(u, v, 25+25*l, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE, null) call AddFadingTextTag(I2S(25+25*l), GetUnitX(v), GetUnitY(v), 100, 1, 1, 1) endif set u = null set v =null endfunction function Trig_ScorchingBlade_Actions takes nothing returns nothing local unit u = GetTriggerUnit() local integer l = GetUnitAbilityLevel(u, 'A004') local integer times = 3 local trigger te set te = CreateTrigger() call SetHandleInt(te,"l",l) call SetHandleInt(te,"times",times) call SetHandleHandle(te,"u",u) call SetHandleHandle(te,"act",TriggerAddAction(te,function Trig_ScorchingBlade_OnHit)) call TriggerRegisterUnitEvent(te, u, EVENT_UNIT_ATTACKED) set u = null set te=null endfunction //=========================================================================== function InitTrig_ScorchingBlade takes nothing returns nothing set gg_trg_ScorchingBlade = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_ScorchingBlade, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_ScorchingBlade, Condition( function Trig_ScorchingBlade_Conditions ) ) call TriggerAddAction( gg_trg_ScorchingBlade, function Trig_ScorchingBlade_Actions ) endfunction It's instant cast, and once it is used it should last for 3 attacks, increasing damage dealth by 50 (75, 100, 125). Im' using Kattana' Handle Vars and Vexorians AddFadingTextTag function. WHY DOESNOT IT WORK?! |
| 12-16-2006, 02:46 PM | #2 |
What part of it is it that doesent work? |
| 12-16-2006, 03:06 PM | #3 |
If I knew I wouldn't post it. I can save it in a map with no mistakes, but when I use the ability, it doesn't do anything. |
| 12-16-2006, 03:31 PM | #4 |
Well look.."call TriggerRegisterUnitEvent(te, u, EVENT_UNIT_ATTACKED)". That makes it so the trigger runs whenever the casting unit is attacked. I'm guessing you want the casting unit to deal extra damage, not take extra damage. You also never re-store "times" to the trigger, so it will last forever. In the future try inserting debug messages so you can tell where it stops working. You should always at least try to debug before posting it here. |
| 12-16-2006, 05:55 PM | #5 |
What i would have done, would have ben to just store an integer to the unit, and when a unit attacks, i check if he got the integere (greater than 0) and just decrease it. And having a damage increase ability/buff to do bonus damage. I think it should work, but i have never tried. |
| 12-16-2006, 06:16 PM | #6 |
Don't use SPELL_CAST it is abusable |
