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;A001039;;
constant integer DUMMY_ID = 039;u000039;;
constant integer ARMOR_ID = 039;A002039;;
constant real PERIODIC = 1.00;
constant string TARGET_ID = "Abilities\\Spells\\Other\\SoulBurn\\SoulBurnbuff.mdl";
constant string EFFECT_ID = "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl";
constant string ATTACH_ID = "overhead";
constant string ISSUE_ID = "acidbomb";
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) -> real
{
return -1.00*level+5.00;
}
function Damage(integer level) -> real
{
return 20.00*level+125.00;
}
function AreaOfEffect(integer level) -> real
{
return 100.00*level+250.00;
}
function IsUnitInvulnerable(unit whichUnit) -> boolean
{
return (GetUnitAbilityLevel(whichUnit,039;Avul039;)>0);
}
struct data
{
unit caster;
unit target;
effect sfx;
integer level;
}
function onDamage() -> boolean
{
unit t = GetFilterUnit();
unit d = null;
if (IsUnitEnemy(t,GetOwningPlayer(Caster)) &&! (IsUnitType(t,UNIT_TYPE_STRUCTURE)) &&! (IsUnitType(t,UNIT_TYPE_MAGIC_IMMUNE)) &&! IsUnitInvulnerable(t))
{
d=CreateUnit(GetOwningPlayer(Caster),DUMMY_ID,GetUnitX(t),GetUnitY(t),0.00);
UnitApplyTimedLife(d,039;BTLF039;,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>=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() -> 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