Ready for the long post ?
-
DT Setup
-
Events
-
Conditions
-
Actions
-
Set DT_DrainSetup[1] = 30.00
-
Set DT_DrainSetup[2] = 40.00
-
Set DT_DrainSetup[3] = 50.00
-
Set DT_Ability = Entangling Roots
-
Set DT_Buff = Draining Tentacle
-
Set DT_DrainSFX = Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
DT_DrainSetup[] is an array variable in which the number inside it representing level power. For example, at level 1 (DT_DrainSetup[1]), the drain would be 30 per second while at level 3 (DT_DrainSetup[3]), drain would be 50 per second
As for other variables, you understand, right ?
-
DT Cast
-
Events
-
Unit - A unit Starts the effect of an ability
-
Conditions
-
(Ability being cast) Equal to DT_Ability
-
Actions
-
Set DT_MaxIndex = (DT_MaxIndex + 1)
-
Set DT_Caster[DT_MaxIndex] = (Triggering unit)
-
Set DT_Target[DT_MaxIndex] = (Target unit of ability being cast)
-
Set TempInteger = (Level of DT_Ability for DT_Caster[DT_MaxIndex])
-
Set DT_Drain[DT_MaxIndex] = DT_DrainSetup[TempInteger]
-
Trigger - Turn on DT Loop <gen>
What I did here was a method called
indexing which will make your spell MUI (and also, SMUI).
If you do not understand what is MUI and SMUI, let me explain.
MUI
It stands for Multi-unit Instanceability - in which it refers to the capability of the trigger to handle the ability
for all instance of it at a time. In English, when you cast this spell by 2 units at the same (or within the duration of the spell while still running), the spell won't be bugged (overwritten) and will work for each instance flawlessly. Without
indexing or
hashtable, you can't make a trigger to become MUI (well, yes you can, but you have to use local variable for that) but locals are not advised to be used if the trigger does a very long job because it will lose its efficiency - somehow.
SMUI
Stands for Stacking Multi-unit-Instanceability in which it refers to the trigger's capability to handle the spell/system without overwriting it from a same instance of unit. If let's say Caster casts a spell to Target provided that the spell lasts for 5 seconds. In the 3rd second, Caster re-cast the spell again to Target. If the trigger is not SMUI, it will overwrite the first cast, and resets the counter (duration) to 5. If it is SMUI, it will handle each instance respectively, therefore the duration would be 2 seconds left and 5 seconds left, applied to the unit.
-
DT Loop
-
Events
-
Time - Every 1.00 seconds of game time
-
Conditions
-
Actions
-
For each (Integer DT_CurrentIndex) from 1 to DT_MaxIndex, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(DT_Target[DT_CurrentIndex] is alive) Equal to True
-
(DT_Target[DT_CurrentIndex] has buff DT_Buff) Equal to True
-
Then - Actions
-
Unit - Cause DT_Caster[DT_CurrentIndex] to damage DT_Target[DT_CurrentIndex], dealing DT_Drain[DT_CurrentIndex] damage of attack type Spells and damage type Normal
-
Unit - Set life of DT_Caster[DT_CurrentIndex] to ((Life of DT_Caster[DT_CurrentIndex]) + DT_Drain[DT_CurrentIndex])
-
Special Effect - Create a special effect attached to the origin of DT_Caster[DT_CurrentIndex] using DT_DrainSFX
-
Special Effect - Destroy (Last created special effect)
-
Else - Actions
-
Set DT_Caster[DT_CurrentIndex] = DT_Caster[DT_MaxIndex]
-
Set DT_Drain[DT_CurrentIndex] = DT_Drain[DT_MaxIndex]
-
Set DT_Target[DT_CurrentIndex] = DT_Target[DT_MaxIndex]
-
Set DT_CurrentIndex = (DT_CurrentIndex - 1)
-
Set DT_MaxIndex = (DT_MaxIndex - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Then - Actions
-
Trigger - Turn off (This trigger)
-
Else - Actions
As for this trigger's explanation, it's pretty simple.
The IF/THEN/ELSE function, is for the trigger to decide whether the spell should end, or keep on draining.
It uses 'And' condition, which both must be true, for the spell to be continue, if either 1 of the condition is not true, the spell would stop.
Condition 1 - isTargetAlive ?
Condition 2 - isTargetHasBuff ?
The first condition checks whether the target is still alive or dead.
The second condition checks the Target unit if it still has the buff - this indicate the
duration of the spell (which you can edit it in Object Editor).
SpellDuration == BuffDuration
As in the ELSE block, it does nothing but to de-index your indexing so that the indexing is
dynamic, you would not have a waste index lying around in the game memory - it does not relate to the spell, at all, it's just a method to Dynamic Indexing.