The following is a fully complete library for a teleport system meant to replicate the original waygates from warcraft 3.
This library is very intuitive, extremely clean, and self contained that can entering into any map with minimal effort and work. Experienced mappers can easy modify and use the core calculations to their likings and even the newest mappers will have a breeze while never needing to modify it or understand the workings. The only process is to add the custom action “create passage between a pair of portal” in something like the map init trigger to add multiple “passages” if you will between sets of “gates”. Any unit can be used as a portal without having to enter it into any variable, trigger, or the library. It also detects and notifies you when you have accidentally assigned a portal to have more than one passage.
The system incorporates the portals into the unit A.I. pathing, ensuring units travel the shortest path including if that shortest path is by use by one or more portals (can be interrupted and redirected too). Also works with different and changing terrain heights as well as checks for pathing that can only be traveled to via portal like an island. Like the original system it only affects grounds units (modifiable) while air units are unaffected and free to fly their own course.