• 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] Teleportation trigger

Status
Not open for further replies.
Level 3
Joined
Sep 28, 2018
Messages
38
[General] - Custom Ability to Teleport on a unit

@halleylight 's post linked above touches on an ability to teleport and ends with the OP stating they got it to work with a trigger. How to do this? Goal is to utilize a chat command to teleport a unit to either a players mouse position on the map or center of a players current camera bounds.

So instead of using an ability and selecting via ability use / mouse click, is it possible to do the same with a chat command?


Thanks!
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Should the teleport be instant or have some channeling time? Do you want the teleport to be interruptible?

There are problems trying to use either the player's mouse position or the center of camera bounds. There is a "Mouse Position for Triggered Mouse Event" object you can use, but that only returns a location when using it in conjunction with the <Player> Issues Mouse Move/Down/Up event, and you wouldn't be using that event in this case. Center of Camera Bounds only exists in JASS (GetCameraTargetPositionX/Y) and it cannot be used without synching the value between players because the function itself returns the local camera bounds center for each player. Not sure how you'd go about that specifically but there is [vJASS] - Sync (Game Cache)

I think your best option is actually to go for the mouse click event and a trigger that you turn on and off as necessary. Players type the chat command to teleport and then have N seconds to click wherever they want to teleport to.
  • Events
    • Player - Player 1 (Red) types a chat message containing TELEPORT_STRING as an exact match
    • Player - Player 2 (Blue) types a chat message containing TELEPORT_STRING as an exact match
    • Player - Player 3 (Teal) types a chat message containing TELEPORT_STRING as an exact match
    • -------- and so on for all players in your map --------
  • Conditions
    • ((Triggering Player) is in TELEPORT_GROUP) equal to false
  • Actions
    • Player Group - Add (Triggering Player) to TELEPORT_GROUP
    • If (All conditions are true) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of players in TELEPORT_GROUP) equal to 1
      • Then - Actions
        • Trigger - Turn on Teleport Click <gen>
      • Else - Actions
    • Time - Wait 5.00 seconds
    • Player Group - Remove (Triggering Player) from TELEPORT_GROUP
    • If (All conditions are true) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of players in TELEPORT_GROUP) equal to 0
      • Then - Actions
        • Trigger - Turn off Teleport Click <gen>
      • Else - Actions
  • Events
    • Player - Player 1 (Red) issues a Mouse Down event
    • Player - Player 2 (Blue) issues a Mouse Down event
    • Player - Player 3 (Teal) issues a Mouse Down event
    • -------- And so on --------
  • Conditions
    • ((Triggering Player) is in TELEPORT_GROUP) equal to true
  • Actions
    • Set TPLoc = (Mouse Position for Triggered Mouse Event)
    • Unit - Move SOME_UNIT_VARIABLE_I_PRESUME_YOU_HAVE[(Player number of (Triggering Player))] instantly to TPLoc
    • Custom script: call RemoveLocation(udg_TPLoc) //change this to match the name of your point variable, but keep the udg_ prefix
    • Player Group - Remove (Triggering Player) from TELEPORT_GROUP
    • If (All conditions are true) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of players in TELEPORT_GROUP) equal to 0
      • Then - Actions
        • Trigger - Turn off Teleport Click <gen>
      • Else - Actions
 
Level 3
Joined
Sep 28, 2018
Messages
38
@Pyrogasm Instant, uninterruptible. Personally was having difficulty finding out if it was possible to use camera bounds or mouse position. I think this looks great. Will get back when I have time to implement. Much thanks for the swift and thorough response
 
Status
Not open for further replies.
Top