Looking from the description of the ability, I think that you would have to use array indexes. To set it up, (all of these must be global) you would need a unit array for units learning that ability, a boolean array to check whether or not they have already detected something, a real array that increments by 1 second should the boolean array return true and exit when it is greater than or equal to 60, and an integer that counts the number of instances. (This is for MUI capability)
(Detection Setup)
(If it is a hero ability)
Now, you would need a trigger that catches the event when the unit learns that ability. After catching the event, you would want to check first if it exists by looping over all possible instances up to the counting integer and add its' data if it is not found.
(If it is a unit ability, assuming that it already has the ability)
You would want to catch the event when it enters the Playable Map Area. If the event would fire, you would check if the ability in question of the unit is not equal to 0, that is, it has the ability. If it does not have the ability, when you add the ability, you should add its' data into the unit array, boolean array and the real array; being that only the unit array is defined.
(Timer Trigger)
Now, as they had previously answered, you would do all of the event processing here, using a loop structure (local integer from your starting integer to your counting integer.)
-
Custom Script: local integer i = 1
-
For something from i to udg_somevar, do actions
I believe that would do.
Now for the optimizations...
I won't include it for now...