I want to find a way to create an effect on a unit every time it comes within range of another unit, and that it doesn't apply it again until the other unit has left and returned within range. This is then supposed to apply for all units.
I thought of using a behavior, since it means less lag once the unit count goes up, but I don't know where to begin. D:
Does anyone have an idea or any suggestions? It would be very much appreciated!
I would go for a basic aura approach.
Use a Behavior on the other unit, which executes a Search effect at a short period (0.25 seconds is used by Blizzard). This search executes an Apply Behavior effect, which applies another behavior on the targets.
This 2nd behavior has a duration slightly longer than the period (0.5 seconds) and uses the effect you actually want to apply as its Effect - Initial.
This effect will only be executed, when the behavior is applied; not, when it is refreshed. So it will only be re-executed, if the target loses the behavior and gets it again (aka moves out of range and then back in).
Depending on your application, you can also use the aura on the main unit, apply the 2nd behavior on the other unit and execute the initial effect back on the first unit by setting its target location to Caster- or Origin Unit