Unit stand like a tower

Not open for further replies.
Level 3
Mar 29, 2011
I wanna make a unit stand like a tower and shoot everything in it's range, but don't move out.
The problems is when i make it a building or set movement speed =0, it's shooting but don't turn at enemy position.

Then i try to make
-A unit leave zone -> order leaving unit move to zone.
It's work but unit keep leave zone and return, and i don't like this.
Even try to reduce the rect to smallest size, reduce help range to 0, accq range to 0 but it didn't work.


Code Reviewer
Level 26
Mar 19, 2008
At first, if I understood you well you want unit to sit in the same place for all game long and just attack everything around (and still turn around at enemies). If so you could use this:

Set the position you want the given unit to stay at.
Use coordinates to move it smoothly without interrupting actions + trigger with periodic event.

  • Set yourUnit = Archer
  • Set temppoint = (Position of (yourUnit))
  • Set x = X of temppoint
  • Set y = Y of temppoint
  • Custom script: call RemoveLocation (udg_temppoint)
Use this in map initialization or wherever/whenever you want, just to save location.
Now when its done use:
  • Trigger - Turn on Sit Loop
Now we create Sit Loop trigger which.. allows our unit to sit in same location for all game long..
  • Sit Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Custom script: call SetUnitX (udg_yourUnit, udg_x)
      • Custom script: call SetUnitY (udg_yourUnit, udg_y)
Just Remember to create function which checks if unit is alive - if so, turn off the loop.

You can also use.. building? Why not if unit shouldn't move.
How to make it turn around like elf's guardian tower?

The answer you seek is here.
Level 37
Mar 6, 2006
You can also take whatever normal unit and place it on the map. In gameplay constants, set Movement - Unit speed - Minimum to 0. Then set the movement speed of all these units to 0 with triggers.

This way the unit will turn automatically, but won't move. A possible downside is that you can order it to turn, but it might not matter and you can prevent that with triggering.
Not open for further replies.