First of all, just want to apologize that it took me so long to respond; I wasn't ignoring you or ungrateful, but I had to think about what you said & that took time (time which, unfortunately, is in very short supply nowadays :<...). That being said:
----------
Why not make these actiosn to target unit directly after casting? So you have to do checks/actions once, and then completly forget about this unit.
----------
Hmm... So it sounds that the "Pick All Units" is too 'costly' (in terms of what, ping? Or computational/processing speed?), but using a global "UnitGroup" variable would be a decent alternative that would allow it?
(But whether I "pick all units matching X, Y, Z..." or create a UnitGroup variable which does the same thing (having to check the map to add/remove the necessary units from the Group), it seems like that's the same amount of work. Maybe I don't understand)
----------
I make an example. I will show 2 methods to get all units in Region1.
1. One global UnitGroup, that never gets destroyed. (good)
2. Creating/destroying a UnitGroup each time.
Method 1
Method 2
I hope you can see the difference. Method 1 needs 3 triggers but is more efficient.
----------
Ok, so you're telling me it's not always the number of triggers that = more/less efficient, but what happens in them? Because yeah, I would've said "3>1!! Less efficient".
----------
In my example I only pick units in Region1, and now imagine you pick every single unit in whole map. If map is very big / or you have many units it is just an enmormous operation, that should be avoided.
----------
Alright, so in order to help you see what I'm trying to accomplish, full disclosure: mainly what I do is work on custom heroes & factions for what is essentially "altered melee"; 5th-race-addition, tavern-addition/replacement, 4-race-replacement, etc.
That being the setting, the "thing" I'm trying to accomplish is (probably 90% of the time) simple trigger-enhanced abilities. Specifically I was using things like "periodic timers" to detect the presence of certain buffs on units & add/remove certain abilities because of it, dynamically.
(example being: "Vicious Roar: a roar that increases allied attack damage & gives them Lifesteal for 30 seconds" (i.e. modified Roar ability, then a periodic trigger that, detecting the presence/absence of the "roar" buff, adds/removes a hidden "lifesteal" ability to the affected unit))
That all being said, it should be clear that this will be cycling through every possible unit on the map (except, perhaps, buildings & trees & such), and should be updating reasonably fast (at least as fast as an Aura; hence .3/.5 seconds...). The map size, of course, may be as small as 1v1 or as large as 6v6. The actual "triggers" are quite 'lite' I would think ("add/remove ability" is pretty much it, so far).
I realized early on, though, that having a whole bunch of triggers like that would (probably) be a problem. Hence my question.
----------
Now I should method 3, without UnitGroup. Units will be indexed and I will use loop to catch them:
Method 3
You see in this method exists no UnitGroup. The reason is, because it's a lot faster.
In the 'Else - Actions' part the unit has left the region, so we have to deindex properly.
The method I used is called dynamic indexing because it avoids letting an empty index in my unit[array] variable. (once a unit leaves, it would be null)
For GUI and looping each 0.50 secnds metho 1 would absolutly do the job without any problem. For bigger situations and/or more complex systems indexing is definitly faster and more efficient.
EDIT:
Added "maxIndex = maxIndex - 1" in the deindex part in method 3!
----------
<span style="font-size: 9px">(So wait, "Method 3 doesn't use Unit Group because Method 3 is faster"? Or "Method 3 is faster because it doesn't use Unit Group"?)</span>
Alright, so I'm trying to understand the coding here... So I think I finally understand the "indexing" bit (you're not using Custom Value, you're just creating a massive array with (potentially) each unit on the map on it, that fits my criteria (in this case, "(T/F) Has this Buff")).
But given what I have said above about what my needs are (variable (often large) map-size, picking every map unit, reasonable updating frequency, simple triggers, etc), are you suggesting that Method 3 is usable for this/these tasks? And if so, how many can I use before it too becomes a problem (i.e. 1-5, 5-10, 10-20, etc)?
Thanks again for your thoughts. Sorry it took me so long.
Respectfully,
Kyrbi0