• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Get Last Played Animation

Status
Not open for further replies.

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
Hello!

I'm putting this in request as there might not be a system like this one out there yet!

I'm making a system that plays a sound each time a unit attacks (A unit takes damage.)
This system plays different attack sounds depending on the "weapon" the damaging unit has.

Why not use the object editor and the default attack sounds?
It is not possible to change a unit's attack sound ingame via triggers (as far as I'm concerned?)

What does this all lead to?
In my map you can pick up different weapons such as an axe, sword, hammer etc. Each weapon has an attatchment model. I'm making the attack sounds different for each weapon. A unit can dual wield weapons in which case I need to track which animation was the last animation that the damaging unit played to determine if the weapon sound for the right hand or the left hand should be played.

To conclude
I need some kind of system that tells me which animation a unit intends to play or JUST played so that I can track if I should play the right hand attack sound or the left hand attack sound. Animation is being runned before dealing damage so refering to Last Animation Played within a Unit Takes Damage event such as the one produced by Bribes Damage System should work. I just need a good way of checking which animation was played.

Any help results in +4 rep! I want to say thanks to this awesome community that has helped me to solve these kinds of problems over my years with the map editor, you are all truly awesome! :)
 
Level 25
Joined
May 11, 2007
Messages
4,650
Orbs and Slow Posion and some other passive abilites do show a model effect on hit on a unit. What you could do would be to create custom effect models, attach the sound you want on hit to it.
Then create a custom slow posion / orb / whatevs ability for your weapons and set the target model to your custom model.
Voilá! Custom onhit that changes ingame.

For your dual wielding however... Try this?
You could just detect when the unit does an attack and then play one of the attack animations yourself, I don't think that stops the damage of the attack. "A unit is attacked, random int == 1 play animation attack 1 else play animation 2"

Otherwise if you intend to try and find the current animation, this might be useful (I did a simple Google):
Detect unit's current animation
 

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
@LordDz Hello there and thank you for being so helpful!
The orb idea is splendid! You are a genius!

As for dual wielding I'm already using a system that changes which animations the unit should be playing when attacking depending on the weapon equipped but perhaps I could develop a second system that interrupts the current animation and reapplies it's own so that I know for sure which animation is being played and then that way I can trigger the correct sound. It's quite a big workaround and I'm not sure how the animation part of it will work but it might be a solution to my problem.

I will keep the thread open to see if anyone else has a better suggestion, I'm still a couple of days before hitting this stage of the developing process.

EDIT: Some animations deals damage about 0.3 seconds into the animation though, with the Unit Takes Damage event they would essencially deal damage at the start of the animation, does anyone know about a potential workaround for this?
EDIT2: Just figured out, I can use "Starts attacking a unit" to apply animation and "Takes Damage" for the sound, it should work (hopefully!)
 
Last edited:
Status
Not open for further replies.
Top