Which Variables should be Array ?



Level 9
Nov 19, 2011
I'm about to do my second MUI trigger in the whole life. But I would like to remember the variables that should use Array. Like Triggering player, triggering unit, point, Integer, real, timer, dummies etc.
Level 14
Jun 27, 2008
The first step is to think about what the spell should do and how. Try to think about what information do you need at which point of the spell.

For example:
1. Right after casting deal some instant damage to all units in a line from the caster to the target and create an effect on the targets head.
2. Every two seconds deal some damage to the target
3. In the end remove the effect on the targets head.

The things that happen instantly after casting arent interesting, as MUI is only complicated with things that happen after some time.
So 1. isnt important
For 2. you need to know who the target is, and who the caster is (so he can get credit for the damage), and maybe how much damage you want to deal (if this isnt always the same).
For 3. you need to destroy the effect, so you need to know which effect you want destroyed.

-> You need to store "target", "caster", "damage", "effect". All those values are different for every instance of the spell, as every instance has its own target, its own caster, its own effect etc.
All those values which are different for every instance need to be saved in an array.
In contrary, the unitgroup you use to deal line damage does not have to be stored in an array. The linedamage is done instantly, which means that different instances of the spell that are casted after each other dont influence each other.

-> When casting the spell, get a new Index for the array (i guess you know how that works?), save those values in the arrays using that index.
  • Like
Reactions: hdm