It is a rather complex title so I'll try to explain.
I have about 8 different unit types. When each of these specific unit types come into range of a specific structure type, then the units (or the structure) gain access to an Aura effect which grants nearby friendly structures bonus shield capacity and armor.
I'm having a very hard time figuring out how to do this. Initially, I gave each of the 8 specific unit types their own aura buff which is automatically deactivated, or activated when they come in range of the activating structure (I do this through enumerate validator).
However, the problem is when you adjust (Max Vitals) as an attribute, it can have the effect of "instantly recharging health or shields". I solved this on another unit that has a similar ability which grows stronger the more units are near it. This was easily solved by using caster history and placing an initial buff on the target which then applied a stack behavior to the caster and finally remove 1 stack on the initial behavior once it is removed, continually replying that initial behavior. This solution worked because the stack behavior does not have a duration so that it doesn't end up doing odd things with max vital.
I tried to do this in reverse on the targets but this does not work because even if you have seperate source behaviors for each unit type, once you have a single unit type activated, and you want more units to also apply their own stacks, units of the same type wont be able to apply their stacks because initial effect is only applied once from any buff type.
If you have 5 units of Type A, then each of those 5 units need to be applying the bonus aura to nearby structures that provides them with max vital of specific amount (X).
Still trying to think of another way to do this.
Any help is much appreciated.