| 12-17-2006, 07:42 PM | #1 |
Hi, I am trying to make a custom shockwave based on Breath of Frost (because I needed a buffable shockwave). On mine "Any unit takes damage" event there is a function like this: JASS:
// Custom Shockwave
if ( GetUnitAbilityLevel( target, 'BCbf' ) > 0) then
call UnitRemoveAbility( target, 'BCbf' )
call CustomShockwave( source, target )
endif
Where BCbf is the Breath of Frost buff. Then, my first debugging function was something like this: JASS:function CustomShockwave takes unit source, unit target returns nothing call DebugMessage( "OK" ) endfunction And all worked fine, the debug message showed only 1 time. At the end, my last function was something like this: JASS:function CustomShockwave takes unit source, unit target returns nothing local integer level = GetUnitAbilityLevel( source, 'ACbf' ) local real damage = level * 50 call DebugMessage( "OK" ) call UnitDamageTarget( source, target, damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS ) endfunction But it didn't work no more! The target is damaged multiple times and the message is shown multiple times! I can't get out of this, any idea? Thanks! |
| 12-17-2006, 08:45 PM | #2 |
You're damaging a unit inside a trigger that waits for that very unit to be damaged... sounds like an endless loop. Then again... the buff test supposedly prevents that. |
| 12-17-2006, 09:26 PM | #3 |
Buff removal isn't instant. Even if you have a buff condition and remove it, it will cause an endless loop. Just disable the trigger, do damage, and then re-enable. |
| 12-17-2006, 09:44 PM | #4 | |
Quote:
But it has a backstab... Using this method it doesn't register the damage, how can I solve this? Because I created a damage detection trigger for each unit in the map and if I disable/enable the trigger, it won't fire for that damage... Any idea? P.S: BTW why doesn't it work? I have many triggers removing buffs in my map and none has ever been a problem... I mean, why should it fire again? There is the buff condition and it doesn't loop forever, just 5-6 times. P.P.S: maybe I should disable the function for that trigger? If yes, how??? (P.P.P.S: maybe a 0 seconds timer???) I tried it, it doesn't work! |
