"This spell requires a predetermined destination or else the caster will become lost in the cosmos forever, and unfortunately the only safe spot is a town under your control."Town Gate is a third-level order magic spell in Heroes of Might and Magic IV that costs five spell points and transports the caster and accompanying armies to the nearest town they control.
Moving with alacrity is the single most important strategic skill. Collecting Boots of Travel is considered a major benefit on the Adventure map, but this spell gives you the ability to move in a blink to the nearest town that you control, even to the far side of an extra-large map. It will also traverse the boundary between above and underground.
In addition to the advantages leaping about in seven league boots gives you over your slower opponents, Town Gate can help you move between multiple owned towns in practically half the normal time. Simply move slightly more than half the distance from your departure town to your destination town, and cast this spell from the adventure map. A slightly sneakier method of achieving this effect is to block the entrance to the nearer of the two towns with (say) 3 stacks of level one creatures. As the town gate takes you to the nearest accessible town, the town blocked off in this way will not be your destination.
If your town is threatened by an approaching enemy, Town Gate will snap you back there, ready to defend it in the bat of a sprite's wing.
Incredibly, it can also be cast during combat. The Order caster need never consider the cost of surrendering or fleeing a losing battle, nor fear the cold embrace of the Shackles of War.
In the Equilibris mod, Town Gate is a fourth-level spell, and cannot be cast in combat.