Attack Animation with Spell

Status
Not open for further replies.
Level 26
Joined
Aug 18, 2009
Messages
4,097
How about when the unit is ordered a Flamestrike, it gets redirected to attack a dummy unit at the target position and when doing this, you set a flag to ignore next order and again change to Flamestrike. Or better let the Flamestrike be casted by another dummy and keep tower busy so it won't immediately change back.
 
  • Like
Reactions: Kam
This one was tricky, but I got it working. Since the part that moves is a bone and we know that turrets have a bone called "bone_turret" (unlike units having "bone_head"), we will use the SetUnitLookAt() function, which is the GUI: Animation - Lock Body-part facing.

An example is shown below:
  • Order
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(flamestrike))
    • Actions
      • Custom script: local real x = GetOrderPointX()
      • Custom script: local real y = GetOrderPointY()
      • Custom script: set bj_lastCreatedUnit = CreateUnit (GetTriggerPlayer(), 'h000', x, y, 0)
      • Custom script: call SetUnitLookAt (GetTriggerUnit(), "bone_turret", bj_lastCreatedUnit, 0, 0, 90 )
      • Custom script: call SaveUnitHandle (udg_Hash, GetHandleId (GetTriggerUnit()), 0, bj_lastCreatedUnit)
  • Spell
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Flame Strike (Neutral Hostile)
    • Actions
      • Custom script: call KillUnit (LoadUnitHandle (udg_Hash, GetHandleId (GetTriggerUnit()), 0))
      • Animation - Reset (Triggering unit)'s body-part facing
      • Custom script: call RemoveSavedHandle (udg_Hash, GetHandleId (GetTriggerUnit()), 0)
 

Attachments

  • Turret.w3x
    17.2 KB · Views: 51
Level 37
Joined
Mar 6, 2006
Messages
9,240
Is there a way to disable other abilities while the unit is casting this? I ask because the unit I'm using can transform using the robogoblin ability and when it does so the turret gets locked facing the position it last fired until it transforms again.

You can try
1) Detecting the transformation and resetting the facing.
2) Remove the transform when an ability is cast, add when the spell finihes/stops.
3) Use channel as base ability and et Disable other abilities to true.
4) Detect the transform order and override it.

It would also be better if it didn't give vision via the dummy unit.

You can create the dummy for neutral passive
  • Custom script: set bj_lastCreatedUnit = CreateUnit (Player(15), 'h000', x, y, 0)
or set the dummy's sight radius to 0.
 
  • Like
Reactions: Kam
Status
Not open for further replies.
Top