| 01-17-2010, 03:15 AM | #1 |
ok I got this trigger to amplify any damage dealt to a flagged unit using Light Leakless Damage Detect by CaptainGriffen, so I simply added a UnitDamageTarget function in between the Disable function and Enable function by LLDD, I also added a debug message to track if the function works or not. In game, I got 3 debug messages displayed, which means the function loops even though I already added a Disable and Enable trigger functions. Code:
//! zinc
library BOY requires AutoIndex, SpellEvent, LightLeaklessDamageDetect, TimerUtils{
constant integer spell = 'A01I';
constant string sfx = "Abilities\\Spells\\Human\\Banish\\BanishTarget.mdl";
boolean boyEffect[];
integer sourceLevel[];
struct data{
unit u;
effect fx;
method onDestroy(){
DestroyEffect(fx);
boyEffect[GetUnitId(u)] = false;
}
}
function dmgDetect()->boolean{
unit t = GetTriggerUnit();
unit c = GetEventDamageSource();
real dmg = GetEventDamage();
integer id = GetUnitId(t);
DisableDamageDetect();
if(boyEffect[id] == true){
UnitDamageTarget(c,t,dmg*(sourceLevel[id]*13.0),true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null);
BJDebugMsg("dealt damage");
}
EnableDamageDetect();
t = null;
c = null;
return false;
}
function act(){
unit c = SpellEvent.CastingUnit;
unit u = SpellEvent.TargetUnit;
timer t = NewTimer();
integer id = GetUnitId(u);
data d = data.create();
boyEffect[id] = true;
sourceLevel[id] = GetUnitAbilityLevel(c,spell);
d.u = u;
d.fx= AddSpecialEffectTarget(sfx,u,"chest");
SetTimerData(t,d);
TimerStart(t,8.0,false,function(){
timer t = GetExpiredTimer();
data d = GetTimerData(t);
ReleaseTimer(t);
d.destroy();
t = null;
});
t = null;
u = null;
c = null;
}
function onInit(){
AddOnDamageFunc(Condition(function dmgDetect));
RegisterSpellEffectResponse(spell,act);
}
}
//! endzincthanks in advance. |
