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

Mass Teleport to target of Casting Unit

Status
Not open for further replies.
Level 4
Joined
Feb 23, 2020
Messages
33
Hi all,

I'm having a problem with my trigger. I initially thought the Mass Teleport spell would work using a building, but it didn't. So, I went with using a trigger and special effects. It all works, except that my units move to the middle of the map instead of the target of the mass teleport.

Can anyone help me out?
 
Level 4
Joined
Feb 23, 2020
Messages
33
Sure thing.

I've made it so if it's not the teleportation node, the spell fails. However, if you do target the node, it should go ahead and teleport units to the node.


  • Blood Elf Teleport
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Teleport (Blood Elf)
    • Actions
      • Unit Group - Pick every unit in (Units within 700.00 of (Position of (Casting unit)) matching ((Owner of (Matching unit)) Equal to (Owner of (Casting unit))).) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A structure) Equal to True
            • Then - Actions
              • Do nothing
            • Else - Actions
              • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Undead\DarkRitual\DarkRitualCaster.mdl
              • Special Effect - Destroy (Last created special effect)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Target unit of ability being cast)) Equal to Teleportation Node (Blood Elf)
        • Then - Actions
          • Wait 4.00 seconds
          • Unit - Order (Casting unit) to Stop.
          • Unit - For Unit (Casting unit), start cooldown of ability Teleport (Blood Elf) " over "60.00 seconds.
          • Unit Group - Pick every unit in (Units within 700.00 of (Position of (Casting unit)) matching ((Owner of (Matching unit)) Equal to (Owner of (Casting unit))).) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A structure) Equal to True
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Unit - Move (Picked unit) instantly to ((Position of (Target unit of ability being cast)) offset by ((Random real number between -300.00 and 300.00), (Random real number between -300.00 and 300.00)))
                  • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
                  • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • Wait 4.00 seconds
          • Unit - Order (Casting unit) to Stop.
          • Unit - For Unit (Casting unit), start cooldown of ability Teleport (Blood Elf) " over "60.00 seconds.
          • Unit Group - Pick every unit in (Units within 500.00 of (Position of (Casting unit)) matching ((Owner of (Matching unit)) Equal to (Owner of (Casting unit))).) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A structure) Equal to True
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                  • Special Effect - Destroy (Last created special effect)


Thanks for the tip on how to post triggers too!
 
Level 12
Joined
Feb 5, 2018
Messages
521
page.gif
Do nothing

This should never be used, it just eats up time from the trigger and can cause issues with your trigger running, if placed in a wrong block.

Unit Group - Pick every unit in (Units within 700.00 of (Position of (Casting unit)) matching ((Owner of (Matching unit)) Equal to (Owner of (Casting unit))).) and do (Actions)

I highly recommend you to save points into variables. I'm pretty sure the location is lost after you use a wait in a loop action block.

Things That Leak
Memory Leaks
Event Response Myths
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,548
You could do something like this:
  • Cast Teleport
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to MASS TELEPORT
      • (Unit-type of (Target unit of ability being cast)) Equal to Node
    • Actions
      • -------- Set Variables --------
      • Set VariableSet TempPoints[1] = (Position of (Triggering unit))
      • Set VariableSet TempPoints[2] = (Position of (Target unit of ability being cast))
      • Set VariableSet TempGroup = (Units within 700.00 of TempPoints[1].)
      • -------- --------
      • -------- Move Units --------
      • Unit - Move (Triggering unit) instantly to TempPoints[2]
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • (Picked unit) Not equal to (Triggering unit)
            • Then - Actions
              • Unit - Move (Picked unit) instantly to TempPoints[2]
            • Else - Actions
      • -------- --------
      • -------- Cooldown --------
      • Unit - For Unit (Triggering unit), start cooldown of ability MASS TELEPORT " over "10.00 seconds.
      • -------- --------
      • -------- Art --------
      • Special Effect - Create a special effect at TempPoints[1] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect at TempPoints[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- --------
      • -------- Clean Up Memory Leaks --------
      • Custom script: call RemoveLocation(udg_TempPoints[1])
      • Custom script: call RemoveLocation(udg_TempPoints[2])
      • Custom script: call DestroyGroup(udg_TempGroup)
Variables:
TempPoints = Point (Array)
TempGroup = Unit Group

The MASS TELEPORT ability has a 4.00 second Cast Time (Set in the Object Editor), this gives it the delay before casting. I understand that this lacks some of the Special Effects that you were using but you could always create another trigger using the "Begins casting an ability" Event and create the Special Effects then. Also, note that Begins casting an ability happens before the ability actually goes off, whereas Starts the effect of an ability happens the exact moment that the ability spends mana, goes on cooldown, and does it's effect.

That being said, in this case there's an exception. If you Move a unit in response to these Events the unit will be issued a "Stop" command which actually interrupts the abilities cooldown. You obviously know this as you came up with a good solution starting the cooldown via triggers. However, it's not actually necessary. You can use the method in this thread: Move unit without disrupting its orders
This will move units WITHOUT issuing a "Stop" command, thus not interrupting the ability.
 

Attachments

  • Mass Teleport.w3m
    17.9 KB · Views: 28
Last edited:
Status
Not open for further replies.
Top