• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Change unit attack sound?

Status
Not open for further replies.

Sverkerman

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

I'm wondering if it is possible to change a unit's attack sound (Slash, Bash etc.) with triggers? For an example if my unit picks up a sword he will have a Slash sound but if he picks up a hammer he will have a Bash sound.
Thanks! :)

+ rep to all helpers ;)
 
@Kaijyuu That is actually a rather good idea. I have a damage detection system that I am using, so setting the attack sound to an empty sound file and then adding it manually might actually be a very good idea :) Thanks!
However, is there any way of doing this with triggers? I'm imagining "Change unit's attack sound to XXX" ?

Thanks ;)
 
@Kaijyuu That is actually a rather good idea. I have a damage detection system that I am using, so setting the attack sound to an empty sound file and then adding it manually might actually be a very good idea :) Thanks!
Yeah the damage system gives you the moment to play the sound. I would recomment using an 0 damage action with the jass damageunit function, this will reduce your part to do to:
save current combatsound onto your hero
use saved one in the damage event trigger.​
JASS:
native UnitDamageTarget  takes unit whichUnit, widget target, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType returns boolean

With values
JASS:
  call UnitDamageTarget(udg_Target, udg_Target, 0 , true, true, null, null, udg_WeaponSound)

Damage Engine
  • Hit Play Sound
    • Events
      • Game - AfterDamageEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventSource is A Hero) Equal to True
      • IsDamageSpell Equal to False
    • Actions
      • Trigger - Turn off (This trigger)
      • Set Index = (Custom value of DamageEventSource)
      • Custom script: call UnitDamageTarget(udg_DamageEventTarget, udg_DamageEventTarget, 0 , true, true, null, null, udg_CombatSound[udg_Index])
      • Trigger - Turn on (This trigger)
 
Last edited:
@Tasyen Thank you again Tasyen! You are a real friend!
Very good information, I'm impressed that you knew with such precision exactly what I was asking for :)

Unfortunately the problem is a bit more complex than that. I've further explained my problem here if you'd be interested in having a look. It comes down to GetLastAnimation, atleast the way I'm seeing myself solving this for now.

Get Last Played Animation
 
Status
Not open for further replies.
Back
Top