#Help with using abilities and auto attacks while turning is disabled

1 messages · Page 1 of 1 (latest)

stiff quarry
#

I've been working on a custom toggle ability that locks the direction a hero's facing, but lets them continue to auto attack and cast spells. MODIFIER_PROPERTY_DISABLE_TURNING works great for disabling turning, but makes auto attacks and abilities feel bad. I've been thinking about ways to make this better, and have a couple ideas.

  1. Increase the cast angle for abilities and auto attacks. MODIFIER_PROPERTY_IGNORE_CAST_ANGLE is the right idea, but I want to be able to limit it to say, 45 degrees instead of a full 360. Is this even possible? I haven't found anything in the scripting API, but this feels like the best solution.

  2. Stop using MODIFIER_PROPERTY_DISABLE_TURNING and capture the units YAW upon toggle using GetLocalAngles. Then when the unit would turn, limit how far in either direction it can go (using RotateOrientation?). If I understand how it works, I think OnIntervalThink and friends would work for this, but it feels heavy handed. Is there a way to trigger effects when a unit is turning, instead of during the entire time the ability is toggled on?

cedar hemlock
#
  1. I don't know how would you limit the cast angle directly. I would use MODIFIER_PROPERTY_IGNORE_CAST_ANGLE and then filter ability casts beyond 45 degrees with Order filter (SetExecuteOrderFilter) or with MODIFIER_EVENT_ON_ABILITY_START.
  2. To allow some auto-attacks I would still use MODIFIER_PROPERTY_DISABLE_TURNING and filter issued attack orders in OnOrder (MODIFIER_EVENT_ON_ORDER ) or in OnAttackStart (MODIFIER_EVENT_ON_ATTACK_START). You can change hero's facing with SetForwardVector(direction) even if turning is disabled. If you don't want him to turn at all (even artificially with SetForwardVector) then for attacks you can use PerformAttack.
#

So basically I would have the whole 'check for angle logic' in OnOrder.

#

You can also try playing around with GetAngles and SetAngles if you prefer it.

#

Edited above posts because I messed up Order Filter and OnOrder