Boots of Travel Dota 1

Level 13
Joined
Sep 11, 2013
Messages
467
Greetings!
How can I make an ability that can teleport me to another unit with a canneling delay (1.75s) like in normal teleport, but without stunning the other unit (friend or ally).
I saw that in dota 1 few years ago, so I think it is possible somehow.:peasant-thinking:

The help will be appreacited!
 
Level 24
Joined
Feb 27, 2019
Messages
831
First Id be interested in a video of Boots of Travel being used in Dota 1. It would make it easier to re-create. Best scenario would be a video with issuing a move order, queuing a teleport order and then queuing another order. The reason is to see if the order after the teleport is complete is interrupted or not.
Id also be interested to know if the Boots of Travel can fail to cast, like if one clicks far outside the map, not close to any unit, hero or building, does it still find a target or does it have a area of effect and if one clicks outside of that it gives an error.

I had a similar problem a while ago. Staff of Teleportation without interupting targets movement
I can supply step 1 in one way to do it which detects when the ability is just about to be cast and interrupts it. This doesnt affect the units queued orders and is because of using the event Begins channeling an ability.
  • Cast Staff of Teleportation
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Staff of Teleportation
    • Actions
      • Unit - For Unit (Triggering unit), start cooldown of ability Staff of Teleportation " over "0.01 seconds.
Step 2 could be something like issuing the unit to use another channeled ability on the target/if point order use trigger to detect nearest target and detecting the events of that ability.
 
Last edited:
Level 25
Joined
Mar 29, 2020
Messages
1,466
Id also be interested to know if the Boots of Travel can fail to cast, like if one clicks far outside the map, not close to any unit, hero or building, does it still find a target or does it have a area of effect and if one clicks outside of that it gives an error.

I think it finds the "legal" target closest to where you clicked, like the way a town portal scroll works (at least in dota...)
 
Level 13
Joined
Sep 11, 2013
Messages
467
First Id be interested in a video of Boots of Travel being used in Dota 1. It would make it easier to re-create. Best scenario would be a video with issuing a move order, queuing a teleport order and then queuing another order. The reason is to see if the order after the teleport is complete is interrupted or not.
Id also be interested to know if the Boots of Travel can fail to cast, like if one clicks far outside the map, not close to any unit, hero or building, does it still find a target or does it have a area of effect and if one clicks outside of that it gives an error.

I had a similar problem a while ago. Staff of Teleportation without interupting targets movement
I can supply step 1 in one way to do it which detects when the ability is just about to be cast and interrupts it. This doesnt affect the units queued orders and is because of using the event Begins channeling an ability.
  • Cast Staff of Teleportation
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Staff of Teleportation
    • Actions
      • Unit - For Unit (Triggering unit), start cooldown of ability Staff of Teleportation " over "0.01 seconds.
Step 2 could be something like issuing the unit to use another channeled ability on the target/if point order use trigger to detect nearest target and detecting the events of that ability.
Sorry, I had problems irl that's why my answer was delayed..
If a unit/building/hero die..while i use teleport on that unit/building/hero the teleport will stop.
If someone stun me, the teleport will stop
If i move, the teleport will stop
Step 2 could be something like issuing the unit to use another channeled ability on the target/if point order use trigger to detect nearest target and detecting the events of that ability.
I have no idea what that mean. I don't know how to translate this.

Back to your map.
I remade the map uncle posted a lil bit so it should fit what you need
Thank your for your help. I didn't imagine that the trigger is so hard/big.:peasant-shocked:
How can i put sound on the start of the teleport in a proper way and to the end of the teleport ?
I don't understand what is the purpose of this trigger?
  • Staff Setup
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- Add to this Unit Group the Units that can be Teleported to --------
      • Unit Group - Add Teleport To Me 0001 <gen> to TeleportGroup
      • Unit Group - Add Teleport To Me 0002 <gen> to TeleportGroup
      • Unit Group - Add Teleport To Me 0003 <gen> to TeleportGroup
      • Unit Group - Add Teleport To Me 0004 <gen> to TeleportGroup
I saw that i can teleport on any target, not just those 4.
Also, I saw that i can teleport on enemy and i don't like that to be possible (only on friend(hero/buildings/units) and ally(hero/buildings/units))

Anyway, the spell you remade seems to be very good.
I notice that the queued issued after teleport on your map will stop after teleporting and i don't like that..
If a unit die..while i use teleport on your map the teleport do nat stop..

I prefer the spell to be exactly like in dota 1 if is possible.
 
Level 24
Joined
Feb 27, 2019
Messages
831
I made a new version and made it work at least. Ill try to go through the triggers.

This trigger is step 1. It occurs when the unit has cast the ability and is awaiting the follow through time to expire.
  • Staff Cast Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Instant (Item Ability)
    • Actions
      • Game - Display to (All players) the text: Start effect
      • Set VariableSet Caster = (Triggering unit)
      • Unit Group - Add Caster to TeleportCasterGroup
      • Set VariableSet UDex = (Custom value of Caster)
      • Set VariableSet TempPoint[1] = (Target point of ability being cast)
      • -------- - --------
      • -------- This finds the closest eligible unit to the target point of ability being cast --------
      • Set VariableSet CurrentRange = 99999.00
      • Set VariableSet TeleportGroup = (Units in (Entire map))
      • Unit Group - Pick every unit in TeleportGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to False
              • ((Picked unit) belongs to an ally of (Owner of Caster).) Equal to True
            • Then - Actions
              • Set VariableSet TempPoint[2] = (Position of (Picked unit))
              • Set VariableSet Distance = (Distance between TempPoint[1] and TempPoint[2])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Distance Less than or equal to CurrentRange
                • Then - Actions
                  • Set VariableSet CurrentRange = Distance
                  • Set VariableSet ClosestUnit = (Picked unit)
                • Else - Actions
              • Custom script: call RemoveLocation (udg_TempPoint[2])
            • Else - Actions
      • Set VariableSet StaffTarget[UDex] = ClosestUnit
      • Unit Group - Add StaffTarget[UDex] to TeleportTargetGroup
      • -------- - --------
      • -------- Special effects --------
      • Set VariableSet TempPoint[2] = (Position of Caster)
      • Special Effect - Create a special effect at TempPoint[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of Caster using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet EffectCaster[UDex] = (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of StaffTarget[UDex] using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet EffectTarget[UDex] = (Last created special effect)
      • Ubersplat - Create ubersplat at TempPoint[2] of type Human Mass Teleport with color (100.00%, 100.00%, 100.00%) and 0.00% transparency (Disable paused state, Disable skipping birth time)
      • Set VariableSet Ubersplat[UDex] = (Last created ubersplat)
      • Ubersplat - Change Ubersplat[UDex]: Enable render always state
      • Ubersplat - Show Ubersplat[UDex]
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call DestroyGroup(udg_TeleportGroup)
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call RemoveLocation (udg_TempPoint[2])
This next trigger occurs either when the ability is interrupted or after finishes casting. It doesnt matter which because it contains stuff to end the spell such as destroying effects and removing units from groups. As mentioned the event occurs if the ability is interrupted or after it finishes casting.
  • Staff Stops Casting
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Instant (Item Ability)
    • Actions
      • Game - Display to (All players) the text: Stops casting
      • Set VariableSet Caster = (Triggering unit)
      • Set VariableSet UDex = (Custom value of Caster)
      • -------- - --------
      • Unit Group - Remove Caster from TeleportCasterGroup.
      • Unit Group - Remove StaffTarget[UDex] from TeleportTargetGroup.
      • -------- - --------
      • -------- Remove effects --------
      • Ubersplat - Destroy Ubersplat[UDex]
      • Special Effect - Destroy EffectCaster[UDex]
      • Special Effect - Destroy EffectTarget[UDex]
This third trigger occurs when the ability finishes casting, the spell is succesfully cast without any interruptions. Its the trigger that moves the teleporting unit to its new position.
  • Staff Finishes Casting
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Instant (Item Ability)
    • Actions
      • Game - Display to (All players) the text: Finishes casting
      • Set VariableSet Caster = (Triggering unit)
      • Set VariableSet UDex = (Custom value of Caster)
      • Set VariableSet TempPoint[1] = (Position of StaffTarget[UDex])
      • Set VariableSet TempPoint[2] = (Position of Caster)
      • -------- - --------
      • -------- Special effects --------
      • Special Effect - Create a special effect at TempPoint[1] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect at TempPoint[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- - --------
      • -------- Move caster --------
      • Custom script: call SetUnitX(udg_Caster, GetUnitX(udg_StaffTarget[udg_UDex]))
      • Custom script: call SetUnitY(udg_Caster, GetUnitY(udg_StaffTarget[udg_UDex]))
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call RemoveLocation (udg_TempPoint[2])
The fourth and final trigger is when the target dies. When a unit dies it detects if its in the teleport target group. The actions goes through every unit that is currently teleporting to detect if they are teleporting to the unit that died and if true it interrupts the caster, which in turn triggers the second trigger.
  • Staff Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in TeleportTargetGroup.) Equal to True
    • Actions
      • Unit Group - Pick every unit in TeleportCasterGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Caster = (Picked unit)
          • Set VariableSet UDex = (Custom value of Caster)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to StaffTarget[UDex]
            • Then - Actions
              • Custom script: call BlzPauseUnitEx(udg_Caster, true)
              • Custom script: call BlzPauseUnitEx(udg_Caster, false)
            • Else - Actions
 

Attachments

  • Staff not Instant v.1.1.w3x
    27.2 KB · Views: 6
Level 13
Joined
Sep 11, 2013
Messages
467
I made a new version and made it work at least. Ill try to go through the triggers.

This trigger is step 1. It occurs when the unit has cast the ability and is awaiting the follow through time to expire.
  • Staff Cast Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Instant (Item Ability)
    • Actions
      • Game - Display to (All players) the text: Start effect
      • Set VariableSet Caster = (Triggering unit)
      • Unit Group - Add Caster to TeleportCasterGroup
      • Set VariableSet UDex = (Custom value of Caster)
      • Set VariableSet TempPoint[1] = (Target point of ability being cast)
      • -------- - --------
      • -------- This finds the closest eligible unit to the target point of ability being cast --------
      • Set VariableSet CurrentRange = 99999.00
      • Set VariableSet TeleportGroup = (Units in (Entire map))
      • Unit Group - Pick every unit in TeleportGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to False
              • ((Picked unit) belongs to an ally of (Owner of Caster).) Equal to True
            • Then - Actions
              • Set VariableSet TempPoint[2] = (Position of (Picked unit))
              • Set VariableSet Distance = (Distance between TempPoint[1] and TempPoint[2])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Distance Less than or equal to CurrentRange
                • Then - Actions
                  • Set VariableSet CurrentRange = Distance
                  • Set VariableSet ClosestUnit = (Picked unit)
                • Else - Actions
              • Custom script: call RemoveLocation (udg_TempPoint[2])
            • Else - Actions
      • Set VariableSet StaffTarget[UDex] = ClosestUnit
      • Unit Group - Add StaffTarget[UDex] to TeleportTargetGroup
      • -------- - --------
      • -------- Special effects --------
      • Set VariableSet TempPoint[2] = (Position of Caster)
      • Special Effect - Create a special effect at TempPoint[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of Caster using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet EffectCaster[UDex] = (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of StaffTarget[UDex] using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet EffectTarget[UDex] = (Last created special effect)
      • Ubersplat - Create ubersplat at TempPoint[2] of type Human Mass Teleport with color (100.00%, 100.00%, 100.00%) and 0.00% transparency (Disable paused state, Disable skipping birth time)
      • Set VariableSet Ubersplat[UDex] = (Last created ubersplat)
      • Ubersplat - Change Ubersplat[UDex]: Enable render always state
      • Ubersplat - Show Ubersplat[UDex]
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call DestroyGroup(udg_TeleportGroup)
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call RemoveLocation (udg_TempPoint[2])
This next trigger occurs either when the ability is interrupted or after finishes casting. It doesnt matter which because it contains stuff to end the spell such as destroying effects and removing units from groups. As mentioned the event occurs if the ability is interrupted or after it finishes casting.
  • Staff Stops Casting
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Instant (Item Ability)
    • Actions
      • Game - Display to (All players) the text: Stops casting
      • Set VariableSet Caster = (Triggering unit)
      • Set VariableSet UDex = (Custom value of Caster)
      • -------- - --------
      • Unit Group - Remove Caster from TeleportCasterGroup.
      • Unit Group - Remove StaffTarget[UDex] from TeleportTargetGroup.
      • -------- - --------
      • -------- Remove effects --------
      • Ubersplat - Destroy Ubersplat[UDex]
      • Special Effect - Destroy EffectCaster[UDex]
      • Special Effect - Destroy EffectTarget[UDex]
This third trigger occurs when the ability finishes casting, the spell is succesfully cast without any interruptions. Its the trigger that moves the teleporting unit to its new position.
  • Staff Finishes Casting
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Instant (Item Ability)
    • Actions
      • Game - Display to (All players) the text: Finishes casting
      • Set VariableSet Caster = (Triggering unit)
      • Set VariableSet UDex = (Custom value of Caster)
      • Set VariableSet TempPoint[1] = (Position of StaffTarget[UDex])
      • Set VariableSet TempPoint[2] = (Position of Caster)
      • -------- - --------
      • -------- Special effects --------
      • Special Effect - Create a special effect at TempPoint[1] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect at TempPoint[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- - --------
      • -------- Move caster --------
      • Custom script: call SetUnitX(udg_Caster, GetUnitX(udg_StaffTarget[udg_UDex]))
      • Custom script: call SetUnitY(udg_Caster, GetUnitY(udg_StaffTarget[udg_UDex]))
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call RemoveLocation (udg_TempPoint[2])
The fourth and final trigger is when the target dies. When a unit dies it detects if its in the teleport target group. The actions goes through every unit that is currently teleporting to detect if they are teleporting to the unit that died and if true it interrupts the caster, which in turn triggers the second trigger.
  • Staff Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in TeleportTargetGroup.) Equal to True
    • Actions
      • Unit Group - Pick every unit in TeleportCasterGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Caster = (Picked unit)
          • Set VariableSet UDex = (Custom value of Caster)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to StaffTarget[UDex]
            • Then - Actions
              • Custom script: call BlzPauseUnitEx(udg_Caster, true)
              • Custom script: call BlzPauseUnitEx(udg_Caster, false)
            • Else - Actions
This is great work! Thank you very much!
I notice a few small problems and i don't know how to fix them..
If the closest target is the caster itself, the spell will teleport me on myself.
I think i need to do something like that, but there is no such option..
  • ((Picked unit) is triggering unit) Equal to False
If there is 0 targets to teleport, i think the spell must give an error.
Also, in dota 1 the hero teleport near tower/units, not in the middle of the building/unit
The hero can stuck there and i don't know how to fix this either.
In the end, beyond all that, your work is awesome!:peasant-thumbs-up-cheers:
Idk if that helps but i found that in dota 1, when you try to teleport outside the playable map (in black trees) a message will show with yellow (unable to target there) and the spell will not start as you can see in my video at 0:20seconds. (that don't bother me)
 
Level 24
Joined
Feb 27, 2019
Messages
831
This is great work! Thank you very much!
I notice a few small problems and i don't know how to fix them..
If the closest target is the caster itself, the spell will teleport me on myself.
I think i need to do something like that, but there is no such option..
  • ((Picked unit) is triggering unit) Equal to False
If there is 0 targets to teleport, i think the spell must give an error.
Also, in dota 1 the hero teleport near tower/units, not in the middle of the building/unit
The hero can stuck there and i don't know how to fix this either.
In the end, beyond all that, your work is awesome!:peasant-thumbs-up-cheers:
Idk if that helps but i found that in dota 1, when you try to teleport outside the playable map (in black trees) a message will show with yellow (unable to target there) and the spell will not start as you can see in my video at 0:20seconds. (that don't bother me)
ya, was gonna mention the teleport inside stuff part but forgot about it. Instead of move unit I used SetUnit... which puts the unit at the position no matter whats in the way but doesnt interrupt orders. So thats a problem to be solved for sure.

The 0 targets to teleport I am not so sure about though, I dont think there is a scenario in dota 1 in which the unit can try to teleport anywhere if there is 0 targets. There is at least the main building and if it dies the game ends. So unless you show thats not the case inside dota 1 you cant for sure say that part isnt the same as dota 1. Is that a problem in your game?

Could you give me a video of two heroes teleporting to the same building without moving any of the heroes after teleporting in dota 1? If possible 7 or 8 heroes.
 
Last edited:
Level 13
Joined
Sep 11, 2013
Messages
467
The 0 targets to teleport I am not so sure about though, I dont think there is a scenario in dota 1 in which the unit can try to teleport anywhere if there is 0 targets. There is at least the main building and if it dies the game ends. So unless you show thats not the case inside dota 1 you cant for sure say that part isnt the same as dota 1. Is that a problem in your game?
You're right, in dota 1 there is not possible to be 0 targets, but in my game can remain only the hero(actually is a unit with teleport spell). Well is a little weird to teleport from myself on myself if i am the only target or if i am the clossest target, but i can live with that:)

Could you give me a video of two heroes teleporting to the same building without moving any of the heroes after teleporting in dota 1? If possible 7 or 8 heroes.
This will be impossible right now. Maybe tomorrow if someone will help me with that video. Why you need 7 heroes or 8?
Now I am wonder what happen.

Edit:Nevermind I'll send the video in 5 minutes
 
Last edited:
Level 13
Joined
Sep 11, 2013
Messages
467
ya, was gonna mention the teleport inside stuff part but forgot about it. Instead of move unit I used SetUnit... which puts the unit at the position no matter whats in the way but doesnt interrupt orders. So thats a problem to be solved for sure.

The 0 targets to teleport I am not so sure about though, I dont think there is a scenario in dota 1 in which the unit can try to teleport anywhere if there is 0 targets. There is at least the main building and if it dies the game ends. So unless you show thats not the case inside dota 1 you cant for sure say that part isnt the same as dota 1. Is that a problem in your game?

Could you give me a video of two heroes teleporting to the same building without moving any of the heroes after teleporting in dota 1? If possible 7 or 8 heroes.
I noticed something weird at sec 0:10 in this video
Even if the closest target was a creep, the teleport has teleported me to the tower.:peasant-shocked:
 
Last edited:
Level 24
Joined
Feb 27, 2019
Messages
831
Nice. Though I am not aware how they made that to work as of now be frank. A secondary option is to ignore the need of queued orders to be retained and use move unit to point instead of setunitx and y. I feel that I reached the end of my line, it may take a while for me to figure out anything more if ever. They may have used a totally different technique than what I suggested.

It probably prefers buildings over units according to some parameters.
 
Level 13
Joined
Sep 11, 2013
Messages
467
Nice. Though I am not aware how they made that to work as of now be frank. A secondary option is to ignore the need of queued orders to be retained and use move unit to point instead of setunitx and y. I feel that I reached the end of my line, it may take a while for me to figure out anything more if ever. They may have used a totally different technique than what I suggested.
The queue after teleport is very important and have to work.:peasant-sad:You did very well brother, no need to worry! Yeah, I think is a different technique, but your technique is very close to be perfect.

It probably prefers buildings over units according to some parameters.
For sure, but i don't need that option:thumbs_up:
 
Level 13
Joined
Sep 11, 2013
Messages
467
Can you send that dota map youre testing to me?
Sure
You opened it in the editor and added the units and stuff right?
It is impossible to find a dota map that is open source.
I used mods in dota. When i start the map, I use -wtf -test -ap -noherolimit -lvlup 25 -gold xxx or greedisgood
 

Attachments

  • DotA v6.83dAI PMV 1.42 EN.w3x
    7.9 MB · Views: 4

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,860
To solve the SetUnitX/Y issue you could:

Unhide a "dummy" unit (one with standard ground collision), move it to the destination point, hide it, and move the caster to this new point using SetUnitX/Y.
  • Events
    • Time - Elapsed game time is 0.01 seconds
  • Conditions
  • Actions
    • Unit - Create 1 PathingTester (Dummy) at (Center of (playable map area))
    • Set VariableSet Teleport_Pathing_Dummy = (Last created unit)
    • Unit - Make Teleport_Pathing_Dummy Invulnerable
    • Unit - Hide Teleport_Pathing_Dummy
  • Staff Finishes Casting
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Instant (Item Ability)
    • Actions
      • Game - Display to (All players) the text: Finishes casting
      • Set VariableSet Caster = (Triggering unit)
      • Set VariableSet UDex = (Custom value of Caster)
      • Set VariableSet TempPoint[1] = (Position of StaffTarget[UDex])
      • Set VariableSet TempPoint[2] = (Position of Caster)
      • -------- - --------
      • -------- Special effects --------
      • Special Effect - Create a special effect at TempPoint[1] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect at TempPoint[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- - --------
      • -------- Move caster --------
      • Unit - Unhide Teleport_Pathing_Dummy
      • Unit - Move Teleport_Pathing_Dummy to TempPoint[1]
      • Unit - Hide Teleport_Pathing_Dummy
      • Custom script: call SetUnitX(udg_Caster, GetUnitX(Teleport_Pathing_Dummy)
      • Custom script: call SetUnitY(udg_Caster, GetUnitY(Teleport_Pathing_Dummy)
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call RemoveLocation (udg_TempPoint[2])

Preventing the caster from targeting itself should be pretty easy. Also, you can account for what happens if you fail to find a target:
  • Staff Cast Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Instant (Item Ability)
    • Actions
      • Game - Display to (All players) the text: Start effect
      • Set VariableSet Caster = (Triggering unit)
      • Unit Group - Add Caster to TeleportCasterGroup
      • Set VariableSet UDex = (Custom value of Caster)
      • Set VariableSet TempPoint[1] = (Target point of ability being cast)
      • -------- - --------
      • -------- This finds the closest eligible unit to the target point of ability being cast --------
      • Set VariableSet CurrentRange = 99999.00
      • Set VariableSet TeleportGroup = (Units in (Entire map))
      • Set VariableSet ClosestUnit = No unit
      • Unit Group - Remove Caster from TeleportGroup
      • -------- - --------
      • Unit Group - Pick every unit in TeleportGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to False
              • ((Picked unit) is Hidden) Equal to False
              • ((Picked unit) belongs to an ally of (Owner of Caster).) Equal to True
            • Then - Actions
              • Set VariableSet TempPoint[2] = (Position of (Picked unit))
              • Set VariableSet Distance = (Distance between TempPoint[1] and TempPoint[2])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Distance Less than or equal to CurrentRange
                • Then - Actions
                  • Set VariableSet CurrentRange = Distance
                  • Set VariableSet ClosestUnit = (Picked unit)
                • Else - Actions
              • Custom script: call RemoveLocation (udg_TempPoint[2])
            • Else - Actions
      • -------- - --------
      • -------- Exit if no valid target was found --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ClosestUnit Equal to No unit
        • Then - Actions
          • Unit - Order Caster to Stop
          • Skip remaining actions
        • Else - Actions
      • -------- - --------
      • Set VariableSet StaffTarget[UDex] = ClosestUnit
      • Unit Group - Add StaffTarget[UDex] to TeleportTargetGroup
      • -------- - --------
      • -------- Special effects --------
      • Set VariableSet TempPoint[2] = (Position of Caster)
      • Special Effect - Create a special effect at TempPoint[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of Caster using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet EffectCaster[UDex] = (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of StaffTarget[UDex] using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet EffectTarget[UDex] = (Last created special effect)
      • Ubersplat - Create ubersplat at TempPoint[2] of type Human Mass Teleport with color (100.00%, 100.00%, 100.00%) and 0.00% transparency (Disable paused state, Disable skipping birth time)
      • Set VariableSet Ubersplat[UDex] = (Last created ubersplat)
      • Ubersplat - Change Ubersplat[UDex]: Enable render always state
      • Ubersplat - Show Ubersplat[UDex]
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call DestroyGroup(udg_TeleportGroup)
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call RemoveLocation (udg_TempPoint[2])
To make buildings have priority you could copy the ClosestUnit variable and create a ClosestBuilding version of it:
  • Staff Cast Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Instant (Item Ability)
    • Actions
      • Game - Display to (All players) the text: Start effect
      • Set VariableSet Caster = (Triggering unit)
      • Unit Group - Add Caster to TeleportCasterGroup
      • Set VariableSet UDex = (Custom value of Caster)
      • Set VariableSet TempPoint[1] = (Target point of ability being cast)
      • -------- - --------
      • -------- This finds the closest eligible unit to the target point of ability being cast --------
      • Set VariableSet CurrentRange = 99999.00
      • Set VariableSet TeleportGroup = (Units in (Entire map))
      • Set VariableSet ClosestUnit = No unit
      • Set VariableSet ClosestBuilding = No unit
      • Unit Group - Remove Caster from TeleportGroup
      • -------- - --------
      • Unit Group - Pick every unit in TeleportGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to False
              • ((Picked unit) is Hidden) Equal to False
              • ((Picked unit) belongs to an ally of (Owner of Caster).) Equal to True
            • Then - Actions
              • Set VariableSet TempPoint[2] = (Position of (Picked unit))
              • Set VariableSet Distance = (Distance between TempPoint[1] and TempPoint[2])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Distance Less than or equal to CurrentRange
                • Then - Actions
                  • Set VariableSet CurrentRange = Distance
                  • Set VariableSet ClosestUnit = (Picked unit)
                  • If (ClosestUnit is a building) Equal to True then Set VariableSet ClosestBuilding = ClosestUnit Else do nothing
                • Else - Actions
              • Custom script: call RemoveLocation (udg_TempPoint[2])
            • Else - Actions
      • -------- - --------
      • -------- If we found a building then use that instead --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ClosestBuilding Not equal to No unit
        • Then - Actions
          • Set VariableSet ClosestUnit = ClosestBuilding
        • Else - Actions
          • -------- Exit if no valid target was found --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ClosestUnit Equal to No unit
            • Then - Actions
              • Unit - Order Caster to Stop
              • Skip remaining actions
            • Else - Actions
      • -------- - --------
      • Set VariableSet StaffTarget[UDex] = ClosestUnit
      • Unit Group - Add StaffTarget[UDex] to TeleportTargetGroup
      • -------- - --------
      • -------- Special effects --------
      • Set VariableSet TempPoint[2] = (Position of Caster)
      • Special Effect - Create a special effect at TempPoint[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of Caster using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet EffectCaster[UDex] = (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of StaffTarget[UDex] using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet EffectTarget[UDex] = (Last created special effect)
      • Ubersplat - Create ubersplat at TempPoint[2] of type Human Mass Teleport with color (100.00%, 100.00%, 100.00%) and 0.00% transparency (Disable paused state, Disable skipping birth time)
      • Set VariableSet Ubersplat[UDex] = (Last created ubersplat)
      • Ubersplat - Change Ubersplat[UDex]: Enable render always state
      • Ubersplat - Show Ubersplat[UDex]
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call DestroyGroup(udg_TeleportGroup)
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call RemoveLocation (udg_TempPoint[2])
However, I imagine you would want to check how close the buildings are before marking them as a "ClosestBuilding". The end result should be that players can effectively choose what to teleport to by aiming far enough away from a building on the minimap. Let's say that any building "within 800 distance" of the target point will have priority. Otherwise, creeps should be prioritized.

To implement this you could make it so that ClosestBuilding is only set to ClosestUnit IF it's Distance is Less than or equal to 800.00. That way as long as you click more than 800 range away from the building it will be ignored. Of course you can play around with the number to get it just right.
 
Last edited:
Level 13
Joined
Sep 11, 2013
Messages
467
To solve the SetUnitX/Y issue you could:

Unhide a "dummy" unit (one with standard ground collision), move it to the destination point, hide it, and move the caster to this new point using SetUnitX/Y.
  • Events
    • Time - Elapsed game time is 0.01 seconds
  • Conditions
  • Actions
    • Unit - Create 1 PathingTester (Dummy) at (Center of (playable map area))
    • Set VariableSet Teleport_Pathing_Dummy = (Last created unit)
    • Unit - Make Teleport_Pathing_Dummy Invulnerable
    • Unit - Hide Teleport_Pathing_Dummy
  • Staff Finishes Casting
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Instant (Item Ability)
    • Actions
      • Game - Display to (All players) the text: Finishes casting
      • Set VariableSet Caster = (Triggering unit)
      • Set VariableSet UDex = (Custom value of Caster)
      • Set VariableSet TempPoint[1] = (Position of StaffTarget[UDex])
      • Set VariableSet TempPoint[2] = (Position of Caster)
      • -------- - --------
      • -------- Special effects --------
      • Special Effect - Create a special effect at TempPoint[1] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect at TempPoint[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- - --------
      • -------- Move caster --------
      • Unit - Unhide Teleport_Pathing_Dummy
      • Unit - Move Teleport_Pathing_Dummy to TempPoint[1]
      • Unit - Hide Teleport_Pathing_Dummy
      • Custom script: call SetUnitX(udg_Caster, GetUnitX(Teleport_Pathing_Dummy)
      • Custom script: call SetUnitY(udg_Caster, GetUnitY(Teleport_Pathing_Dummy)
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call RemoveLocation (udg_TempPoint[2])

Preventing the caster from targeting itself should be pretty easy. Also, you can account for what happens if you fail to find a target:
  • Staff Cast Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Instant (Item Ability)
    • Actions
      • Game - Display to (All players) the text: Start effect
      • Set VariableSet Caster = (Triggering unit)
      • Unit Group - Add Caster to TeleportCasterGroup
      • Set VariableSet UDex = (Custom value of Caster)
      • Set VariableSet TempPoint[1] = (Target point of ability being cast)
      • -------- - --------
      • -------- This finds the closest eligible unit to the target point of ability being cast --------
      • Set VariableSet CurrentRange = 99999.00
      • Set VariableSet TeleportGroup = (Units in (Entire map))
      • Set VariableSet ClosestUnit = No unit
      • Unit Group - Remove Caster from TeleportGroup
      • -------- - --------
      • Unit Group - Pick every unit in TeleportGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to False
              • ((Picked unit) is Hidden) Equal to False
              • ((Picked unit) belongs to an ally of (Owner of Caster).) Equal to True
            • Then - Actions
              • Set VariableSet TempPoint[2] = (Position of (Picked unit))
              • Set VariableSet Distance = (Distance between TempPoint[1] and TempPoint[2])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Distance Less than or equal to CurrentRange
                • Then - Actions
                  • Set VariableSet CurrentRange = Distance
                  • Set VariableSet ClosestUnit = (Picked unit)
                • Else - Actions
              • Custom script: call RemoveLocation (udg_TempPoint[2])
            • Else - Actions
      • -------- - --------
      • -------- Exit if no valid target was found --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ClosestUnit Equal to No unit
        • Then - Actions
          • Unit - Order Caster to Stop
          • Skip remaining actions
        • Else - Actions
      • -------- - --------
      • Set VariableSet StaffTarget[UDex] = ClosestUnit
      • Unit Group - Add StaffTarget[UDex] to TeleportTargetGroup
      • -------- - --------
      • -------- Special effects --------
      • Set VariableSet TempPoint[2] = (Position of Caster)
      • Special Effect - Create a special effect at TempPoint[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of Caster using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet EffectCaster[UDex] = (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of StaffTarget[UDex] using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet EffectTarget[UDex] = (Last created special effect)
      • Ubersplat - Create ubersplat at TempPoint[2] of type Human Mass Teleport with color (100.00%, 100.00%, 100.00%) and 0.00% transparency (Disable paused state, Disable skipping birth time)
      • Set VariableSet Ubersplat[UDex] = (Last created ubersplat)
      • Ubersplat - Change Ubersplat[UDex]: Enable render always state
      • Ubersplat - Show Ubersplat[UDex]
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call DestroyGroup(udg_TeleportGroup)
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call RemoveLocation (udg_TempPoint[2])
To make buildings have priority you could copy the ClosestUnit variable and create a ClosestBuilding version of it:
  • Staff Cast Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Instant (Item Ability)
    • Actions
      • Game - Display to (All players) the text: Start effect
      • Set VariableSet Caster = (Triggering unit)
      • Unit Group - Add Caster to TeleportCasterGroup
      • Set VariableSet UDex = (Custom value of Caster)
      • Set VariableSet TempPoint[1] = (Target point of ability being cast)
      • -------- - --------
      • -------- This finds the closest eligible unit to the target point of ability being cast --------
      • Set VariableSet CurrentRange = 99999.00
      • Set VariableSet TeleportGroup = (Units in (Entire map))
      • Set VariableSet ClosestUnit = No unit
      • Set VariableSet ClosestBuilding = No unit
      • Unit Group - Remove Caster from TeleportGroup
      • -------- - --------
      • Unit Group - Pick every unit in TeleportGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to False
              • ((Picked unit) is Hidden) Equal to False
              • ((Picked unit) belongs to an ally of (Owner of Caster).) Equal to True
            • Then - Actions
              • Set VariableSet TempPoint[2] = (Position of (Picked unit))
              • Set VariableSet Distance = (Distance between TempPoint[1] and TempPoint[2])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Distance Less than or equal to CurrentRange
                • Then - Actions
                  • Set VariableSet CurrentRange = Distance
                  • Set VariableSet ClosestUnit = (Picked unit)
                  • If (ClosestUnit is a building) Equal to True then Set VariableSet ClosestBuilding = ClosestUnit Else do nothing
                • Else - Actions
              • Custom script: call RemoveLocation (udg_TempPoint[2])
            • Else - Actions
      • -------- - --------
      • -------- If we found a building then use that instead --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ClosestBuilding Not equal to No unit
        • Then - Actions
          • Set VariableSet ClosestUnit = ClosestBuilding
        • Else - Actions
          • -------- Exit if no valid target was found --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ClosestUnit Equal to No unit
            • Then - Actions
              • Unit - Order Caster to Stop
              • Skip remaining actions
            • Else - Actions
      • -------- - --------
      • Set VariableSet StaffTarget[UDex] = ClosestUnit
      • Unit Group - Add StaffTarget[UDex] to TeleportTargetGroup
      • -------- - --------
      • -------- Special effects --------
      • Set VariableSet TempPoint[2] = (Position of Caster)
      • Special Effect - Create a special effect at TempPoint[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of Caster using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet EffectCaster[UDex] = (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of StaffTarget[UDex] using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet EffectTarget[UDex] = (Last created special effect)
      • Ubersplat - Create ubersplat at TempPoint[2] of type Human Mass Teleport with color (100.00%, 100.00%, 100.00%) and 0.00% transparency (Disable paused state, Disable skipping birth time)
      • Set VariableSet Ubersplat[UDex] = (Last created ubersplat)
      • Ubersplat - Change Ubersplat[UDex]: Enable render always state
      • Ubersplat - Show Ubersplat[UDex]
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call DestroyGroup(udg_TeleportGroup)
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call RemoveLocation (udg_TempPoint[2])
However, I imagine you would want to check how close the buildings are before marking them as a "ClosestBuilding". The end result should be that players can effectively choose what to teleport to by aiming far enough away from a building on the minimap. Let's say that any building "within 800 distance" of the target point will have priority. Otherwise, creeps should be prioritized.

To implement this you could make it so that ClosestBuilding is only set to ClosestUnit IF it's Distance is Less than or equal to 800.00. That way as long as you click more than 800 range away from the building it will be ignored. Of course you can play around with the number to get it just right.
I tried what you said, but did not work and i don't know why.. here is what i did..

Edit: I uploaded the latest update of the map
 

Attachments

  • Staff not Instant v.1.5.w3x
    28.5 KB · Views: 2
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,860
This particular Dummy unit is used to calculate pathing but you gave it Flying movement. In other words, it literally has no collision with other units.
Unhide a "dummy" unit (one with standard ground collision)
1723421476626.png

Think about the logic here, we move the Dummy to the position of the teleport target so that we can get it's "closest pathable point". It's like a collision test. Then we use SetUnitX/Y (which doesn't interrupt orders) to move our caster to the position of the Dummy which will be at this "closest pathable point".

For "spell casting" Dummy units you would want the Movement Type to be None and Speed Base = 0 since they are meant to cast spells "instantly" and from anywhere.
 
Last edited:
Level 13
Joined
Sep 11, 2013
Messages
467
This particular Dummy unit is used to calculate pathing but you gave it Flying movement. In other words, it literally has no collision with other units.

View attachment 482708
Think about the logic here, we move the Dummy to the position of the teleport target so that we can get it's "closest pathable point". It's like a collision test. Then we use SetUnitX/Y (which doesn't interrupt orders) to move our caster to the position of the Dummy which will be at this "closest pathable point".

For "spell casting" Dummy units you would want the Movement Type to be None and Speed Base = 0 since they are meant to cast spells "instantly" and from anywhere.
Right, That's make sense now!
Still there is a problem with self teleport
Preventing the caster from targeting itself should be pretty easy. Also, you can account for what happens if you fail to find a target:
I can still target myself..
1.if i am the closest target
2.even if i am the last one alive
  • events.gif
    Events
    • joinbottom.gif
      timer.gif
      Time - Elapsed game time is 0.01 seconds
  • cond.gif
    Conditions
  • actions.gif
    Actions
    • join.gif
      unit.gif
      Unit - Create 1 PathingTester (Dummy) at (Center of (playable map area))
Also, This Action is this?
  • Unit - Create 1 Teleport Dummy Wisp for Neutral Passive at (Center of (Playable map area)) facing Default building facing degrees
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,860
Look at the Staff Cast Ability trigger, it tries to find the closest unit and when it does it stores them in a variable called ClosestUnit. It then orders the Caster to "Stop" and skips the rest of the trigger if ClosestUnit isn't set to anything.

Try to think of a Condition (or Conditions) that you can use here to prevent the Caster from being targeted.

And yes, that's the same action.
 
Level 13
Joined
Sep 11, 2013
Messages
467
Look at the Staff Cast Ability trigger, it tries to find the closest unit and when it does it stores them in a variable called ClosestUnit. It then orders the Caster to "Stop" and skips the rest of the trigger if ClosestUnit isn't set to anything.

Try to think of a Condition (or Conditions) that you can use here to prevent the Caster from being targeted.

And yes, that's the same action.
I have no idea.. It must be something simple like
  • ((Picked unit) is casting unit Equal to False
But there is not such a trigger there.. :peasant-confused:
Maybe i should give a buff to caster with another dummy during teleport and then i can use that buff as an exception? Edit: (No.. that's make no sense):)
Edit2.
  • ((Picked unit) is A Hero) Equal to False
I think this one is good, but will not let me to target allied heroes anymore :peasant-sad:
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,860
Those are Conditions not Triggers. The Trigger is what contains the Events/Conditions/Actions.

It's a Unit Comparison to compare two Units -> Caster and ClosestUnit.

  • -------- Exit if no valid target was found --------
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • ClosestUnit Equal to Caster
          • ClosestUnit Equal to No unit
    • Then - Actions
      • Unit - Order Caster to Stop
      • Skip remaining actions
So now the Caster will "Stop" if they are the ClosestUnit.
 
Level 13
Joined
Sep 11, 2013
Messages
467
Those are Conditions not Triggers. The Trigger is what contains the Events/Conditions/Actions.
I know that, is just a bad hobbit to say triggers.:peasant-blushing:
So now the Caster will "Stop" if they are the ClosestUnit.
That makes a lot of sense. Thank you!:peasant-thumbs-up-cheers:
Work exactly as you said, but there is another small problem with this condition..
Because sometime ClosestUnit is the caster, the entire spell will stop even if the next closest unit exist and is not the caster.
I have no idea if that can have an easy fix, but it is good anyway.:peasant-grin:
I think i have brainrot when it comes with triggers, but I want to make a new map anyway.
For me and for this awesome community.
 
Level 24
Joined
Feb 27, 2019
Messages
831
  • Unit Group - Pick every unit in TeleportGroup and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) not Equal to (Caster) <---
          • ((Picked unit) is dead) Equal to False
          • ((Picked unit) is Hidden) Equal to False
          • ((Picked unit) belongs to an ally of (Owner of Caster).) Equal to True
        • Then - Actions
          • Set VariableSet TempPoint[2] = (Position of (Picked unit))
          • Set VariableSet Distance = (Distance between TempPoint[1] and TempPoint[2])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Distance Less than or equal to CurrentRange
            • Then - Actions
              • Set VariableSet CurrentRange = Distance
              • Set VariableSet ClosestUnit = (Picked unit)
              • If (ClosestUnit is a building) Equal to True then Set VariableSet ClosestBuilding = ClosestUnit Else do nothing
            • Else - Actions
          • Custom script: call RemoveLocation (udg_TempPoint[2])
        • Else - Actions
Makes more sense to add the condition here because then the Caster will be filtered from the search for ClosestUnit.
 
Level 13
Joined
Sep 11, 2013
Messages
467
  • Unit Group - Pick every unit in TeleportGroup and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) not Equal to (Caster) <---
          • ((Picked unit) is dead) Equal to False
          • ((Picked unit) is Hidden) Equal to False
          • ((Picked unit) belongs to an ally of (Owner of Caster).) Equal to True
        • Then - Actions
          • Set VariableSet TempPoint[2] = (Position of (Picked unit))
          • Set VariableSet Distance = (Distance between TempPoint[1] and TempPoint[2])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Distance Less than or equal to CurrentRange
            • Then - Actions
              • Set VariableSet CurrentRange = Distance
              • Set VariableSet ClosestUnit = (Picked unit)
              • If (ClosestUnit is a building) Equal to True then Set VariableSet ClosestBuilding = ClosestUnit Else do nothing
            • Else - Actions
          • Custom script: call RemoveLocation (udg_TempPoint[2])
        • Else - Actions
Makes more sense to add the condition here because then the Caster will be filtered from the search for ClosestUnit.
There is not possible for me to find that Caster condition..
Edit: OH.. it's a unit comparison!
Great, now seems to work perfectly, thank you so much to both of you! @Duckfarter @Uncle :peasant-thumbs-up-cheers:
 
Last edited:
Level 13
Joined
Sep 11, 2013
Messages
467
  • Unit Group - Pick every unit in TeleportGroup and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) not Equal to (Caster) <---
          • ((Picked unit) is dead) Equal to False
          • ((Picked unit) is Hidden) Equal to False
          • ((Picked unit) belongs to an ally of (Owner of Caster).) Equal to True
        • Then - Actions
          • Set VariableSet TempPoint[2] = (Position of (Picked unit))
          • Set VariableSet Distance = (Distance between TempPoint[1] and TempPoint[2])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Distance Less than or equal to CurrentRange
            • Then - Actions
              • Set VariableSet CurrentRange = Distance
              • Set VariableSet ClosestUnit = (Picked unit)
              • If (ClosestUnit is a building) Equal to True then Set VariableSet ClosestBuilding = ClosestUnit Else do nothing
            • Else - Actions
          • Custom script: call RemoveLocation (udg_TempPoint[2])
        • Else - Actions
Makes more sense to add the condition here because then the Caster will be filtered from the search for ClosestUnit.
I want to use this teleport on friends and allies, but not on neutral passive. It is possible?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,860
Makes more sense to add the condition here because then the Caster will be filtered from the search for ClosestUnit.
In this case I would argue that it makes less sense to do that.

Would you rather:
1) Ask a question X times where X is the number of (Picked units).
2) Ask a question once.

#2 is more efficient and has the exact same outcome.


Edit2: I want to use this teleport on friends and allies, but not on neutral passive. It is possible?
The next step after we get our ClosestUnit should always be to try and "Stop" the caster if things have failed to meet our requirements.

You're already Stopping the Caster if any of these are true:
1) ClosestUnit isn't set. (No unit)
2) ClosestUnit is the Caster.

So just add a #3 here that checks if ClosestUnit is owned by Neutral Passive. Neutral Passive is a Player so there's your hint for what kind of Condition it'll be.
 
Last edited:
Level 24
Joined
Feb 27, 2019
Messages
831
Would you rather:
1) Ask a question X times where X is the number of (Picked units).
2) Ask a question once.

#2 is more efficient and has the exact same outcome.
I overlooked this part. It should make it so ClosestUnit cant be Equal to Caster since the Caster is removed from the group that is filtered to find ClosestUnit.
  • Unit Group - Remove Caster from TeleportGroup
This part is to find a valid target. Filtering should occur in the if then else condition within the pick every unit group action. Since Caster is removed from TeleportGroup and therefore cant be set to ClosestUnit there should be no need to filter Caster anywhere. This is the place to add the condition to filter out units that were picked and that are not valid targets for the caster to teleport to.
  • -------- This finds the closest eligible unit to the target point of ability being cast --------
    • Set VariableSet CurrentRange = 99999.00
    • Set VariableSet TeleportGroup = (Units in (Entire map))
    • Set VariableSet ClosestUnit = No unit
    • Set VariableSet ClosestBuilding = No unit
    • Unit Group - Remove Caster from TeleportGroup
    • -------- - --------
    • Unit Group - Pick every unit in TeleportGroup and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked unit) is dead) Equal to False
            • ((Picked unit) is Hidden) Equal to False
            • ((Picked unit) belongs to an ally of (Owner of Caster).) Equal to True
          • Then - Actions
            • Set VariableSet TempPoint[2] = (Position of (Picked unit))
            • Set VariableSet Distance = (Distance between TempPoint[1] and TempPoint[2])
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Distance Less than or equal to CurrentRange
              • Then - Actions
                • Set VariableSet CurrentRange = Distance
                • Set VariableSet ClosestUnit = (Picked unit)
                • If (ClosestUnit is a building) Equal to True then Set VariableSet ClosestBuilding = ClosestUnit Else do nothing
              • Else - Actions
            • Custom script: call RemoveLocation (udg_TempPoint[2])
          • Else - Actions
This is the failsafe for when the search for a ClosestUnit fails completely which should only be possible if there is no valid target on the entire map and has the somewhat bad effect that the unit is issued to stop. Its only there for a last measure, as a failsafe to stop undesired behaviour in that circumstance. The failsafe is not optimal but its better than nothing and at least in dota this scenario is impossible.
  • -------- Exit if no valid target was found --------
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ClosestUnit Equal to No unit
    • Then - Actions
      • Unit - Order Caster to Stop
      • Skip remaining actions
    • Else - Actions
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,860
Oh, I'm dumb, I was literally doing just that in my original trigger...

Which now makes me wonder how Ativ ran into this problem:
I can still target myself..
1.if i am the closest target
2.even if i am the last one alive
@AtivEnergy
The item will still go on cooldown/spend mana if you target yourself, if that was unclear. You'd have to reset the cd and refund the mana before issuing the Stop order to fix this.

Here's the final trigger, note how the Caster is removed from TeleportGroup meaning it couldn't possibly be a target. I also added a check to prevent units owned by Neutral Passive:
  • Staff Cast Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Instant (Item Ability)
    • Actions
      • Game - Display to (All players) the text: Start effect
      • Set VariableSet Caster = (Triggering unit)
      • Unit Group - Add Caster to TeleportCasterGroup
      • Set VariableSet UDex = (Custom value of Caster)
      • Set VariableSet TempPoint[1] = (Target point of ability being cast)
      • -------- - --------
      • -------- This finds the closest eligible unit to the target point of ability being cast --------
      • Set VariableSet CurrentRange = 99999.00
      • Set VariableSet TeleportGroup = (Units in (Playable map area))
      • Set VariableSet ClosestUnit = No unit
      • Unit Group - Remove Caster from TeleportGroup
      • -------- - --------
      • Unit Group - Pick every unit in TeleportGroup and do (Actions)
        • Loop - Actions
          • Set Variable TeleportTarget = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TeleportTarget is dead) Equal to False
              • (TeleportTarget is Hidden) Equal to False
              • (TeleportTarget belongs to an ally of (Owner of Caster).) Equal to True
              • (Owner of TeleportTarget) Not equal to Neutral Passive
            • Then - Actions
              • Set VariableSet TempPoint[2] = (Position of TeleportTarget)
              • Set VariableSet Distance = (Distance between TempPoint[1] and TempPoint[2])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Distance Less than or equal to CurrentRange
                • Then - Actions
                  • Set VariableSet CurrentRange = Distance
                  • Set VariableSet ClosestUnit = TeleportTarget
                • Else - Actions
              • Custom script: call RemoveLocation (udg_TempPoint[2])
            • Else - Actions
      • -------- - --------
      • -------- Exit if no valid target was found --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ClosestUnit Equal to No unit
        • Then - Actions
          • Unit - Set mana of Caster to (Mana of Caster + 150.00)
          • Unit - Remove (Item carried by Caster of type Boots of Travel)
          • Hero - Create Boots of Travel and give it to Caster
          • Unit - Order Caster to Stop
          • Skip remaining actions
        • Else - Actions
      • -------- - --------
      • ... continue as normal ...
Note that this only works properly if the Hero doesn't have more than one Boots of Travel equipped. I believe DotA had this restriction. You could probably solve it by having another trigger that tracks your "last used" Boots of Travel item, assuming that the "Uses an Item" Event occurs before "A unit Starts the effect of an ability". Then you could Remove the tracked Item directly.
 
Last edited:
Level 13
Joined
Sep 11, 2013
Messages
467
First of all, I wished an ability, not an item:)) This is not a problem, we have the ability.
The next step after we get our ClosestUnit should always be to try and "Stop" the caster if things have failed to meet our requirements.
I want the spell to stop Only if there are no more targets allowed for the spell. If there are allowed targets, but the closest target is a Neutral Passive/Enemy, the spell must go to the next closest good target, not to stop. (Your last trigger fix that issue so it is all good)

- - - - -

@Duckfarter So.. a lot of questions has arrived..

  • Staff Cast Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Instant (Ability)
    • Actions
      • Game - Display to (All players) the text: Start effect
      • Set VariableSet Caster = (Triggering unit)
      • Unit Group - Add Caster to TeleportCasterGroup
      • Set VariableSet UDex = (Custom value of Caster)
      • Set VariableSet TempPoint[1] = (Target point of ability being cast)
      • -------- - --------
      • -------- This finds the closest eligible unit to the target point of ability being cast --------
      • Set VariableSet CurrentRange = 99999.00
      • Set VariableSet TeleportGroup = (Units in (Entire map))
      • Set VariableSet ClosestUnit = No unit
      • Set VariableSet ClosestBuilding = No unit <---------------------------------------->>> 1. I don't understand for what is this? Seems unnecessary..
      • Unit Group - Remove ClosestUnit from TeleportGroup. <------------------------->>> 2. So I don't need this anymore?
      • Unit Group - Remove Caster from TeleportGroup.
      • -------- - --------
      • Unit Group - Pick every unit in TeleportGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to False
              • ((Picked unit) is hidden) Equal to False
              • ((Picked unit) belongs to an ally of (Owner of Caster).) Equal to True
              • (Owner of (Picked unit)) Not equal to Neutral Passive
            • Then - Actions
              • Set VariableSet TempPoint[2] = (Position of (Picked unit))
              • Set VariableSet Distance = (Distance between TempPoint[1] and TempPoint[2])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Distance Less than or equal to CurrentRange
                • Then - Actions
                  • Set VariableSet CurrentRange = Distance
                  • Set VariableSet ClosestUnit = (Picked unit)
                  • If ((ClosestUnit is A structure) Equal to True) then do (Set VariableSet ClosestBuilding = ClosestUnit) else do (Do nothing) - >>> ???
                • Else - Actions
              • Custom script: call RemoveLocation (udg_TempPoint[2])
            • Else - Actions
      • -------- - --------
      • -------- Exit if no valid target was found --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • ClosestUnit Equal to No unit
        • Then - Actions
          • Unit - Order Caster to Stop.
          • Unit - Set mana of Caster to ((Mana of Caster) + 50.00)
          • Skip remaining actions
        • Else - Actions
      • Set VariableSet StaffTarget[UDex] = ClosestUnit
      • Unit Group - Add StaffTarget[UDex] to TeleportTargetGroup
      • -------- - --------
      • -------- Special effects --------
      • Set VariableSet TempPoint[2] = (Position of Caster)
      • Special Effect - Create a special effect at TempPoint[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of Caster using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet EffectCaster[UDex] = (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of StaffTarget[UDex] using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet EffectTarget[UDex] = (Last created special effect)
      • Ubersplat - Create ubersplat at TempPoint[2] of type Human Mass Teleport with color (100.00%, 100.00%, 100.00%) and 0.00% transparency (Disable paused state, Disable skipping birth time)
      • Set VariableSet Ubersplat[UDex] = (Last created ubersplat)
      • Ubersplat - Change Ubersplat[UDex]: Enable render always state
      • Ubersplat - Show Ubersplat[UDex]
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call DestroyGroup(udg_TeleportGroup)
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call RemoveLocation (udg_TempPoint[2])
- - - - -
The item will still go on cooldown/spend mana if you target yourself, if that was unclear. You'd have to reset the cd and refund the mana before issuing the Stop order to fix this.
3. My item/ability will NOT go on cooldown if there is 0 available units to teleport (BUT THIS IS GOOOD because I don't want the ability to go on cooldown when there are 0 targets). The problem is that even if my ability will not go on cooldown will always take 50 mana and I Don't know why... I'll attach my map with this problem.
4.This trigger Will NOT restore the first 50 mana cost and again, I don't know why..
  • Unit - Set mana of Caster to ((Mana of Caster) + 50.00)
5.I don't really understand for what is this Set Variable TeleportTarget = (Picked unit) ?

Note that this only works properly if the Hero doesn't have more than one Boots of Travel equipped. I believe DotA had this restriction. You could probably solve it by having another trigger that tracks your "last used" Boots of Travel item, assuming that the "Uses an Item" Event occurs before "A unit Starts the effect of an ability". Then you could Remove the tracked Item directly.
This will be not a problem because is not an item, just an ability for my map.

Edit1. I think a solution for mana restore can be like this with a timer? I am not sure if that is good for MUI..
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • ClosestUnit Equal to No unit
    • Then - Actions
      • Countdown Timer - Start Timer_Teleport as a One-shot timer that will expire in 0.00 seconds
      • Unit - Order Caster to Stop.
      • Skip remaining actions
    • Else - Actions

  • Restore Mana After Timer
    • Events
      • Time - Timer_Teleport expires
    • Conditions
    • Actions
      • Unit - Set mana of Caster to ((Mana of Caster) + 50.00)
 

Attachments

  • Staff not Instant v.1.7.w3x
    29.8 KB · Views: 3
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,860
This version should work nicely.

I switched the Base Order Id of the Teleport ability to "flare" and changed the system to rely on this Order when getting started. This allows us to prevent the Ability from ever running any of the "casting" Events if it fails to find a valid target:
  • Teleport Begin Casting
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(flare))
      • (Level of Teleport Instant (Ability) for (Triggering unit)) Greater than 0
    • Actions
      • Game - Display to (All players) the text: Issue teleport order
      • Set VariableSet TP_Caster = (Triggering unit)
      • Set VariableSet TP_Point[1] = (Target point of issued order)
      • -------- - --------
      • -------- This finds the closest eligible unit to the target point of ability being cast --------
      • Set VariableSet TP_Closest_Unit = No unit
      • Set VariableSet TP_Closest_Distance = 99999.00
      • Set VariableSet TP_Group = (Units in (Playable map area))
      • Unit Group - Remove TP_Caster from TP_Group.
      • -------- - --------
      • Unit Group - Pick every unit in TP_Group and do (Actions)
        • Loop - Actions
          • Set VariableSet TP_Target[0] = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TP_Target[0] is dead) Equal to False
              • (TP_Target[0] is hidden) Equal to False
              • (TP_Target[0] belongs to an ally of (Owner of TP_Caster).) Equal to True
              • (Owner of TP_Target[0]) Not equal to Neutral Passive
            • Then - Actions
              • Set VariableSet TP_Point[2] = (Position of TP_Target[0])
              • Set VariableSet TP_Current_Distance = (Distance between TP_Point[1] and TP_Point[2])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TP_Current_Distance Less than TP_Closest_Distance
                • Then - Actions
                  • Set VariableSet TP_Closest_Distance = TP_Current_Distance
                  • Set VariableSet TP_Closest_Unit = TP_Target[0]
                • Else - Actions
              • Custom script: call RemoveLocation (udg_TP_Point[2])
            • Else - Actions
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call RemoveLocation (udg_TP_Point[1])
      • Custom script: call DestroyGroup(udg_TP_Group)
      • -------- - --------
      • -------- Exit if no valid target was found --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TP_Closest_Unit Equal to No unit
        • Then - Actions
          • Game - Display to (All players) for 5.00 seconds the text: |cffff0000TELEPORT ...
          • -------- This will interrupt the Order and prevent the ability from ever being used: --------
          • Unit - Order TP_Caster to Stop.
          • Custom script: call BlzPauseUnitEx( udg_TP_Caster, true )
          • Custom script: call BlzPauseUnitEx( udg_TP_Caster, false )
          • Skip remaining actions
        • Else - Actions
      • -------- - --------
      • Unit Group - Add TP_Caster to TP_Caster_Group
      • Trigger - Turn on Teleport Target Dies <gen>
      • -------- - --------
      • -------- Track the staff target using Unit Indexing: --------
      • Set VariableSet UDex = (Custom value of TP_Caster)
      • Set VariableSet TP_Target[UDex] = TP_Closest_Unit
      • Set VariableSet TP_Number_Of_Teleports_On_Me[(Custom value of TP_Closest_Unit)] = (TP_Number_Of_Teleports_On_Me[(Custom value of TP_Closest_Unit)] + 1)
      • -------- - --------
      • -------- Special effects --------
      • Set VariableSet TP_Point[2] = (Position of TP_Caster)
      • Special Effect - Create a special effect at TP_Point[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of TP_Caster using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet TP_Effect_Caster[UDex] = (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of TP_Target[UDex] using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet TP_Effect_Target[UDex] = (Last created special effect)
      • Ubersplat - Create ubersplat at TP_Point[2] of type Human Mass Teleport with color (100.00%, 100.00%, 100.00%) and 0.00% transparency (Disable paused state, Disable skipping birth time)
      • Set VariableSet TP_Ubersplat[UDex] = (Last created ubersplat)
      • Ubersplat - Change TP_Ubersplat[UDex]: Enable render always state
      • Ubersplat - Show TP_Ubersplat[UDex]
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call RemoveLocation (udg_TP_Point[2])
I also tweaked a bunch of other things.
  • I cleaned up the variable names.
  • I removed some unnecessary variables. (TeleportTargetGroup)
  • I added some new variables. (TP_Number_Of_Teleports_On_Me)
  • I fixed all of the memory leaks.
  • I made the Teleport Target Dies trigger OFF by default and only ON while a unit is in the process of teleporting.
 

Attachments

  • Staff not Instant uncle fix 1.w3x
    31.3 KB · Views: 4
Last edited:
Level 13
Joined
Sep 11, 2013
Messages
467
This version should work nicely.

I switched the Base Order Id of the Teleport ability to "flare" and changed the system to rely on this Order when getting started. This allows us to prevent the Ability from ever running any of the "casting" Events if it fails to find a valid target:
  • Teleport Begin Casting
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(flare))
      • (Level of Teleport Instant (Ability) for (Triggering unit)) Greater than 0
    • Actions
      • Game - Display to (All players) the text: Issue teleport order
      • Set VariableSet TP_Caster = (Triggering unit)
      • Set VariableSet TP_Point[1] = (Target point of issued order)
      • -------- - --------
      • -------- This finds the closest eligible unit to the target point of ability being cast --------
      • Set VariableSet TP_Closest_Unit = No unit
      • Set VariableSet TP_Closest_Distance = 99999.00
      • Set VariableSet TP_Group = (Units in (Playable map area))
      • Unit Group - Remove TP_Caster from TP_Group.
      • -------- - --------
      • Unit Group - Pick every unit in TP_Group and do (Actions)
        • Loop - Actions
          • Set VariableSet TP_Target[0] = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TP_Target[0] is dead) Equal to False
              • (TP_Target[0] is hidden) Equal to False
              • (TP_Target[0] belongs to an ally of (Owner of TP_Caster).) Equal to True
              • (Owner of TP_Target[0]) Not equal to Neutral Passive
            • Then - Actions
              • Set VariableSet TP_Point[2] = (Position of TP_Target[0])
              • Set VariableSet TP_Current_Distance = (Distance between TP_Point[1] and TP_Point[2])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TP_Current_Distance Less than TP_Closest_Distance
                • Then - Actions
                  • Set VariableSet TP_Closest_Distance = TP_Current_Distance
                  • Set VariableSet TP_Closest_Unit = TP_Target[0]
                • Else - Actions
              • Custom script: call RemoveLocation (udg_TP_Point[2])
            • Else - Actions
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call RemoveLocation (udg_TP_Point[1])
      • Custom script: call DestroyGroup(udg_TP_Group)
      • -------- - --------
      • -------- Exit if no valid target was found --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TP_Closest_Unit Equal to No unit
        • Then - Actions
          • Game - Display to (All players) for 5.00 seconds the text: |cffff0000TELEPORT ...
          • -------- This will interrupt the Order and prevent the ability from ever being used: --------
          • Unit - Order TP_Caster to Stop.
          • Custom script: call BlzPauseUnitEx( udg_TP_Caster, true )
          • Custom script: call BlzPauseUnitEx( udg_TP_Caster, false )
          • Skip remaining actions
        • Else - Actions
      • -------- - --------
      • Unit Group - Add TP_Caster to TP_Caster_Group
      • Trigger - Turn on Teleport Target Dies <gen>
      • -------- - --------
      • -------- Track the staff target using Unit Indexing: --------
      • Set VariableSet UDex = (Custom value of TP_Caster)
      • Set VariableSet TP_Target[UDex] = TP_Closest_Unit
      • Set VariableSet TP_Number_Of_Teleports_On_Me[(Custom value of TP_Closest_Unit)] = (TP_Number_Of_Teleports_On_Me[(Custom value of TP_Closest_Unit)] + 1)
      • -------- - --------
      • -------- Special effects --------
      • Set VariableSet TP_Point[2] = (Position of TP_Caster)
      • Special Effect - Create a special effect at TP_Point[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of TP_Caster using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet TP_Effect_Caster[UDex] = (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of TP_Target[UDex] using Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set VariableSet TP_Effect_Target[UDex] = (Last created special effect)
      • Ubersplat - Create ubersplat at TP_Point[2] of type Human Mass Teleport with color (100.00%, 100.00%, 100.00%) and 0.00% transparency (Disable paused state, Disable skipping birth time)
      • Set VariableSet TP_Ubersplat[UDex] = (Last created ubersplat)
      • Ubersplat - Change TP_Ubersplat[UDex]: Enable render always state
      • Ubersplat - Show TP_Ubersplat[UDex]
      • -------- - --------
      • -------- Remove leaks --------
      • Custom script: call RemoveLocation (udg_TP_Point[2])
I also tweaked a bunch of other things.
  • I cleaned up the variable names.
  • I removed some unnecessary variables. (TeleportTargetGroup)
  • I added some new variables. (TP_Number_Of_Teleports_On_Me)
  • I fixed all of the memory leaks.
  • I made the Teleport Target Dies trigger OFF by default and only ON while a unit is in the process of teleporting.

This works like a charm!
I also tweaked a bunch of other things.
  • I cleaned up the variable names.
  • I removed some unnecessary variables. (TeleportTargetGroup)
  • I added some new variables. (TP_Number_Of_Teleports_On_Me)
  • I fixed all of the memory leaks.
  • I made the Teleport Target Dies trigger OFF by default and only ON while a unit is in the process of teleporting.
This is awesome! Thank you so much! @Uncle & @Duckfarter There was a huge work in this thread for sure!
"One more thing" :peasant-blushing:
1723512332838.png

If i put all special effects from here on unit, not on position, it is safe and without leaks to delete the red marked triggers?
 
Top