TopHow To Post Your Triggers I've seen many and many members around the site who need help with their triggers but don't know how to post their triggers in a thread, especially the newcomers. Posting your triggers in a thread is a very important matter when you're asking for a help from other...
www.hiveworkshop.com
For a structured tutorial on the matter, read this. Hello guys! Credit to: Wolverabid, PurplePoot, Silvenon, Paskovich I want to make a list of things that leak and ways to fix them. Dynamic Unit Groups This trigger will instantly destroy dynamically generated unit groups. Trigger...
www.hiveworkshop.com
Do they all exist in the same general vicinity at map init such that you could place a region under them in the editor? If no: are all the heroes the same unit type? Are there other heroes on the map besides the ones that players should control? Are all these heroes already owned by the appropriate player? This is the easiest solution I can think of:
-
Events
-

Time - Elapsed game-time is 0.50 seconds //don't use the map init even if you can avoid it, better not to risk crashing the init thread with too much stuff running off it
-
Conditions
-
Actions
-

Custom script: set bj_wantDestroyGroup = true //'pre-emptively' cleans a unit group leak that's about to occur in the next line (see thread linked above if you don't understand)
-

Unit Group - Pick every unit in (Units in START_REGION <gen> matching (((Matching Unit) is a Hero) equal to True)) and do (Actions)
-


Loop - Actions
-



Camera - Lock camera target for (Owner of (Picked unit)) to (Picked unit), offset by (0.00, 0.00) using Default rotation
You could also use "Units of type Paladin" if a region won't work, or something like "Units in playable map area matching ((unit is a hero) and (owner of matching unit is an ally of Player 1)" if the region method isn't viable.
Things like "last X" are (internally) global variables that are set by the appropriate GUI functions when they're used. For example using "Unit - Create" sets Last Created Unit. "Last Dropped Item" only works when a unit is forced to drop an item with a trigger, not when it manually drops one on the ground.
Technically all the units on the map are created at map init in the init thread, but they are made directly with JASS function calls and therefore do not set "last created unit" properly.