- Joined
- Nov 6, 2009
- Messages
- 279
I dont understand what's xe's usefulness, can anyone explain plz?
Justify said:If you know what you're doing, TimerUtils, GroupUtils and the rest are not more efficient.
Justify said:What I'm saying: "xe" is not that amazing-uber-imba that no one could code something similar to this, but it's finished, works, and quite nice to use. If you don't like it, write your own caster/missle/... systems and love them![]()
Well, you could either create a complete missle-movement and trigger all the calculation, or do it with xe in about 10 lines. You could either do inefficient dummy-casting with a lot of lines, or use a single on in the end with xe and it recycles dummies. And so on![]()
//! zinc
library ChillingStreams requires xecollider, xedamage, xecast, xepreload, CustomTrigger, GroupUtils
{
constant integer SPELL_ID = 'A000';
constant integer STUN_ID = 'A001';
constant string SFX_HIT = "Abilities\\Spells\\Undead\\FrostArmor\\FrostArmorDamage.mdl";
constant string SFX_MISSLE = "FrozenOrb.MDX";
xedamage xed;
xecast xec;
function SetupDamage()
{
xed = xedamage.create();
xed.dtype = DAMAGE_TYPE_NORMAL;
xed.atype = ATTACK_TYPE_NORMAL;
xed.exception = UNIT_TYPE_STRUCTURE;
xed.useSpecialEffect(SFX_HIT, "chest");
}
function SetupCast()
{
xec = xecast.create();
xec.abilityid = STUN_ID;
xec.orderstring = "thunderbolt";
}
function GetDamage(integer lvl) -> real
{
return lvl*70.;
}
struct Missle extends xecollider
{
Streams parent;
group hit;
method onDestroy()
{
ReleaseGroup(this.hit);
if (this == parent.missle[0])
{
parent.destroy();
}
}
method onUnitHit(unit hitUnit)
{
Missle tempMissle;
if (!IsUnitInGroup(hitUnit, hit) && xed.allowedTarget(parent.caster, hitUnit))
{
xed.damageTarget(parent.caster, hitUnit, parent.damage);
tempMissle = parent.missle[0];
if (tempMissle == this)
{
tempMissle = parent.missle[1];
}
if (IsUnitInGroup(hitUnit, tempMissle.hit))
{
xec.castOnTarget(hitUnit);
}
GroupAddUnit(hit, hitUnit);
}
}
static method createMissle(real x, real y, real angle, Streams stream) -> thistype
{
thistype this = thistype.allocate(x, y, angle);
this.speed = 500.;
this.fxpath = SFX_MISSLE;
this.collisionSize = 100.;
this.scale = 1.5;
this.expirationTime = 2.;
this.z = 100.;
parent = stream;
hit = NewGroup();
return this;
}
}
struct Streams
{
Missle missle[2];
unit caster;
player owner;
real damage;
static method createStreams()
{
thistype this = thistype.allocate();
real cx;
real cy;
real sx;
real sy;
real mx;
real my;
real facing;
real angle;
caster = GetTriggerUnit();
owner = GetOwningPlayer(caster);
damage = GetDamage(GetUnitAbilityLevel(caster, SPELL_ID));
cx = GetUnitX(caster);
cy = GetUnitY(caster);
sx = GetSpellTargetX();
sy = GetSpellTargetY();
facing = Atan2(sy-cy, sx-cx)+bj_PI/2.;
mx = PolarX(cx, facing, 100.);
my = PolarY(cy, facing, 100.);
angle = Atan2(sy-my, sx-mx);
missle[0] = Missle.createMissle(mx, my, angle, this);
facing = facing+bj_PI;
mx = PolarX(cx, facing, 100.);
my = PolarY(cy, facing, 100.);
angle = Atan2(sy-my, sx-mx);
missle[1] = Missle.createMissle(mx, my, angle, this);
}
}
function onInit()
{
RegisterSpellAction(SPELL_ID, Streams.createStreams);
SetupDamage();
SetupCast();
XE_PreloadAbility(STUN_ID);
Preload(SFX_HIT);
Preload(SFX_MISSLE);
}
}
//! endzinc
are you kidding me?^^
xe to complicate? This is a spell of mine, in Zinc but I think you can understand what xe does (it is fixed so some values because I need it like this) If I'd need only one missle, I could remove the "streams" struct completly and the code would be short like... "createMissle" and "onUnitHit" is the part of xe.
JASS://! zinc library ChillingStreams requires xecollider, xedamage, xecast, xepreload, CustomTrigger, GroupUtils { constant integer SPELL_ID = 'A000'; constant integer STUN_ID = 'A001'; constant string SFX_HIT = "Abilities\\Spells\\Undead\\FrostArmor\\FrostArmorDamage.mdl"; constant string SFX_MISSLE = "FrozenOrb.MDX"; xedamage xed; xecast xec; function SetupDamage() { xed = xedamage.create(); xed.dtype = DAMAGE_TYPE_NORMAL; xed.atype = ATTACK_TYPE_NORMAL; xed.exception = UNIT_TYPE_STRUCTURE; xed.useSpecialEffect(SFX_HIT, "chest"); } function SetupCast() { xec = xecast.create(); xec.abilityid = STUN_ID; xec.orderstring = "thunderbolt"; } function GetDamage(integer lvl) -> real { return lvl*70.; } struct Missle extends xecollider { Streams parent; group hit; method onDestroy() { ReleaseGroup(this.hit); if (this == parent.missle[0]) { parent.destroy(); } } method onUnitHit(unit hitUnit) { Missle tempMissle; if (!IsUnitInGroup(hitUnit, hit) && xed.allowedTarget(parent.caster, hitUnit)) { xed.damageTarget(parent.caster, hitUnit, parent.damage); tempMissle = parent.missle[0]; if (tempMissle == this) { tempMissle = parent.missle[1]; } if (IsUnitInGroup(hitUnit, tempMissle.hit)) { xec.castOnTarget(hitUnit); } GroupAddUnit(hit, hitUnit); } } static method createMissle(real x, real y, real angle, Streams stream) -> thistype { thistype this = thistype.allocate(x, y, angle); this.speed = 500.; this.fxpath = SFX_MISSLE; this.collisionSize = 100.; this.scale = 1.5; this.expirationTime = 2.; this.z = 100.; parent = stream; hit = NewGroup(); return this; } } struct Streams { Missle missle[2]; unit caster; player owner; real damage; static method createStreams() { thistype this = thistype.allocate(); real cx; real cy; real sx; real sy; real mx; real my; real facing; real angle; caster = GetTriggerUnit(); owner = GetOwningPlayer(caster); damage = GetDamage(GetUnitAbilityLevel(caster, SPELL_ID)); cx = GetUnitX(caster); cy = GetUnitY(caster); sx = GetSpellTargetX(); sy = GetSpellTargetY(); facing = Atan2(sy-cy, sx-cx)+bj_PI/2.; mx = PolarX(cx, facing, 100.); my = PolarY(cy, facing, 100.); angle = Atan2(sy-my, sx-mx); missle[0] = Missle.createMissle(mx, my, angle, this); facing = facing+bj_PI; mx = PolarX(cx, facing, 100.); my = PolarY(cy, facing, 100.); angle = Atan2(sy-my, sx-mx); missle[1] = Missle.createMissle(mx, my, angle, this); } } function onInit() { RegisterSpellAction(SPELL_ID, Streams.createStreams); SetupDamage(); SetupCast(); XE_PreloadAbility(STUN_ID); Preload(SFX_HIT); Preload(SFX_MISSLE); } } //! endzinc