• 🏆 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!

[Trigger] How to make a Teleport Gate System?

Status
Not open for further replies.
Level 2
Joined
Nov 28, 2017
Messages
12
Hello, everyone
I am trying to make a teleport system, which can create an entrance and an exit, whenever a unit walk into the entrance, the unit will be teleport to the exit. Both the teleport gate will exist until a new gate has been created.

Therefore I created some ability and trigger to do the work:
Abilities:
1.Gate of Parallel Universe (Entrance): to create the entrance.
2.Gate of Parallel Universe (Exit): to create the exit.

Variables:
1.GPU_Enter_Point (variable type: point)
2.GPU_Exit_Point (variable type: point)
3.GPU_Boolean (variable type: boolean)

Triggers:
1.Gate of Parallel Universe Set Enter:
(1)When a unit casted the spell to create the entrance, set GPU_Enter_Point equal to the target point of ability being cast.
(2)If the ability has been cast more than once, remove the old entrance gate.
(3)Add to trigger(Gate of Parallel Universe Loop) the event(A unit enters GPU_Enter_Point).
upload_2019-1-2_3-46-26.png

2.Gate of Parallel Universe Set Exit:
When a unit casted the spell to create the exit, set GPU_Exit_Point equal to the target point of ability being cast. If the ability has been cast more than once, remove the old exit gate.
upload_2019-1-2_3-47-44.png

3.Gate of Parallel Universe Loop:
(1)Create special effects.
(2)Move the entering unit instantly to GPU_Exit_Point.
upload_2019-1-2_3-46-14.png


But now I have a problem, for exsample, I create an entrance at location A, and an exit at location B, then I create another entrance at location C, the first entrance will be removed since the new entrance are created, but when unit move pass the location A, it will still be teleported to location B.
I tried two ways to fix this problems, but both way dose not work:
1.Use a custom script to remove the GPU_Enter_Point everytime a unit casted the spell to create an entrance.
2.Use a custom script to destroy the Gate of Parallel Universe Loop, so after I create a new entrance, the old entance will stop teleporting units, but the new entrance dose not work too.

Please help me to finish this work, many thanks!
 

Attachments

  • upload_2019-1-2_3-45-9.png
    upload_2019-1-2_3-45-9.png
    43.1 KB · Views: 47
Last edited:
Level 11
Joined
Jul 4, 2016
Messages
627
This happens because the event occurring for that specific rect is still there and you can't remove these events, the only way to get rid of these events is to destroy the trigger and rebuild it, which is best done in JASS.

What you could do is turn these portals into units and utilize a unit in range event. Assuming these portals are not meant to be destroyed, you can then simply move these units when someone casts the spell, which hopefully won't be too much overheard. I will suggest using

custom script: call SetUnitX(unit, x) GetLocationX(yourpoint) for x
custom script: call SetUnitY(unit, y) GetLocationY(yourpoint) for y if you want to still use points

for better performance.

Additionally, you would only need to create the unit in range event once when the portal is first created.
 
Last edited:
Level 2
Joined
Nov 28, 2017
Messages
12
Thanks for response, I made some change of triggers, and it works perfectly now. Here is the new triggers:
upload_2019-1-3_9-51-57.png


upload_2019-1-3_9-51-19.png


upload_2019-1-3_9-51-4.png


 
Status
Not open for further replies.
Top