Any ways to detect "Unit types within range of Unit Types"?
I want to be able to detect when multiple of a unit type are in close proximity of each other.
As everyone else said, this is a massive undertaking. I generally advice against it, as it's bound to have scaling issues if the system is 100% dynamic.
You may however run a pseudo-dynamic system to ease the load of this task considerably, if the way in which this is used happens to fit within a fairly limited amount of scenarios. You can also redesign your system around this limitation, for example, through the use of a "commander" type unit, which has the sole purpose of being the center of this effect, so that you're only really checking for the amount of units around this commander, rather than checking every single unit.
If the effect you're trying to accomplish is the sense of being "overrun" by a horde/swarm of some minor enemies, you may quite simply achieve the same effect by using the stacking damage debuff from the Firelord, which increases the damage of each attack against the target. This could quickly end up being OP in some scenarios, but for "event" type maps, this may create the desired effect rather easily.
Attach units to trees (similar to a wisp) & also enable basic attack at same time.
(any information is appreciated since google seems to have a tree tag fetish)
As far as I can reason, the best way to do this is through dummy units.
I've never heard of a system like this before, but I imagine it could be done with something like this:
You give the unit some sort of ability that finds a nearby tree, either targeting it directly or finding it with a trigger (Ancients and Mountain Giants have abilities that target trees) You then cancel whatever effect that ability would have, and summon a Wisp which you order to attach itself to the tree.
You then place a few restrictions on the unit casting the spell. There may be a nicer way to do this, but off the top of my head, what I would do, is order the unit to "hold position", and save its location in a hashtable. Then you run a periodic event to check if the unit has moved away from that location, and cancel the effect by removing the Wisp.. You'd also want a way to prevent the unit from attaching itself to multiple trees, such as using a group to track all units currently attached to trees.