• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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.
 
Level 11
Joined
Jun 2, 2013
Messages
613
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.
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
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.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
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.
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
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

  • D2 Town Portals.w3x
    29.1 KB · Views: 66
Last edited:
Status
Not open for further replies.
Top