If your game has only one unit per player (hero), then your custom value approach will work and is very clever. Custom values are very fast (faster than buffs) and you should not get any lag problems.
As for finding the attack target:
Most of your questions really cant be answered, since those are design decisions that YOU have to make. You could add things like a line of sight check, a max distance and so on. I think in general the periodic check is the way to go. In fact, periodic triggers are not necessarily bad (especially because they cant stack up, such as events) and pretty much have a constant, low overhead.
You should try to find optimizations for your periodic check though. For example: Does it really need to pick ALL units, or can you maybe exclude certain units from the calculation (Distance from players, owner, ...)?
In general you should not worry about lag too much. As long as you dont notice any problems, there is no need to go crazy with optimization. Its wise to keep performance in mind when designing systems like this though.
@GlornII: Go
If your game has only one unit per player (hero), then your custom value approach will work and is very clever. Custom values are very fast (faster than buffs) and you should not get any lag problems.
As for finding the attack target:
Most of your questions really cant be answered, since those are design decisions that YOU have to make. You could add things like a line of sight check, a max distance and so on. I think in general the periodic check is the way to go. In fact, periodic triggers are not necessarily bad (especially because they cant stack up, such as events) and pretty much have a constant, low overhead.
You should try to find optimizations for your periodic check though. For example: Does it really need to pick ALL units, or can you maybe exclude certain units from the calculation (Distance from players, owner, ...)?
In general you should not worry about lag too much. As long as you dont notice any problems, there is no need to go crazy with optimization. Its wise to keep performance in mind when designing systems like this though.