Ok folks, after about a month of work, here's EXSP v1.4 in its final version. The entire thing was deeply rewritten, and I hope it's really stable at last. It took me some time to grasp some fundamental lua concepts, but I think I'm progressively getting there. Here's the latest file:
https://docs.google.com/folder/d/0B-rVm ... 5sMVU/edit
Scripting spells has been incredibly simplified with this release, but this means old code is not necessarily compatible anymore. If anyone has started scripting spells for exsp, I can help you upgrade your code, just pm me.
I'm also in the process of moving the whole updated documentation to a wiki, for easier reference:
https://sites.google.com/site/exspwiki/home
Here's the complete changelog for 1.4:
Exsp version 1.4
•
Changed: Exsp now automatically creates its script entity; you don’t need to copy any code in the editor.
•
Changed: Exsp now automatically detects ALL spells that are spawned in the dungeon, as long as they are defined in exsp. So now you don’t need to use any additional scripting for spawners in the editor if you don’t want to.
•
Changed: The whole exsp script has been rewritten in an object-oriented structure. All exsp methods must now be called using a colon instead of a dot. So now you must write exsp:defineSpell() instead of exsp.defineSpell(). All hooks now return self as their first argument, which is the exsp extended spell object. This object now contains all spell properties, including custom, dynamic and predefined ones, as well as methods for common spell operations. So no more sd[sId].x clumsy syntax in hooks, just self.x. This makes hook scripting much more cleaner, and fixed a few serialization and upvalues errors. This is NOT backwards compatible.
•
Changed: The whole “noLaunch” system that duplicated spells was clumsy and is abandoned in favor of a much more intuitive solution: spell objects must be defined in .lua files with launchSound = “silence”, and the system uses the launchSound defined in exsp to play or not the sound depending if the spell is cast or spinned. This also removes the awkward requirement of putting two receptors to catch normal and noLaunch objects. This is NOT backwards compatible.
•
Changed: spellSpawn() syntax has been simplified to two forms instead of three. Now, if you provide an object id, facing is now always the third argument. Also, removed power, ordinal or noLaunch arguments as they were redundant with properties. This is NOT backwards compatible.
•
Changed: spellCast() syntax has been simplifed and is more powerful. Removed power and skill arguments and added the more versatile properties argument. This is NOT backwards compatible.
•
New: A new entity extender module has been added (syntax: local monster = extend:entity(monster), all monster entities in spell hooks are returned pre-extended) with new monster methods:
o :holdMonster(duration)
o :unholdMonster()
o :isHeld()
o :onUnhold(function(self))
o :freezeMonster(duration)
o :isFrozen()
o :onUnfreeze(function(self))
o :makeInvulnerable(duration)
o :unmakeInvulnerable()
o :isInvulnerable()
o :onUnmakeInvulnerable(function(self))
•
New: spellResidualEffect() function to create timed repeating effects after the spell object disappears.
•
New: defineFx() and playFx() functions to easily spawn effects with particle systems.
•
New: maxLength property to automatically destroy a ProjectileSpell after a certain distance.
•
Improved: delay() now returns a delayId, which can be used with the new cancelDelay() function to prevent the execution of the delayed function.
•
Improved: Spell ids are now generated at random and are shorter (easier debugging, no chance of duplicate id error).
•
Improved: Added “cone”, “cone_narrow” and “cone_wide” shapes to areaOfEffect().
•
Improved: Hook detection is now done using a single onDrawGui trigger instead of numerous fast timers (0.05s). It’s more reliable and less taxing on the CPU.
•
Fixed: If a spell is spawned on a monster square while the monster is attacking the party, the ProjectileSpell object might be spawned behind the monster and miss it. Exsp now checks for and handles correctly these situations.
•
Fixed: Damage delaying for onMonsterHit execution was not correctly handled for burst spells.
•
Fixed: Both onPass and onHit hooks were called for the same tile in some cases.
•
Fixed: setSpellSpinnerTarget() didn’t handle its changeFacing argument correctly.
•
Fixed: Distance was not calculated correctly for piercing spells.
•
Fixed: Defined “shockburst” instead of “shock”.
•
Fixed: General stability issues, some variables weren’t defined properly as local, and some detection algorithms could fail, creating possible crashes.