HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

casting acid bomb inside a damage detection causes lag

11-25-2009, 01:33 PM#1
Sinnergy
ok I have this trigger which uses Light leakless damage detect, each time a unit with an ability (qspell) takes damage, an xecast object is created to cast acid bomb (0 damage, 15 armor penalty, 10 second duration) to the unit who deals the damage, it also blocks all damage received by the hero until the qspell is removed.

PHP Code:
//! zinc
library OffensivePlates requires LightLeaklessDamageDetectxecastxepreloadSpellEventTimerUtils{
    
constant integer spell 'A00O';
    
constant integer dspell 'A00P';
    
constant integer qspell 'A00Q';
    
    function 
con()->boolean{
        
unit c GetTriggerUnit(), GetEventDamageSource();
        
real f GetEventDamage();
        
xecast xe;
        if(
GetUnitAbilityLevel(c,qspell) > && 100000){
           
// lines that causes the lag
            
xe xecast.createA();
            
xe.abilityid dspell;
            
xe.orderstring "acidbomb";
            
xe.recycledelay 3.0;
            
xe.owningplayer GetOwningPlayer(c);
            
xe.castOnTarget(t);
          
// end of lag codes
            
if(>= GetUnitState(c,UNIT_STATE_MAX_LIFE))
                
UnitAddAbility(c,lifeBug);
            if(
>= GetWidgetLife(c))
                
SetWidgetLife(c,f);
            
UnitRemoveAbility(c,lifeBug);
            
SetWidgetLife(c,GetWidgetLife(c) + f);
        }
        
null;
        
null;
        return 
false;
    }
    
    
struct data{
        
unit c;
    }
    
    function 
act(){
        
unit c SpellEvent.CastingUnit;
        
timer t NewTimer();
        
data d data.create();
        
d.c;
        
UnitAddAbility(c,qspell);
        
SetTimerData(t,d);
        
TimerStart(t,6.0,false,function(){
            
timer t GetExpiredTimer();
            
data d GetTimerData(t);
            
UnitRemoveAbility(d.c,qspell);
            
ReleaseTimer(t);
            
d.destroy();
            
null;
        });
        
null;
        
null;
    }
    
    function 
onInit(){
        
RegisterSpellEffectResponse(spell,act);
        
AddOnDamageFunc(Condition(function con));
        
XE_PreloadAbility(qspell);
        
XE_PreloadAbility(dspell);
    }
}
//! endzinc 
(Sorry but I cannot use the jass tags, it seems like it doesn't support zinc, instead I used PHP tags )
I already tried removing the xecast lines and it seems working fine, I just don't know why does xecast causes lag, or maybe its just acid bomb?

so how to fix this? or get rid of the lag?
thanks
11-25-2009, 02:03 PM#2
Anitarf
There are better ways to reduce a unit's armour for a duration.

What is the Damage Interval data field of your acid bomb set to?
11-26-2009, 10:50 AM#3
Sinnergy
damage interval is 0.0, should I change this to a large value?
11-26-2009, 11:43 AM#4
TheWye
0 damage interval will mean that the spell will deal damage infinite times in 1 second.. if you don't want the damage to occur you should set it to a very large number instead.
11-26-2009, 12:27 PM#5
Sinnergy
ok, I raised the value and it works properly, thanks
11-26-2009, 04:41 PM#6
PurplePoot
In the future, try zinc tags.