• 🏆 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!

Attack animation

Status
Not open for further replies.
Level 4
Joined
Jul 10, 2013
Messages
73
I have an attack animation that I can get to be used on units easily, but is there a way to have it be used on doodads? (trees/crates etc.)

  • Attack Animation
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Player (Hero) (Flamethrower)
          • (Unit-type of (Attacking unit)) Equal to Player (M-468) (Hero)
          • (Unit-type of (Attacking unit)) Equal to Player (Pistol) (Hero)
          • (Unit-type of (Attacking unit)) Equal to Player (Rifle) (Hero)
          • (Unit-type of (Attacking unit)) Equal to Player (Dual Pistol) (Hero)
          • (Unit-type of (Attacking unit)) Equal to Player (Shredder) (Hero)
          • (Unit-type of (Attacking unit)) Equal to Player (Shotgun) (Hero)
          • (Unit-type of (Attacking unit)) Equal to Player (Radio) (Hero)
          • (Unit-type of (Attacking unit)) Equal to Player (Hero) (Chainsaw)
          • (Unit-type of (Attacking unit)) Equal to Player (Sniper) (Hero)
          • (Unit-type of (Attacking unit)) Equal to Player (Ak 47) (Hero)
          • (Unit-type of (Attacking unit)) Equal to Civilian (Pistol)
          • (Unit-type of (Attacking unit)) Equal to Civilian (Pistol) (Hold Position)
    • Actions
      • Animation - Play (Attacking unit)'s Attack Work animation
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
Is is actually really hard to detect interaction with destructibles. There is no destructible is attacked/damaged event.
The one time I faced the same problem I used the eat tree ability to detect whenever a unit interacts with a destructible, but that's complicated and has some downsides as well.
The best solution is probably to directly change the models animation, but I have no idea how to do that.
 
Level 13
Joined
Oct 12, 2016
Messages
769
Wouldn't it be possible to just set the destructable's health to like, 1hp,
then detect when that specific destructable gets destroyed?
You could automatically "revive" the destructable, then select all units of type around the dying destructable matching a specific unit type to perform your actions (like "play picked unit's Attack Work animation")

The downside, this will pick all units around and will come after attacking... Eh, may not work for what you want.
 
Level 19
Joined
Apr 21, 2013
Messages
1,194
What about changing the desired tree to a unit? Whenever the tree is "attacked" (Here you can make the tree allied to the player so it won't be auto attacked, and give the player an ability similar to attack but the player will think it is gathering tree, and when they target the tree the unit will play whatever animation you want.) you'll trigger the results as well..
 
Level 7
Joined
Jan 23, 2011
Messages
350
Unit orders with a target
Issued order equals attack
Or
Issued order equals smart
Set id = Get Trigger Unit custom value
Set TargetUnit[id]=Target unit of issued order
Set TargetTree[id]=Target destructable of issued order

Unit attacks
Conditions whatevs
Actions
If TargetTree[id] != Null then
Play Anim
Endif

Didn't check on my PC, but should work
 
Level 11
Joined
Jun 2, 2004
Messages
849
I'm pretty sure that the attack order only happens once, not on every swing. For the custom attack animation to work the way they want, they need to be able to get every swing.


At this point I think the only option is to edit the model(s). All that needs to be changed is where the animation strings point.
 
Level 7
Joined
Jan 23, 2011
Messages
350
Of course it happens once. But TargetTree[id] will maintain its value if you don't make a new order.
But know that i think off, you have the delay from the swing, you can use a timer to play the animation later, with some safety check for cancels from the attacker. Really complicated for some animations

I think your half right, edit the models is not the only option, but it is the Best option
 
Status
Not open for further replies.
Top