• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] How to teleport a unit if it enters to a different terrain.

Status
Not open for further replies.
Level 13
Joined
Sep 11, 2013
Messages
467
Hi there!
Is there an easy/smart way to make a trigger that teleport instantly a specific unit type back to center of the map(X) if that unit try to enter to a different terrain?
Capture1.JPG

The unit type must be free to walk only inside that red border. If that unit type try to escape outside the red border, that trigger must instantly teleport the unit back to (X) every single time.

Well I can make 12 regions, but I try to find a better way..

The help will be appreciated!
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,869
You basically have a circle there, so you could also do a Distance check if you don't mind some minor inaccuracy:
  • Events
    • Time - Every 0.10 seconds of game time
  • Conditions
  • Actions
    • Set Variable Point = (Position of YourUnit)
    • If all Conditions are true then do Actions
      • If - Conditions
        • (Distance between Point and CenterPoint) Greater than 1280.00
      • Then - Actions
        • Unit - Move YourUnit to CenterPoint
      • Else - Actions
    • Custom script: call RemoveLocation( udg_Point )
Adjust 1280.00 to be the max distance that you want to allow. I assumed each of those red blocks in your picture were 512.00 units in size.
  • Events
    • Time - Elapsed game time is 0.00 seconds
  • Conditions
  • Actions
    • Set Variable CenterPoint = (Center of YourRegion)
    • Set Variable YourUnit = The unit (set this whenever you can)
Don't forget to initialize the CenterPoint variable at the start of the game. Same goes for the YourUnit variable.

Rename these variables to something that makes sense for your map.
 
Last edited:
Status
Not open for further replies.
Top