• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Town Portal like in Diablo

Status
Not open for further replies.
Level 9
Joined
Feb 20, 2014
Messages
409
Hi,I know that it is possible I saw it on a map.
Can someone make me a trigger please?
I want that when I use an item (Book of Town Portal) it creates a portal where my hero is and teleport me to the Town by creating a portal in town. And when I return in my portal in Town it brings me where I used my TP.
I really need help please.
 
Use a Point Variable (use an array if you want it to be MUI) and set that point to the position of the unit when the Hero Uses the book and then simply move the hero to his town. Then, When he uses the town's portal, move him to the Point you stored earlier and then destroy the point to avoid leaks.

You will also need to make sure if the point is already set, and you try using the book, to destroy it before creating a new point to avoid leaks.
 
If you want it to be on a single player map, then this will do.


  • Using the Books
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Potion of Greater Healing
      • (Town <gen> contains (Triggering unit)) Equal to False
    • Actions
      • Set tempLoc = ((Position of (Triggering unit)) offset by 200.00 towards (Facing of (Triggering unit)) degrees)
      • Set tempLoc2 = (Center of Town)
      • Unit - Create 1 Portal for (Triggering player) at tempLoc facing Default building facing degrees
      • Set Portal = (Last created unit)
      • Custom script: call RemoveLocation(udg_tempLoc)
      • Trigger - Add to Portal to TownPortal <gen> the event (Unit - A unit comes within 100.00 of Portal)
      • Unit - Create 1 Portal for (Triggering player) at tempLoc2 facing Default building facing degrees
      • Set TownPortal = (Last created unit)
      • Trigger - Add to TownPortal to Portal <gen> the event (Unit - A unit comes within 100.00 of TownPortal)
  • Portal to TownPortal
    • Events
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Your Hero
    • Actions
      • Set tempLoc = (Position of TownPortal)
      • Set tempLoc2 = (tempLoc offset by 200.00 towards (Facing of TownPortal) degrees)
      • Unit - Move (Triggering unit) instantly to tempLoc2
      • Custom script: call RemoveLocation(udg_tempLoc)
      • Custom script: call RemoveLocation(udg_tempLoc2)
  • TownPortal to Portal
    • Events
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Your Hero
    • Actions
      • Set tempLoc = (Position of Portal)
      • Set tempLoc2 = (tempLoc offset by 200.00 towards (Facing of Portal) degrees)
      • Unit - Move (Triggering unit) instantly to tempLoc2
      • Unit - Kill Portal
      • Unit - Kill TownPortal
      • Custom script: call RemoveLocation(udg_tempLoc)
      • Custom script: call RemoveLocation(udg_tempLoc2)
otherwise, it needs more heavy triggering.
 
I would imagine basing it on channel, then after 5 seconds of not being hit (damage detection system needed here?) you teleport the hero (move the unit) to town. You then create a dummy portal unit (can be targeted, invulnerable, looks like a portal) in town and store from where the player teleported. When the hero issues an order targeting their portal you then teleport him back to where he channelled it from.

Do note this is designed around the Diablo III town portal system. Coincidently this is exactly the same as the Hearthstone mechanic from Heroes of the Storm except with no return portal.
 
Did a bit of research of various ways to achieve a town portal system and I think I've found the best solution. I prefer my one because you need to actually right click the portal to enter, so you can walk through it without accidentally teleporting to Town (just like in Diablo 2), should work in multiplayer and it doesn't leak events.

Tiny downside, if your too far away you wont TP. Just right click the portal again when your close to overcome this. Not much of a problem really.

  • Town Portal
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Item Town Portal Summon
    • Actions
      • -------- ----------- --------
      • -------- Remove any old Portals --------
      • -------- ----------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Portal_Check_HasPortal[(Player number of (Owner of (Triggering unit)))] Equal to True
        • Then - Actions
          • Unit - Remove Portal_Unit_Outland[(Player number of (Owner of (Triggering unit)))] from the game
          • Unit - Remove Portal_Unit_Town[(Player number of (Owner of (Triggering unit)))] from the game
          • Set Portal_Count = (Portal_Count - 1)
        • Else - Actions
      • Set Portal_Count = (Portal_Count + 1)
      • Set Portal_Check_HasPortal[(Player number of (Owner of (Triggering unit)))] = True
      • -------- ----------- --------
      • -------- Create new Portals --------
      • -------- ----------- --------
      • Set TempPoint = (Position of (Triggering unit))
      • Set TempPoint2 = (TempPoint offset by 100.00 towards 115.00 degrees)
      • Unit - Create 1 Town Portal for (Owner of (Triggering unit)) at TempPoint2 facing 285.00 degrees
      • Set Portal_Unit_Outland[(Player number of (Owner of (Triggering unit)))] = (Last created unit)
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call RemoveLocation (udg_TempPoint2)
      • -------- ----------- --------
      • Set TempPoint = (Center of Town Portals <gen>)
      • Set TempPoint2 = (TempPoint offset by ((Real(Portal_Count)) x 15.00) towards 27.00 degrees)
      • Unit - Create 1 Town Portal for (Owner of (Triggering unit)) at TempPoint2 facing 285.00 degrees
      • Set Portal_Unit_Town[(Player number of (Owner of (Triggering unit)))] = (Last created unit)
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call RemoveLocation (udg_TempPoint2)
  • Move Unit
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Unit-type of (Target unit of issued order)) Equal to Town Portal
      • ((Triggering unit) belongs to an ally of (Owner of (Target unit of issued order))) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Target unit of issued order) Equal to Portal_Unit_Outland[(Player number of (Owner of (Target unit of issued order)))]
        • Then - Actions
          • Set TempPoint = (Position of (Triggering unit))
          • Set TempPoint2 = (Position of (Target unit of issued order))
          • Set TempPoint3 = (Position of Portal_Unit_Town[(Player number of (Owner of (Target unit of issued order)))])
          • Set TempPoint4 = (TempPoint3 offset by 100.00 towards 295.00 degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between TempPoint and TempPoint2) Less than or equal to 250.00
            • Then - Actions
              • Special Effect - Create a special effect at TempPoint using Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit - Move (Triggering unit) instantly to TempPoint3
              • Unit - Order (Triggering unit) to Move To TempPoint4
              • Special Effect - Create a special effect at TempPoint3 using Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Custom script: call RemoveLocation (udg_TempPoint2)
          • Custom script: call RemoveLocation (udg_TempPoint3)
          • Custom script: call RemoveLocation (udg_TempPoint4)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Target unit of issued order) Equal to Portal_Unit_Town[(Player number of (Owner of (Target unit of issued order)))]
            • Then - Actions
              • Set TempPoint = (Position of (Triggering unit))
              • Set TempPoint2 = (Position of (Target unit of issued order))
              • Set TempPoint3 = (Position of Portal_Unit_Outland[(Player number of (Owner of (Target unit of issued order)))])
              • Set TempPoint4 = (TempPoint3 offset by 100.00 towards 295.00 degrees)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between TempPoint and TempPoint2) Less than or equal to 250.00
                • Then - Actions
                  • Special Effect - Create a special effect at TempPoint using Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Move (Triggering unit) instantly to TempPoint3
                  • Unit - Order (Triggering unit) to Move To TempPoint4
                  • Special Effect - Create a special effect at TempPoint3 using Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • -------- ----------- --------
                  • -------- Removes Portals if Owner Return to Outland --------
                  • -------- ----------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Owner of (Triggering unit)) Equal to (Owner of (Target unit of issued order))
                    • Then - Actions
                      • Set Portal_Count = (Portal_Count - 1)
                      • Set Portal_Check_HasPortal[(Player number of (Owner of (Target unit of issued order)))] = False
                      • Unit - Remove Portal_Unit_Town[(Player number of (Owner of (Target unit of issued order)))] from the game
                      • Unit - Remove Portal_Unit_Outland[(Player number of (Owner of (Target unit of issued order)))] from the game
                    • Else - Actions
                • Else - Actions
              • Custom script: call RemoveLocation (udg_TempPoint)
              • Custom script: call RemoveLocation (udg_TempPoint2)
              • Custom script: call RemoveLocation (udg_TempPoint3)
              • Custom script: call RemoveLocation (udg_TempPoint4)
            • Else - Actions
I think its bug free. Here's a demo map:
 

Attachments

Last edited:
Status
Not open for further replies.
Back
Top