Falkoner's idea about having a squad leader is a good one.
As for detecting when units leave the location, there's a way to do it. It will take a fair amount of triggers, but operationwise, it's very efficient.
In addition to your location-centering triggers (whatever method you choose), have a brief detection period at the beginning of the player's movement phase where you count the number of units he has. You should have one of these triggers for every possible number of units he might have in his squad. For example, if the minimum number of units he might have in a squad is 4, and the maximum number is 12, then you'd want a trigger that detects that he has 4, a trigger that detects he has 5, and so on, all the way up to 12. Then, during the movement phase itself, if he's lacking one unit in the small location then you know it must have moved outside and you can then give control back to the AI.
This is of course based on the turn-based nature of the map, and it's assuming that none of your units can be attacked during the movement phase.
They can be killed off by triggers, though, that's fine -- if you use a trigger to kill off 1 unit, just make sure you subtract 1 from the death count that remembers the number of units. If you kill 2, subtract 2, etc.
Here's the detection method:
C:
It is the start of the turn phase.
It is detected that Current player's squad consists of X number of units.
A:
Modify Deaths for current player: Set to X for WHATEVER.
Preserve trigger.
C:
It is the movement phase.
Current player has suffered exactly X deaths of WHATEVER.
Current player brings at most X - 1 units to SMALL LOCATION.
Give control back to AI.
Preserve trigger.
As for the detection phase, you could use a death count or switch or whatever to indicate that the game is currently in detection mode.
And if units DO get killed, the method will still work. You can detect that, for example:
C:
Death count for WHATEVER is 12.
Current player brings exactly 11 units to SMALL LOCATION.
Current player brings exactly 11 units to LARGE LOCATION.
A:
Modify death count for WHATEVER: Subtract 1.
Preserve trigger.
Again, you'd have to do one of these triggers for every possible number of killed units, per every possible unit squad size, but you're just making lots of triggers, instead of using bulky burrowed zergling systems which can cause slowed, blocky movement and lag. And you're also using only 2 locations.
If you use SCMDraft2's Trigedit, you can use a text editor to duplicate triggers and edit them easily. That might be useful for something like this.
Post has been edited 4 time(s), last time on Feb 19 2008, 4:57 am by razorsnail.
None.