(This is copy/pasted from the Race-Building topic, since, as Flame_Phoenix suggested, this might get more "publicity" that way).
~~~
Alright, I'm in crunch time and I've hit a wall as to what to do here. Normally I'd love to keep this a secret, but time is not on my side, so I must swallow my pride (Hey, I'm a poet and I didn't even know-it. :P)
I've got a set of 3 triggers to make an ability I have no previous framework to base off of.
- The base ability (Metalocalypse) is a modified Roar; only targets friendly Mech units, and the duration is 5 seconds (short, for the purposes of the trigger.
- The "inner fire" ability has the same buff as the Roar (Metalocalypse), but this is the actual spell duration (like 60), to differentiate the hero.
- "Automatons" are but one type of unit that I want this to work on. If it works for one, I can copy/paste and change values for the rest.
- "[Dummy] Metalocalypse - Armor" is a dummy, hidden ability (Item-based, no icon) that provides different levels of armor.
The point of the spell (I'm gonna hate myself for revealing it :<...) is to 'suck up' all nearby "Automatons" (caps at 5) and increase the level of the "Dummy Armor" ability accordingly. Then, once the buff is removed from the hero, this periodic "Remove" trigger will remove all traces of it (the Dummy Armor ability), and re-spawn the right number of Automatons (based on the level of the ability, since that
should be the how many were "sucked up".
~
Speaking of the problems with the spell: after fluctuating between "totally working" and "not working at all" (really, don't ask me; the "Test Map" button hates me), it is "currently" (as of last testing) completing all phases of the skill (buffs and "sucks up" a few Automatons, gives the hero +Armor (ability), after duration removes the +Armor and re-spawns Automatons).
However, it is not working in terms of magnitude...
It "sucks" up as many as are close, up to 5 (does not always pick 5). Then, it always increases the level of the "Dummy Armor" skill to 6, giving a +10 bonus to armor. Finally, upon the end of the duration, it always creates 6 Automatons (due to the level of the ability being 6), regardless of how many it "sucked up".
I attribute most (if not all) of the problem to the fact that, within the double-loop (for each integer A 1-5, Pick every (Random 1 unit....))) ), I increase the level of the ability.
Regardless of whether or not it "sucks up" an Automaton (it comes after it, but it doesn't necessarily require it).
So is there a way to make that happen? Say "IF a unit is ordered, THEN increase ability level for casting unit", or something? Or have I done something entirely wrong?
Further, will this work with several different unit-types? Lots of different loops going around?
Thank you for your time and help, if possible.
--EDIT--
Also, even though it
shouldn't do this by right, it's completely ignoring the line that says "turn casting hero 50% transparent. It
was ignoring the "add Dummy Armor ability" line, too, until I moved it before the "dummy caster" bit. Same thing? Why!?