When you script your targeted lua abilities you may have had issue of the protection against such spells not working. Linken Sphere and Lotus Orb.
To allow your cool new ability to be effected by these items you only need to add this line in your code:
hTarget in this example is assumed to be the target unit. The
self is your ability. It is used by abilities like lotus orb to know what spell to send back. The
hTarget:TriggerSpellAbsorb( self ) returns true only if player has Linken Sphere or some custom item coded to have similar function.
In case of Lotus Orb the same line triggers Lotus Orb but always returns false.
Now to create your own Lotus/Linken like effects here are the two function declarations:
With Linken sphere the code is pretty much checking the cooldown of the origin ability and if not on cooldown, play effect, return 1.
Simple right? The Lotus Orb is bit more complex and even my version is not fully tested for bugs but it has been working perfectly so far.
The reason we remove the stored spell at next trigger is to make sure there is no 'null' reference. For example if a modifier created by the spell tries to access the origin spell, if we were to remove it right after the cast, the game would give error message.
Some ideas how you could use all that you have learned here:
-Create combination of lotus and linken sphere. (block and reflect)
-Passive that reflects every third spell.
-Passive that blocks spell and gives you the mana used on it.
-Blink & disjoint projectiles when a spell is cast against you.
Here is small piece of code to get you started with the blink:
Next Topic: Transformations