The successor to the Caster System, xe is a collection of libraries primarily aimed at spell makers. The core of this system is the xebasic library and the all-purpose dummy unit that comes with it. The rest of the system are all optional modules, each one designed to provide a specific feature that is commonly needed in spell making such as dummy casters and various projectiles.

xepreload prevents the lag that occurs ingame when any ability is first added to a unit.

xedummy recycles dummy units to help optimize maps that rapidly create and remove such units.

xecast handles dummy casters so you don't have to, making it easier to cast spells with triggers.

xefx allows you to move, rotate, scale and recolor special effects by attaching them to dummy units.

xecollider is a directional projectile that detects collisions with units in its path.

xemissile is a targeted projectile with arced trajectory, like standard Warcraft missiles.

Changelog

0.9:

- Added xemissile.
- Added xedummy.
- xefx can now use xedummy to recycle dummy units.
- xepreload can now be used from struct initializers.
- Fixed a bug in xecast that would occur if recycledelay was shorter than
the duration of the spell cast by the dummy caster.
- Fixed a bug in xefx where hiddenReset did not properly assign the new fxpath.
- Optimized the xecollider collision detection.
- Fixed some errors in xefx and xecast documentation.
- new sample: Firestrike.
- Removed an xecast leak in the IllusionRune sample.
- Removed a handle id leak in SheepStaff sample.

0.8:

- No longer let xecollider hit corpses...
- When xecollider misses targetUnit (the unit dies, it will stop homing and
keep going on its current direction).
- angleSpeed no longer implicitly makes rotation automatic unless there is homingm,
If you want rotation, set the boolean member rotation to true.
- xedamage: Added MAX_DAMAGE_FACTOR to prevent some deads, a debug message will
appear if the unit dies when being tested for a damage factor.
- xepreload: debug message when preloading an ability at a wrong time.

0.7:

- Requires jasshelper 0.A.2.4 or greater.
- xepreload will now show an useful error when the ability does not exist
(in debug mode).
- xepreload may now use TimerUtils to recycle its timer if you happen to have
TimerUtils in the map.
- xecast automatically resets mana and cooldown for the dummy before making it
cast stuff. If this behaviour concerns you, you may disable it through a
constant.
- Added targetUnit, setTargetPoint and forgetTarget to xecollider's
documentation.
- Added abilityLevel to xefx.
- Fixed a mistake in xefx's documentation that said "copy the xecast trigger"
- xedamage: Added a constant FACTOR_TEST_DAMAGE, which allows you to set the
amount of damage to do when testing for damage...
- xedamage: Added an isDummyDamage event response boolean to detect test
damages.
- xedamage: Added a lot of things to documentation about the issues with armor.
- xedamage: fx is for sure not shown when there is no damage.
- xefx: added hiddenDestroy and hiddenReset
- new sample: Chains of fire.

0.6:

- The demo map is playable in patch 1.24.
- Only the samples and demomap system needed to be updated, xe's libraries themselves have not changed.

0.6:

- allowedTarget does not perform damage on ignored damage/attack types.
- fixed a bug inside a commented out line in FireNovaStrike.
- xecollider.terminate should work correctly outside of onHit events.
- removed safeMove method that did nothing from xefx
- xefx can now optionally use ARGB's ARGBrecolor module.

0.5:

- xecollider.terminate now prevents events from firing.
- fixed a unit handle index kidnap in inRangeEnum (xecollider).
- fixed a small documentation bug about xecollider.terminate
- xecast's anti-AI protection now pauses the unit instead of removing the
ability (since that seemed to have bad side effects)

- xecast is now able to deal with units not visible to the player by setting
a constant to true.
- Due to technical split, xecast.castOnTarget now only takes unit and not
widget, old castOnTarget that takes widget has been renamed castOnWidgetTarget.
- xecollider now will not miss the detection of certain units that get inside
the range too fast anymore, however now creates a group per collider (damn) I
hope to find a better solution.
- Added a notice in xepreload's documentation about order events firing during
the preload.
- Added gem of double green fire

0.4:

- More documentation fixes.
- xecast no longer has double frees when using create/Basic/A and the
AOE/group methods.
- damageDestructablesInAOE now actually works and does not leak a xedamage
reference.
- damageTarget now returns true if it was succesful and false if it wasn't.
- xefx's recycle bin now extends array.
- added rune of illusions sample.

0.3:

- More documentation fixes.
- xefx requires xebasic in the library declaration (as it was supposed to)
- xefx now creates the effects at the correct place (used to consider pathing
during creation for some reason).
- xebasic sample uses 197.0 for max collision size since that's the default in
warcraft 3 (The default + 1)
- xebasic now includes an explanation for max collision size and its effects.
- added useSpecialEffect to xedamage
- included BoundSentinel
- added xecollider
- xedamage's required unittype field is not ignored anymore.
- Added the fireNovaStrike example.

I never did enjoy the caster system just because of how ungainly it was. Simplicity, modularity, efficiency wins.

Excited to see this, though I probably won't use it. I've always liked the idea of every spells' scope containing absolutely everything that the spell needs to function. It just makes things so much easier.

Either way, more power to ya

EDIT: I hate myself for making this post. Somebody kick me in the face.

__________________

By reading this signature, you agree that I cannot be held accountable for anything that I might say or do.

actually, that's not alien at all really. that's just making awesome use of methods. actually that looks really awesome. load up the module with everything it needs to know, and then tell it what actions to run - a very dynamic, open style to coding, and I like it.

__________________

By reading this signature, you agree that I cannot be held accountable for anything that I might say or do.

Why not change xecast to being a cast module to more or less a group module as in-- using group functions with being able to set the functions that effect picked units with? I think it would have a lot more uses.
(Also i never really got the idea of making a spell that casts more spells it just sounds odd and inefficient, as you could just do the effect of the spell and avoid having to use a caster to cast it at all. The only real reason you would use such a thing would be for having single target spells dealt to a group, and that could even be handled in a picked unit function also.)

Another thing, why would you ever do separate location and x/y functions(so you could use both)? It's only a few lines of code to transfer into just x and y. Isn't it better just to always use x and y than a location?
(Although i remember hearing locations transfer faster between functions; i also think i remember hearing that x/y is faster in functions. And i think the x/y won better in performance either way.)

Below is taken from exfx documentation;

Quote:

________________________________________________________________________________
player owner
----
For some reason you might want to change ownership of the effect, for
example, if you use abilityid (see bellow) and the ability does damage.

Example: set myfx.owner = GetOwningPlayer(GetTriggerUnit() )

________________________________________________________________________________
player owningplayer
----
The player that owns the spell (Who gets credited for it)
Example: set somevar.owningplayer = Player(2)

These should be the same thing... (If not it's just too weird having one player deal the damage and another player get the rewards.)

Quote:

________________________________________________________________________________
playercolor teamcolor
----
The recycle delay is the time to wait before recycling the dummy caster, if
it is 0.0 the ability will be considered instant.

A proper recycle delay is important since when a dummy caster is recycled
its owner becomes player passive. Every damage done by the casted spell will
not credit the correct player.

Some other spells need some time in order to cast correctly. Not to mention
the channeling ones that require the caster to last during that situation.

Example: set somevar.recycledelay=10.0

And.. This doesn't explain what the playercolor teamcolor setting is for...

Since you always want to set an orderstring and an ability id (and since you are not very likely to do it multiple times for the same xecast), I think it would be justified to shape the create method like methodcreatetakesintegerabi_id, stringorderreturnsxecast which would save 2 lines of code for each spell, making it look cleaner. Does only cost 1 extra function call/spell, and that's at map init.

__________________

Submissions::

(v)JASS TutorialCovers how to make fast and safe coding for common tasks in vJASS/JASS.

It is not necessary to pause non-periodic timers, There is also nothing to null as I am not using a variable there.

Themerion:

JASS:

//========================================================================================================// you are always allowed to use .create() but you can also use createBasic which sets some things that// are usually necessary up.//publicstaticmethodcreateBasictakesintegerabilityID, integerorderid, playerownerreturnsxecastlocalxecastr=xecast.allocate()
if(r==0) thendebugcallBJDebugMsg("Warning: unbelievable but you actually used all xecast instances in your map! Please make sure you are not forgetting to destroy those what you create intensively, if that's not the case, then you'll have to increase xecast MAXINSTANCES")
endifsetr.abilityid=abilityIDsetr.owningplayer=ownerreturnrendmethod

Though I should probably add an orderstring version, people like orderstrings for some reason.

Switch: That's an error with xefx's documentation, I was using xecast's as a template and it looks I left some garbage there

fixed?:

xefx
----
This module just allows you to have movable special effects, they are actually
dummy units, you can do plenty of things like changing their position, their
height, their rotation (in the xy and in the z axis as well), color, and things
like that. It is all about assigning attributes, the only two important methods
xefx objects have are create and destroy. There are other accessory methods.
implementation
--------------
Just copy the xecast trigger to your map.
xecast object
-------------
__________________________________________________________________________________________________
static method create takes real x, real y, real facing returns xefx
--
This is the create method, it will make a new xefx for you to use, there are
initial values you must specify, like the x,y coordinate and the facing angle.
facing is in radians.
Eg. set myfx = xefx.create()
__________________________________________________________________________________________________
method destroy takes nothing returns nothing
--
This just destroys your xefx object. (call myfx.destroy() )
* List of attributes *
________________________________________________________________________________
string fxpath
----
Determines the model of the special effect, yes, you may change it after
assigning it if necessary to change the model path.
Example: set myfx.path = "abilities\thisisamadeup\modelpath.mdl"
________________________________________________________________________________
real x
real y
real z
----
Determine the position of your special effect, you can keep moving the
effect in a periodic loop, etc.
Example: set myfx.x=myfx.x + 65.0
set myfx.y=GetUnitY(u)
set myfx.z=JumpParabola(t)
________________________________________________________________________________
real xyangle
----
The angle in the xy plane, also called 'facing' angle. (Note: uses radians)
Example: set myfx.xyangle = AngleBetweenPoints(target, source)*bj_DEGTORAD
________________________________________________________________________________
real zangle
----
The angle in the z-axis (inclination?), (Note: uses radians)
Example: set myfx.zangle = bj_PI/2 //Now the model will look towards the sky
________________________________________________________________________________
integer r
integer g
integer b
integer a
----
Well, the model's vertex coloring in RGB , a is the opacity value (use
values from 0 to 255 here)
Example: set myfx.r=255
set myfx.g=0
set myfx.b=255
set myfx.a=128
______________________________________________________________________________________
method recolor takes integer r, integer g , integer b, integer a returns nothing
----
This one assigns all the color values in one pass.
________________________________________________________________________________
real scale (write-only)
----
Allows you to resize the xefx object, the default scale is 1.
Example: set myfx.scale=2.0 //double size (in fact 8x)
set myfx.scale=0.5 //half size (in fact 1/8x)
________________________________________________________________________________
player owner
----
For some reason you might want to change ownership of the effect, for
example, if you use abilityid (see bellow) and the ability does damage.
Example: set myfx.owner = GetOwningPlayer(GetTriggerUnit() )
________________________________________________________________________________
integer abilityid
----
Well, you may use a xefx object to grab a passive ability, perhaps you need
it for ye candy reasons or you want to use it as a damage dealer.
Example: set myfx.abilityid = 'Hphf'
________________________________________________________________________________
playercolor teamcolor
----
The recycle delay is the time to wait before recycling the dummy caster, if
it is 0.0 the ability will be considered instant.
A proper recycle delay is important since when a dummy caster is recycled
its owner becomes player passive. Every damage done by the casted spell will
not credit the correct player.
Some other spells need some time in order to cast correctly. Not to mention
the channeling ones that require the caster to last during that situation.
Example: set somevar.recycledelay=10.0
________________________________________________________________________________
method flash takes string modelpath returns nothing
----
It shows the dead animation of the model specified by modelpath. This is
in case you need this sort of eye candy.

Quote:

(Also i never really got the idea of making a spell that casts more spells it just sounds odd and inefficient, as you could just do the effect of the spell and avoid having to use a caster to cast it at all. The only real reason you would use such a thing would be for having single target spells dealt to a group, and that could even be handled in a picked unit function also.)

The truth is that blizz spells are always going to be more efficient than you coding the effects yourself, there are also many things where dummy casters is just nice. Also your suggestion about groups is not something I agree with, mostly because I think, we should stop using groups that much, I also think a planned vJass feature would make such system unnecessary.