I'll tell you another simpler method I use that applies in situations where you want to border off an edge of the map. The tutorials work fine, but they're just more complex, and if this applies I'd suggest using this.
If you don't want them to fly to the top 10 squares of the map, for example, make a 1x22 or 1x23 location and a location marking that someone is flying into the top 10 squares. If someone flies into the top 10 squares, center the 1x23 location on the unit, and order that unit to move to the location it was just centered. Because the location is so tall, its center is lower than 10 squares from the top of the map; instead, it's about 11.5 squares, if you used a height of 23. So it just moves straight back

.