[ZINC] Condition Problem

Carnerox

The one and only.
Reaction score
84
This was my first time coding with Zinc after reading the zinc manual. Everything thing works good to a point, no errors, except when Tick is greater then delay, nothing runs, and I doubt the damage, or the other conditions work either, maybe someone can spot what I messed up on. ><

JASS:
constant native UnitAlive takes unit whichUnit returns boolean
//! zinc
library Incinerate requires TimerUtils
{
    constant integer ABIL_ID = &#039;A001&#039;;
    constant integer DUMMY_ID = &#039;u000&#039;;
    constant integer ARMOR_ID = &#039;A002&#039;;
    constant real PERIODIC = 1.00;
    constant string TARGET_ID = &quot;Abilities\\Spells\\Other\\SoulBurn\\SoulBurnbuff.mdl&quot;;
    constant string EFFECT_ID = &quot;Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl&quot;;
    constant string ATTACH_ID = &quot;overhead&quot;;
    constant string ISSUE_ID = &quot;acidbomb&quot;;
    constant attacktype ATTACK_TYPE = ATTACK_TYPE_NORMAL;
    constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_MAGIC;
    constant weapontype WEAPON_TYPE = null;
    unit Caster;
    integer Tick = 0;
    integer Level;
    group Group;

    function Delay(integer level) -&gt; real
    {
        return -1.00*level+5.00;
    }
    
    function Damage(integer level) -&gt; real
    {
        return 20.00*level+125.00;
    }
    
    function AreaOfEffect(integer level) -&gt; real
    {
        return 100.00*level+250.00;
    }
    
    function IsUnitInvulnerable(unit whichUnit) -&gt; boolean
    {
        return (GetUnitAbilityLevel(whichUnit,&#039;Avul&#039;)&gt;0);
    }
    
    
    struct data
    {
        unit caster;
        unit target;
        effect sfx;
        integer level;
    }
    
    function onDamage() -&gt; boolean
    {
        unit t = GetFilterUnit();
        unit d = null;
        if (IsUnitEnemy(t,GetOwningPlayer(Caster)) &amp;&amp;! (IsUnitType(t,UNIT_TYPE_STRUCTURE)) &amp;&amp;! (IsUnitType(t,UNIT_TYPE_MAGIC_IMMUNE)) &amp;&amp;! IsUnitInvulnerable(t))
        {
            d=CreateUnit(GetOwningPlayer(Caster),DUMMY_ID,GetUnitX(t),GetUnitY(t),0.00);
            UnitApplyTimedLife(d,&#039;BTLF&#039;,1.50);
            UnitAddAbility(d,ARMOR_ID);
            IssueTargetOrder(d,ISSUE_ID,t);
            DestroyEffect(AddSpecialEffect(EFFECT_ID,GetUnitX(t),GetUnitY(t)));
            UnitDamageTargetEx(
                Caster,    
                t,   
                Damage(Level),
                true,
                false,
                ATTACK_TYPE,
                DAMAGE_TYPE,
                WEAPON_TYPE);
        }
        t=null;
        return false;
    }
    
    function onLoop()
    {
        timer t = GetExpiredTimer();
        boolexpr b = Filter(function onDamage);
        real x;
        real y;
        data this = data(GetTimerData(t));
        x=GetUnitX(this.target);
        y=GetUnitY(this.target);
        Tick=Tick+1;
        if(Tick&gt;=Delay(Level)) 
        {
            GroupEnumUnitsInArea(
                Group,
                x,
                y,
                AreaOfEffect(this.level),
                b);
            UnitShareVision(this.target,GetOwningPlayer(this.caster),false);
            DestroyEffect(this.sfx);
            DestroyBoolExpr(b);
            b=null;
        }
        else
        {
            if (UnitAlive(this.target)) 
            {
                Tick=Tick+1;
            }
            else
            {
                ReleaseTimer(t);
                ReleaseGroup(Group);
                DestroyEffect(this.sfx);
            }
        }
        t=null;
    }
    
    function onEffect() -&gt; boolean
    {
        timer t = NewTimer();
        data this = data.create();
        this.caster=GetTriggerUnit();
        Caster=this.caster;
        Level=GetUnitAbilityLevel(this.caster,ABIL_ID);
        this.target=GetSpellTargetUnit();
        UnitShareVision(this.target,GetOwningPlayer(this.caster),true);
        this.sfx=AddSpecialEffectTarget(TARGET_ID,this.target,ATTACH_ID);
        SetTimerData(t,integer(this));
        TimerStart(t,PERIODIC,true,function onLoop);
        t=null;
        return false;
    }
    
    function onInit()
    {
        trigger trig = CreateTrigger();
        TriggerAddCondition(GT_RegisterStartsEffectEvent(trig,ABIL_ID),Condition(function onEffect));
    }
}
//! endzinc
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top