We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch
3-80 would each have their own preference ranking like KDEFHAJ up to perhaps 7 possible destinations for each origin location?
-Alan turret deaths checks whether the player isn't currently moving units to a different destination. It's reset in another trigger to let the player to move through a different location in the future.
-Bengalaas is the death counter tied to this origin location, the number being one of the destinations A-K.
-Switch12 is the switch for this origin location; each will have its own.
You're overthinking it a little, I think. But step by step.
You want each origin to have a handpicked order of destinations to check (randomness is not an option, right?) so you somehow have to define those. Thus there's no way around making 80 triggers (1 per origin). But then we can use some logic fu to save triggers and just using 1 variable (death counter) to store the order in. I'll call this rank. The locations with rank 1 gets checked first, rank 2 second, etc. To do this with just 1 variable you
correlate the destinations A-G to player numbers 1-7 (if you don't have more than 8 locations). So Benglaas count for P1 stores the rank of destination A, the count for P2 stores the rank of destination B and so forth. This is what it would look like in triggers:
Player Force(s)
Current Player brings "any unit" to location "Origin 1"
Set deaths for Benglaas for P1 to 1 A = rank 1
Set deaths for Benglaas for P2 to 2
Set deaths for Benglaas for P3 to 3
Set deaths for Benglaas for P4 to 4
Set deaths for Benglaas for P5 to 5
Set deaths for Benglaas for P6 to 6
Set deaths for Benglaas for P7 to 7
Move location "teleport origin" to "any unit" owned by Current Player at location "Origin 1"
Player Force(s)
Current Player brings "any unit" to location "Origin 2"
Set deaths for Benglaas for P1 to 7 A = rank 7
Set deaths for Benglaas for P2 to 6
Set deaths for Benglaas for P3 to 5
Set deaths for Benglaas for P4 to 4
Set deaths for Benglaas for P5 to 3
Set deaths for Benglaas for P6 to 2
Set deaths for Benglaas for P7 to 1
Move location "teleport origin" to "any unit" owned by Current Player at location "Origin 2"
Player Force(s)
Current Player brings "any unit" to location "Origin 3"
Set deaths for Benglaas for P1 to 4 A = rank 4
Set deaths for Benglaas for P2 to 2
Set deaths for Benglaas for P3 to 3
Set deaths for Benglaas for P4 to 7
Set deaths for Benglaas for P5 to 5
Set deaths for Benglaas for P6 to 6
Set deaths for Benglaas for P7 to 1
Move location "teleport origin" to "any unit" owned by Current Player at location "Origin 3"
... etc. for all origin locations you set the Benglaas deaths to signify rank of the associated destination
Okay, now we've defined all the teleport orders. Now on to the triggers that teleport based on the rank we set. The idea is that the viable destination has rank 1. If it's already blocked by foes units, you lower the rank of all destinations. Now another destination will be rank 1. The former rank 1 will now be 0 and thus ignored. It's important that all of this happens in 1 trigger loop or we run the risk that other players want to teleport at the same time and interfere with the logic. Correct trigger order is obviously vital. Thus we need a couple of copies of these 7+1 destination triggers.
Teleport if destination A is rank 1
Player Force(s)
P1 has suffered exactly 1 death of Benglaas
Foes brings at most 0 units to "destination A"
Move all "any unit" for Current Player at "teleport origin" to "destination A"
Set Benglaas for All Players to 0 [just to clear up ]
Teleport if destination B is rank 1
Player Force(s)
P2 has suffered exactly 1 death of Benglaas
Foes brings at most 0 units to "destination B"
Move all "any unit" for Current Player at "teleport origin" to "destination B"
Set Benglaas for All Players to 0 [just to clear up ]
... for all destinations
Now it's entirely possible none of these fired because the "desired" destination was occupied (2nd condition). Thus we decrease all the ranks to get another candidate to rank 1:
Decrease rank by 1 for all destinations
Player Force(s)
Current Player brings "any unit" to location "teleport origin"
Set Benglaas for All Players subtract 1
and now we have a different candidate, so we repeat the destination triggers:
Teleport if destination A is rank 1
Teleport if destination B is rank 1
Teleport if destination C is rank 1
Teleport if destination D is rank 1
Teleport if destination E is rank 1
Teleport if destination F is rank 1
Teleport if destination G is rank 1
and decrease the rank again
Decrease rank by 1 for all destinations
we need a total of 7 copies of these 7+1 destination triggers to give every destination the chance to fire.
Now I realize that logic may be a bit complicated on first glance, which is why I colored things to keep track of. If you still have questions feel free to ask!
Also disclaimer: I've not tested this at all, so there might be a bug in there or even a neat trick * to reduce the redundant triggers.
*) 1 variation I can think of right away:
You could let this run multiple trigger loops so every trigger loop 1 destination will be checked. It's only a slight delay as usually it will find a viable location to teleport to after 3 or 4 tries at most. If that sounds interesting you have to add a switch that gets turned on by the origin triggers and turned off by the teleport triggers that blocks any additional teleport attempts until the first one got resolved. Why a switch and not a death counter? This is more or less down to taste, but the reasoning is I use switches to affect triggers globally, death counters are convenient for "by player" triggers.