Handling unit turn via script with movement ui disabled

Status
Not open for further replies.
Level 1
Joined
Nov 9, 2019
Messages
2
Hi,

I'd like to:
1. disable the movement/attack UI of an unit, just leave the spells out.
*Currently I've set the unit movement speed to 0. Setting unitPropwindow doesn't suit me, because it leaves out the movement UI.

2. when I run a script I'd like the unit to turn left / right.
* I've tried using the unit - make unit face angle, however when movement is disabled it doesnt work.
* I've also tried using unit - move to position of unit facing angle - this works but partially, when movement is disabled the unit turned this way is moved around its selection circle in a funny way (see the screenshot attached) (changing the selection circle size to 0 or -1 doesn't quite solve this because it removes health bar).

turn.jpg

Is there another way to do this?
Perhaps removing the textures of selection circle?
 
Last edited:
Level 3
Joined
May 17, 2019
Messages
45
Hi,

In order to disable move and attack for a unit, you can use custom scripts. Same for facing angle.

  • -------- Disabling move and attack for unit --------
  • Set Unit = Paladin 0000 <gen>
  • Custom script: call UnitRemoveAbility(udg_Unit, 'Aatk')
  • Custom script: call UnitRemoveAbility(udg_Unit, 'Amov')
  • -------- Facing angle --------
  • Set Angle = (Facing of Unit)
  • Custom script: call SetUnitFacing(udg_Unit, udg_Angle + 45) (turn right)
  • Custom script: call SetUnitFacing(udg_Unit, udg_Angle - 45) (turn left)
 
Level 1
Joined
Nov 9, 2019
Messages
2
Hi,

In order to disable move and attack for a unit, you can use custom scripts. Same for facing angle.

  • -------- Disabling move and attack for unit --------
  • Set Unit = Paladin 0000 <gen>
  • Custom script: call UnitRemoveAbility(udg_Unit, 'Aatk')
  • Custom script: call UnitRemoveAbility(udg_Unit, 'Amov')
  • -------- Facing angle --------
  • Set Angle = (Facing of Unit)
  • Custom script: call SetUnitFacing(udg_Unit, udg_Angle + 45) (turn right)
  • Custom script: call SetUnitFacing(udg_Unit, udg_Angle - 45) (turn left)

It works similiarly to settings the unit speed to 0.

Funny thing I discovered, and I have yet to investigate why - when you set movement speed of unit to 0 the selection circle starts acting up while turning, but when you set the movement speed of hero to 0 it turns without any issues.

Additionally, units vs heroes require less degrees per function call to rotate at same speed. Really weird
 
Last edited:
Status
Not open for further replies.
Top