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

[Trigger] Move the unit! [Solved]

Status
Not open for further replies.
Level 10
Joined
Jun 20, 2017
Messages
333
I'm trying to move my tower to a new location!

The first trigger works fine but has no effect.
So I'm trying to add an effect on the second trigger.
When I use the ability, it creates a wisp above the tower and tower became unslectable, and allows me to move the wisp to a desired location!
And when I select another unit, the wisp is still there until you move it, so it does not disappear!
And when I want to select the wisp, it should force me to build/move the tower.

what works
the wisp moving

And what doesn't work
the sfx and moving the unit!
The special effect should be displayed after the unit is moved to a new location.
For the second trigger I want it to be like the first trigger, like you can't move your unit into the forbidden area!

  • Tower Moves
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Move Tower [Custom]
    • Actions
      • -------- West --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Casting unit)) Equal to Player 1 (Red)
              • (Owner of (Casting unit)) Equal to Player 2 (Blue)
          • And - All (Conditions) are true
            • Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (RedBuild <gen> contains (Target point of ability being cast)) Equal to True
                  • (BlueBuild <gen> contains (Target point of ability being cast)) Equal to True
                  • (RBCreepArmor <gen> contains (Target point of ability being cast)) Equal to True
                  • (RBCreepArmor2 <gen> contains (Target point of ability being cast)) Equal to True
        • Then - Actions
          • Set VariableSet Point_Temp = (Target point of ability being cast)
          • Unit - Move (Casting unit) instantly to Point_Temp, facing Default building facing degrees
          • Unit - Remove Move Tower [Custom] from (Casting unit)
          • Custom script: call RemoveLocation(udg_Point_Temp)
        • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Casting unit)) Equal to Player 3 (Teal)
              • (Owner of (Casting unit)) Equal to Player 4 (Purple)
          • And - All (Conditions) are true
            • Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (TealBuild <gen> contains (Target point of ability being cast)) Equal to True
                  • (PurpleBuild <gen> contains (Target point of ability being cast)) Equal to True
                  • (TPCreepArmor <gen> contains (Target point of ability being cast)) Equal to True
                  • (TPCreepArmor2 <gen> contains (Target point of ability being cast)) Equal to True
        • Then - Actions
          • Set VariableSet Point_Temp = (Target point of ability being cast)
          • Unit - Move (Casting unit) instantly to Point_Temp, facing Default building facing degrees
          • Unit - Remove Sphere [Custom] from (Casting unit)
          • Custom script: call RemoveLocation(udg_Point_Temp)
        • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Casting unit)) Equal to Player 5 (Yellow)
              • (Owner of (Casting unit)) Equal to Player 6 (Orange)
          • And - All (Conditions) are true
            • Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (YellowBuild <gen> contains (Target point of ability being cast)) Equal to True
                  • (OrangeBuild <gen> contains (Target point of ability being cast)) Equal to True
                  • (YOCreepArmor <gen> contains (Target point of ability being cast)) Equal to True
                  • (YOCreepArmor2 <gen> contains (Target point of ability being cast)) Equal to True
        • Then - Actions
          • Set VariableSet Point_Temp = (Target point of ability being cast)
          • Unit - Move (Casting unit) instantly to Point_Temp, facing Default building facing degrees
          • Unit - Remove Sphere [Custom] from (Casting unit)
          • Custom script: call RemoveLocation(udg_Point_Temp)
        • Else - Actions
      • -------- --------
      • -------- East --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Casting unit)) Equal to Player 7 (Green)
              • (Owner of (Casting unit)) Equal to Player 8 (Pink)
          • And - All (Conditions) are true
            • Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (GreenBuild <gen> contains (Target point of ability being cast)) Equal to True
                  • (PinkBuild <gen> contains (Target point of ability being cast)) Equal to True
                  • (GPCreepArmor <gen> contains (Target point of ability being cast)) Equal to True
                  • (GPCreepArmor2 <gen> contains (Target point of ability being cast)) Equal to True
        • Then - Actions
          • Set VariableSet Point_Temp = (Target point of ability being cast)
          • Unit - Move (Casting unit) instantly to Point_Temp, facing Default building facing degrees
          • Unit - Remove Sphere [Custom] from (Casting unit)
          • Custom script: call RemoveLocation(udg_Point_Temp)
        • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Casting unit)) Equal to Player 9 (Gray)
              • (Owner of (Casting unit)) Equal to Player 10 (Light Blue)
          • And - All (Conditions) are true
            • Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (GrayBuild <gen> contains (Target point of ability being cast)) Equal to True
                  • (LightBlueBuild <gen> contains (Target point of ability being cast)) Equal to True
                  • (GLCreepArmor <gen> contains (Target point of ability being cast)) Equal to True
                  • (GLCreepArmor2 <gen> contains (Target point of ability being cast)) Equal to True
        • Then - Actions
          • Set VariableSet Point_Temp = (Target point of ability being cast)
          • Unit - Move (Casting unit) instantly to Point_Temp, facing Default building facing degrees
          • Unit - Remove Sphere [Custom] from (Casting unit)
          • Custom script: call RemoveLocation(udg_Point_Temp)
        • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Casting unit)) Equal to Player 11 (Dark Green)
              • (Owner of (Casting unit)) Equal to Player 12 (Brown)
          • And - All (Conditions) are true
            • Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (DarkGreenBuild <gen> contains (Target point of ability being cast)) Equal to True
                  • (BrownBuild <gen> contains (Target point of ability being cast)) Equal to True
                  • (DBCreepArmor <gen> contains (Target point of ability being cast)) Equal to True
                  • (DBCreepArmor2 <gen> contains (Target point of ability being cast)) Equal to True
        • Then - Actions
          • Set VariableSet Point_Temp = (Target point of ability being cast)
          • Unit - Move (Casting unit) instantly to Point_Temp, facing Default building facing degrees
          • Unit - Remove Sphere [Custom] from (Casting unit)
          • Custom script: call RemoveLocation(udg_Point_Temp)
        • Else - Actions
  • Moves Tower
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Move Tower2 [Channel]
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Move Tower2 [Channel]
        • Then - Actions
          • Custom script: call UnitAddAbility(GetSpellAbilityUnit(), 'Aloc')
          • Unit - Create 1 Move Tower [Special Effect Wisp] for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
          • Selection - Select (Last created unit) for (Owner of (Casting unit))
          • Unit - Order (Last created unit) to Undead Build.
          • Game - Force (Owner of (Last created unit)) to press the key Q.
          • -------- --------
          • Set VariableSet Point_Temp = (Target point of ability being cast)
          • Unit - Move (Casting unit) instantly to Point_Temp, facing Default building facing degrees
          • Special Effect - Create a special effect at (Target point of ability being cast) using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
          • Custom script: call UnitRemoveAbility(GetSpellAbilityUnit(), 'Aloc')
          • Unit - Remove Move Tower2 [Channel] from (Casting unit)
          • Custom script: call RemoveLocation(udg_Point_Temp)
        • Else - Actions
          • Game - Display to (All players matching ((Owner of (Matching unit)) Equal to (Owner of (Casting unit))).) for 10.00 seconds the text: |cffff0000You can't...
          • Unit - Order (Last created unit) to Undead Build.
          • Game - Force (Owner of (Last created unit)) to press the key Q.
  • Select moving tower
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
      • Player - Player 9 (Gray) Selects a unit
      • Player - Player 10 (Light Blue) Selects a unit
      • Player - Player 11 (Dark Green) Selects a unit
      • Player - Player 12 (Brown) Selects a unit
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Move Tower [Special Effect Wisp]
    • Actions
      • Unit - Order (Triggering unit) to Undead Build.
      • Game - Force (Owner of (Triggering unit)) to press the key Q.
 

Attachments

  • Screenshot_9.png
    Screenshot_9.png
    2.2 MB · Views: 8
  • Screenshot_10.png
    Screenshot_10.png
    2.3 MB · Views: 8
  • Screenshot_11.png
    Screenshot_11.png
    2.3 MB · Views: 8
  • Screenshot_12.png
    Screenshot_12.png
    2.2 MB · Views: 8
  • Screenshot_13.png
    Screenshot_13.png
    2.2 MB · Views: 7
  • Screenshot_14.png
    Screenshot_14.png
    2.3 MB · Views: 7
  • Screenshot_15.png
    Screenshot_15.png
    2.3 MB · Views: 6
  • Screenshot_16.png
    Screenshot_16.png
    2.3 MB · Views: 7
  • Screenshot_17.png
    Screenshot_17.png
    2.4 MB · Views: 6
  • Screenshot_18.png
    Screenshot_18.png
    2.4 MB · Views: 6
  • Screenshot_19.png
    Screenshot_19.png
    2.4 MB · Views: 9
  • m test.w3m
    20.8 KB · Views: 1
Last edited:

Remixer

Map Reviewer
Level 31
Joined
Feb 19, 2011
Messages
1,956
What kind of abilities are you basing the abilities on of? I mean what point is referenced when the Tower casts the move tower ability?
If the "Move Tower2 [Channel] is actually a instant/channeling ability, it does not have a point of cast, so thus the effect would not show - nor would the unit create move anywhere.
 
Level 10
Joined
Jun 20, 2017
Messages
333
What kind of abilities are you basing the abilities on of? I mean what point is referenced when the Tower casts the move tower ability?
If the "Move Tower2 [Channel] is actually a instant/channeling ability, it does not have a point of cast, so thus the effect would not show - nor would the unit create move anywhere.
Channel and build tiny farm. Yes it is a instant/channeling ability, because I don't want it to have a dot target! and I don't want it to lose the paving tiles!
So I came up with an idea and tried to give it the ability to blink, but blinking requires movement.

Can buildings move? I think I tried this long ago and they cannot, will test in a moment...

Maybe make them Ancients and uproot?
No they can't, no I don't like that, I want something similar to blink.

I have added a sample map.
 
Level 12
Joined
Jan 10, 2023
Messages
191
I mean, I figured you definitely didn't want a slow uproot time and to have the building literally walk, but I'm saying maybe give it Uproot and then move it.

Some explanation:
Make Uproot have as fast of a casting time as possible, then trigger the move function, then order it to Root.

Then
You would likely want to hide the Root ability if possible.
Do this with the old add the spell to a spell-book and remove the spell-book trick.
(I'm not sure if Root/Uproot can be added to a spell-book).

If it can't be added to a spell-book, there are other options, but I don't want to go listing them because I think at that point it would involve enough triggering that this decision would be determined by what you want it to look like

So the triggers would look like
event:
Unit uses build farm
action:
1. order unit to uproot
2. move unit
3. order unit to root

That may not look so smooth so you may want to try (if you are okay with just destroying the tower) destroy it and then make a new tower, that would be most simple probably.
 
Last edited:

Remixer

Map Reviewer
Level 31
Joined
Feb 19, 2011
Messages
1,956
Yes it is a instant/channeling ability, because I don't want it to have a dot target!
If your channel is instant cast, then you must reference the location of the caster, instead of the target point of ability being cast. This difference is probably why your special effect is not showing up.
I don't want it to lose the paving tiles!
Paving tiles (or the building groud textures) can be done by creating Ubersplats, but of course, that would require once again more triggering.

Edit:
I made my interpretation of the tower move, it's very simplified yet efficient. This version uses a missile that the tower shoots to the unit created at the target location, and upon impact the tower is moved there.
Technically it might be more effective to create a effect to display the wisp and move it towards target location and then do shenanigans to detect when it arrives and switch the towers' places, but this requires quite intensive calculations and systems to be foolproof compared to this simplified version. I'd recommend not shooting for anything super complex using GUI.
 

Attachments

  • TowerMoveTest.w3m
    20.1 KB · Views: 4
Last edited:
Level 10
Joined
Jun 20, 2017
Messages
333
I get an error trying to root!
Unable to root there!

Thanks.
But I want it to create a wisp(builder) which can move/build the tower!

Almost done! I still have 2 problems that I can't solve!
1. The tower cannot be selected after moving!
2. I want to create a special effect when the tower moves, first one in the place where the previous tower is and the second one in the place where the tower moves, the first one will not display!

Also if I don't use wait in my triggers! actions after wait will not work! how can I do it without using wait!

  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Integer_TowerIndex = (Integer_TowerIndex + 1)
      • Set VariableSet UnitTypes_Tower[Integer_TowerIndex] = Guard Tower
      • -------- --------
      • Set VariableSet Integer_TowerIndex = (Integer_TowerIndex + 1)
      • Set VariableSet UnitTypes_Tower[Integer_TowerIndex] = Cannon Tower
      • -------- --------
      • Set VariableSet Integer_TowerIndex = (Integer_TowerIndex + 1)
      • Set VariableSet UnitTypes_Tower[Integer_TowerIndex] = Arcane Tower
      • -------- --------
      • Set VariableSet Integer_Tower = Integer_TowerIndex
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Move Tower
    • Actions
      • Set VariableSet Unit_Locust = (Casting unit)
      • Custom script: call UnitAddAbilityBJ( 'Aloc', udg_Unit_Locust )
      • Custom script: call UnitAddAbility(GetSpellAbilityUnit(), 'Aloc')
      • Unit Group - Add (Casting unit) to UnitGroup_Tower
      • -------- --------
      • Unit - Create 1 Wisp for (Owner of (Casting unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Selection - Select (Last created unit) for (Owner of (Casting unit))
      • Wait 0.01 seconds
      • Game - Force (Owner of (Last created unit)) to press the key Q.
  • Untitled Trigger 003
    • Events
      • Unit - A unit Begins construction
    • Conditions
      • (Unit-type of (Constructing structure)) Equal to Dummy Tower
    • Actions
      • Set VariableSet Unit_Tower = (Constructing structure)
      • -------- --------
      • Unit Group - Pick every unit in UnitGroup_Tower and do (Actions)
        • Loop - Actions
          • Unit - Kill Unit_Tower
          • Unit - Remove Unit_Tower from the game
          • -------- --------
          • For each (Integer A) from 1 to Integer_Tower, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to UnitTypes_Tower[(Integer A)]
                • Then - Actions
                  • Unit - Move (Picked unit) instantly to (Position of Unit_Tower), facing Default building facing degrees
                  • Special Effect - Create a special effect at (Position of Unit_Tower) using war3mapImported\Teleport.mdx
                  • Set VariableSet SpecialEffect = (Last created special effect)
                  • Special Effect - Destroy SpecialEffect
                  • Special Effect - Create a special effect at (Position of (Picked unit)) using war3mapImported\Teleport.mdx
                  • Set VariableSet SpecialEffect = (Last created special effect)
                  • Special Effect - Destroy SpecialEffect
                  • Custom script: call UnitRemoveAbilityBJ( 'Aloc', udg_Unit_Locust )
                  • Custom script: call UnitRemoveAbilityBJ( 'Aloc', GetEnumUnit() )
                  • Custom script: call UnitRemoveAbility(GetEnumUnit(), 'Aloc')
                  • Unit Group - Remove (Picked unit) from UnitGroup_Tower.
                • Else - Actions
  • Untitled Trigger 004
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Wisp Builds
    • Actions
      • Wait 0.01 seconds
      • Unit - Kill (Casting unit)
      • Unit - Remove (Casting unit) from the game
 

Attachments

  • MoveTower.w3x
    27.3 KB · Views: 4
Last edited:

Remixer

Map Reviewer
Level 31
Joined
Feb 19, 2011
Messages
1,956
Hello. Some feedback on your triggers:
Untitled Trigger 002
  • joinminus.gif
    events.gif
    Events
    • line.gif
      joinbottom.gif
      unit.gif
      Unit - A unit Starts the effect of an ability
  • joinminus.gif
    cond.gif
    Conditions
    • line.gif
      joinbottom.gif
      if.gif
      (Ability being cast) Equal to Move Tower
  • joinbottomminus.gif
    actions.gif
    Actions
    • empty.gif
      join.gif
      set.gif
      Set VariableSet Unit_Locust = (Casting unit) [ I'd recommend using more clear variable names, such as "Unit_A", which do not indicate a specific use. That way you can re-use the same variable without confusing yourself or others. Second point -use Triggering Unit, it's faster and works in more cases.]
    • empty.gif
      join.gif
      page.gif
      Custom script: call UnitAddAbilityBJ( 'Aloc', udg_Unit_Locust ) [ This line adds Locust to the unit. ]
    • empty.gif
      join.gif
      page.gif
      Custom script: call UnitAddAbility(GetSpellAbilityUnit(), 'Aloc') [ And this line adds it again - no need to do it twice. ]
    • empty.gif
      join.gif
      unitgroup.gif
      Unit Group - Add (Casting unit) to UnitGroup_Tower [ Use the variable here, do not call for the fuction to get the "Casting Unit" again. GUI is not clear with this, but whenever you refer to one of those "Casting/Triggering/Target Unit" it calls for a function to find it - you already found it once when setting the variable - do not do it again - it slows the trigger down (marginally, but still). ]
    • empty.gif
      join.gif
      comment.gif
      -------- --------
    • empty.gif
      join.gif
      unit.gif
      Unit - Create 1 Wisp for (Owner of (Casting unit)) at (Position of (Triggering unit)) facing Default building facing degrees
    • empty.gif
      join.gif
      selunit.gif
      Selection - Select (Last created unit) for (Owner of (Casting unit)) [ Here use the variable, the Casting Unit and Triggering Unit are the same, and your variable Unit_Locust is also the same unit. ]
    • empty.gif
      join.gif
      zzz.gif
      Wait 0.01 seconds [ Waits are inprecise - avoid using them. Use Timers instead, though GUI sucks in this regard. ]
    • empty.gif
      joinbottom.gif
      game.gif
      Game - Force (Owner of (Last created unit)) to press the key Q. [ Use the owner of the variable unit here, it's the same as the owner of the Last Created Unit, since you defined it just a few lines ago. Since the same Player (owner of the unit) is referenced here already 3 times, I'd recommend creating a PlayerVariable for that, so Player_A = Owner of Unit_Locust. ]
base.gif
Untitled Trigger 003
  • joinminus.gif
    events.gif
    Events
    • line.gif
      joinbottom.gif
      unit.gif
      Unit - A unit Begins construction
  • joinminus.gif
    cond.gif
    Conditions
    • line.gif
      joinbottom.gif
      if.gif
      (Unit-type of (Constructing structure)) Equal to Dummy Tower [ I believe that here you can also use Triggering Unit. It's more convenient. ]
  • joinbottomminus.gif
    actions.gif
    Actions
    • empty.gif
      join.gif
      set.gif
      Set VariableSet Unit_Tower = (Constructing structure) [ Same thing here - Triggering Unit. ]
    • empty.gif
      join.gif
      comment.gif
      -------- --------
    • empty.gif
      joinbottomminus.gif
      unitgroup.gif
      Unit Group - Pick every unit in UnitGroup_Tower and do (Actions) [ Using the Group here, if two Tower Moves are active at the same time, the first instance of tower being built will move all the towers being moved into that spot and only remove the Wisp building it. Since you only create a single link: that between the Wisp and the Tower being moved, I'd recommend to not use groups - us Hashtables instead of example - or unit indexing.]
      • empty.gif
        empty.gif
        joinbottomminus.gif
        actions.gif
        Loop - Actions
        • empty.gif
          empty.gif
          empty.gif
          join.gif
          unit.gif
          Unit - Kill Unit_Tower
        • empty.gif
          empty.gif
          empty.gif
          join.gif
          unit.gif
          Unit - Remove Unit_Tower from the game
        • empty.gif
          empty.gif
          empty.gif
          join.gif
          comment.gif
          -------- --------
        • empty.gif
          empty.gif
          empty.gif
          joinbottomminus.gif
          if.gif
          For each (Integer A) from 1 to Integer_Tower, do (Actions)
          • empty.gif
            empty.gif
            empty.gif
            empty.gif
            joinbottomminus.gif
            actions.gif
            Loop - Actions
            • empty.gif
              empty.gif
              empty.gif
              empty.gif
              empty.gif
              joinbottomminus.gif
              if.gif
              If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • empty.gif
                empty.gif
                empty.gif
                empty.gif
                empty.gif
                empty.gif
                joinminus.gif
                cond.gif
                If - Conditions
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  joinbottom.gif
                  if.gif
                  (Unit-type of (Picked unit)) Equal to UnitTypes_Tower[(Integer A)]
              • empty.gif
                empty.gif
                empty.gif
                empty.gif
                empty.gif
                empty.gif
                joinminus.gif
                actions.gif
                Then - Actions
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  join.gif
                  unit.gif
                  Unit - Move (Picked unit) instantly to (Position of Unit_Tower), facing Default building facing degrees
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  join.gif
                  ani.gif
                  Special Effect - Create a special effect at (Position of Unit_Tower) using war3mapImported\Teleport.mdx
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  join.gif
                  set.gif
                  Set VariableSet SpecialEffect = (Last created special effect) [ Declaring the variable here does not make sense. The Last created special effect itself is already a variable, so just call for its removal instead - or is there a problem doing that?. ]
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  join.gif
                  ani.gif
                  Special Effect - Destroy SpecialEffect
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  join.gif
                  ani.gif
                  Special Effect - Create a special effect at (Position of (Picked unit)) using war3mapImported\Teleport.mdx
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  join.gif
                  set.gif
                  Set VariableSet SpecialEffect = (Last created special effect)
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  join.gif
                  ani.gif
                  Special Effect - Destroy SpecialEffect
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  join.gif
                  page.gif
                  Custom script: call UnitRemoveAbilityBJ( 'Aloc', udg_Unit_Locust )
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  join.gif
                  page.gif
                  Custom script: call UnitRemoveAbilityBJ( 'Aloc', GetEnumUnit() )
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  join.gif
                  page.gif
                  Custom script: call UnitRemoveAbility(GetEnumUnit(), 'Aloc')
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  joinbottom.gif
                  unitgroup.gif
                  Unit Group - Remove (Picked unit) from UnitGroup_Tower.
              • empty.gif
                empty.gif
                empty.gif
                empty.gif
                empty.gif
                empty.gif
                joinbottom.gif
                actions.gif
                Else - Actions

Edit:
The unit is unselectable because you added Locust to it - even if you remove it, the unit cannot be selected again. If you Hide and Show the unit via triggers it becomes selectable, but only through Drag Selection.
 
Last edited:
Level 10
Joined
Jun 20, 2017
Messages
333
Thanks, it worked, I read your comments and I will correct them in my map.

However I'm still having trouble with the special effect though! I have no idea why it doesn't show the first one?!
I even created 2 variables for each but it didn't help! and I created 1 before and 1 after moving the unit yet same thing!
  • move
    • Events
      • Unit - A unit Begins construction
    • Conditions
      • (Unit-type of (Constructing structure)) Equal to Dummy Tower
    • Actions
      • Set VariableSet Unit_Tower = (Constructing structure)
      • -------- --------
      • Unit Group - Pick every unit in UnitGroup_Tower and do (Actions)
        • Loop - Actions
          • Unit - Kill Unit_Tower
          • Unit - Remove Unit_Tower from the game
          • -------- --------
          • For each (Integer A) from 1 to Integer_Tower, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Owner of Unit_Tower) Equal to Player 1 (Red)
                      • (Owner of Unit_Tower) Equal to Player 2 (Blue)
                  • And - All (Conditions) are true
                    • Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (red and blue <gen> contains Unit_Tower) Equal to True
                          • (red <gen> contains Unit_Tower) Equal to True
                          • (blue <gen> contains Unit_Tower) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Picked unit)) Equal to UnitTypes_Tower[(Integer A)]
                    • Then - Actions
                      • Set VariableSet Point_SFX2 = (Position of Unit_Tower)
                      • Special Effect - Create a special effect at Point_SFX2 using war3mapImported\Teleport.mdx
                      • Set VariableSet SpecialEffect2 = (Last created special effect)
                      • Special Effect - Destroy SpecialEffect2
                      • Custom script: call RemoveLocation(udg_Point_SFX2)
                      • -------- --------
                      • Unit - Move (Picked unit) instantly to (Position of Unit_Tower), facing Default building facing degrees
                      • -------- --------
                      • Set VariableSet Point_SFX2 = (Position of Unit_Tower)
                      • Special Effect - Create a special effect at Point_SFX2 using war3mapImported\Teleport.mdx
                      • Set VariableSet SpecialEffect2 = (Last created special effect)
                      • Special Effect - Destroy SpecialEffect2
                      • Custom script: call RemoveLocation(udg_Point_SFX2)
                      • -------- --------
                      • Set VariableSet Point_SFX = (Position of (Picked unit))
                      • Special Effect - Create a special effect at Point_SFX using war3mapImported\Teleport.mdx
                      • Set VariableSet SpecialEffect = (Last created special effect)
                      • Special Effect - Destroy SpecialEffect
                      • Custom script: call RemoveLocation(udg_Point_SFX)
                      • -------- --------
                      • Unit - Hide (Picked unit)
                      • Custom script: call UnitRemoveAbility(GetEnumUnit(), 'Aloc')
                      • Unit - Unhide (Picked unit)
                      • Unit Group - Remove (Picked unit) from UnitGroup_Tower.
                      • Unit - Kill Unit_wisp
                      • Unit - Remove Unit_wisp from the game
                    • Else - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of Unit_wisp) Equal to Wisp 2
                    • Then - Actions
                      • Unit - Kill Unit_wisp
                      • Unit - Remove Unit_wisp from the game
                      • Game - Display to (All players) the text: cant move there!
                      • -------- --------
                      • Unit Group - Pick every unit in UnitGroup_Tower and do (Actions)
                        • Loop - Actions
                          • For each (Integer A) from 1 to Integer_Tower, do (Actions)
                            • Loop - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Unit-type of (Picked unit)) Equal to UnitTypes_Tower[(Integer A)]
                                • Then - Actions
                                  • Unit - Hide (Picked unit)
                                  • Custom script: call UnitRemoveAbility(GetEnumUnit(), 'Aloc')
                                  • Unit - Unhide (Picked unit)
                                  • Unit Group - Remove (Picked unit) from UnitGroup_Tower.
                                • Else - Actions
                    • Else - Actions
 

Remixer

Map Reviewer
Level 31
Joined
Feb 19, 2011
Messages
1,956
However I'm still having trouble with the special effect though! I have no idea why it doesn't show the first one?!
I think that the unit being selected from the Group is the tower being moved, correct?
Thus, in your code what happens is this:

empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
joinminus.gif
actions.gif
Then - Actions
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
set.gif
Set VariableSet Point_SFX2 = (Position of Unit_Tower) [Point_SFX2 = NewLocation of the tower.]
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
ani.gif
Special Effect - Create a special effect at Point_SFX2 using war3mapImported\Teleport.mdx [Create an effect at NewLocation.]
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
set.gif
Set VariableSet SpecialEffect2 = (Last created special effect)
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
ani.gif
Special Effect - Destroy SpecialEffect2
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
page.gif
Custom script: call RemoveLocation(udg_Point_SFX2)
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
comment.gif
-------- --------
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
unit.gif
Unit - Move (Picked unit) instantly to (Position of Unit_Tower), facing Default building facing degrees [Move PickedUnit from OldLocation to NewLocation.]
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
comment.gif
-------- --------
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
set.gif
Set VariableSet Point_SFX2 = (Position of Unit_Tower) [Exactly the same line as from above.]
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
ani.gif
Special Effect - Create a special effect at Point_SFX2 using war3mapImported\Teleport.mdx [This is also the same line from above - creates the effect again at the same location.]
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
set.gif
Set VariableSet SpecialEffect2 = (Last created special effect)
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
ani.gif
Special Effect - Destroy SpecialEffect2
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
page.gif
Custom script: call RemoveLocation(udg_Point_SFX2)
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
comment.gif
-------- --------
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
set.gif
Set VariableSet Point_SFX = (Position of (Picked unit)) [Point_SFX = Location of PickedUnit, you moved the PickedUnit to the NewLocation on the line I marked with orange.]
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
ani.gif
Special Effect - Create a special effect at Point_SFX using war3mapImported\Teleport.mdx[Create an effect at the NewLocation (since the Point_SFX is also referencing the NewLocation, since the location of the picked unit is the... new location.]
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
set.gif
Set VariableSet SpecialEffect = (Last created special effect)
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
ani.gif
Special Effect - Destroy SpecialEffect
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
empty.gif
line.gif
empty.gif
line.gif
join.gif
page.gif
Custom script: call RemoveLocation(udg_Point_SFX)

So in order to fix that, just declare the Point_SFX before you move the Picked unit to the new location.
 
Level 10
Joined
Jun 20, 2017
Messages
333
[Point_SFX2 = NewLocation of the tower.]
I thought it would create a special effect in the place where the tower was built, not in a new place!
Thanks, I created a new trigger for that.

And I made another trigger that I can't seem to solve it! Or I made a mistake somewhere!
How can I make my worker not move or build from the start?
For example, if my wisp wants to move or build something outside of those area, it shouldn't move at all.
  • wisp moves or builds
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(move))
          • (Issued order) Equal to (Order(build))
    • Actions
      • Set VariableSet Unit_Tower = (Ordered unit)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of Unit_Tower) Equal to Player 1 (Red)
              • (Owner of Unit_Tower) Equal to Player 2 (Blue)
          • And - All (Conditions) are true
            • Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (red and blue <gen> contains Unit_Tower) Equal to True
                  • (red <gen> contains Unit_Tower) Equal to True
                  • (blue <gen> contains Unit_Tower) Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: can move!
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Ordered unit)) Equal to Wisp2
            • Then - Actions
              • Unit - Set Unit_wisp movement speed to 0.00
              • Unit - Pause Unit_wisp
              • Unit - Unpause Unit_wisp
              • Unit - Set Unit_wisp movement speed to (Default movement speed of (Triggering unit))
              • Game - Display to (All players) the text: can't move there!
              • -------- --------
              • Unit Group - Pick every unit in UnitGroup_Tower and do (Actions)
                • Loop - Actions
                  • For each (Integer A) from 1 to Integer_Tower, do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Picked unit)) Equal to UnitTypes_Tower[(Integer A)]
                        • Then - Actions
                          • Unit - Hide (Picked unit)
                          • Custom script: call UnitRemoveAbility(GetEnumUnit(), 'Aloc')
                          • Unit - Unhide (Picked unit)
                          • Unit Group - Remove (Picked unit) from UnitGroup_Tower.
                        • Else - Actions
            • Else - Actions
 

Remixer

Map Reviewer
Level 31
Joined
Feb 19, 2011
Messages
1,956
I thought it would create a special effect in the place where the tower was built, not in a new place!
Thanks, I created a new trigger for that.
You don't need a new trigger for it - you only need to declare (set) the variable Point_SFX2 before you move the unit. So, move this line:
  • Set VariableSet Point_SFX = (Position of (Picked unit))
... above this line:
  • Unit - Move (Picked unit) instantly to (Position of Unit_Tower), facing Default building facing degrees
and then the Point_SFX is referencing the old location, where you want your effect.

To prevent a unit from moving or even attempting to move outside a set area, you can use region or coordinates. This trigger prevents any unit from moving outside the region. So, for your purpose you want to check that it applies to those units you want to, within the regions you want to.
  • Melee Initialization
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Set VariableSet point_target = (Target point of issued order)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DesiredRegion <gen> contains point_target) Equal to False
        • Then - Actions
          • Unit - Order (Triggering unit) to Move To (Position of (Triggering unit))
          • Unit - Add Inferno (Neutral Hostile) to (Triggering unit)
          • Game - Display to (All players) the text: no
        • Else - Actions
          • Game - Display to (All players) the text: yes
      • Custom script: call RemoveLocation(udg_point_target)
      • Trigger - Turn on (This trigger)
 
Status
Not open for further replies.
Top