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

[General] Making Sound played more than once

Status
Not open for further replies.
Level 6
Joined
Jan 2, 2015
Messages
171
Hi, i would like to make sound effect on my flamethrower to play everytime my unit attacks but the problem is my unit attack speed is 0.5 and sound limited to play once every 1 second. How do i solve this? I am using GUI and dont know how to use JASS like SoundTools..if its possible to mix gui trigger and jass trigger. i am okay with that. thanks
 
Level 6
Joined
Jan 2, 2015
Messages
171
Use a DDS, play the sound when unit takes damage from your unit type.
After 0.4 seconds make the played sound fade out.

If you know how to use variable shadowing, this can be done with three rows. (excluding events and conditions)

Could you explain further about this variable shadowing? i was thinking to make multiple sound array from number 1 to 10 that play same sound effects but i got no idea on how to make it play in right order like 1>2>3>4>...10.
 
there's alternative to Chaosy solution: no triggers
  1. for standard war3 unit: overwrite default sound by your custom sound in SoundEditor by "replace internal sound" command
  • for custom unit: overwrite default sound by your custom sound in SoundEditor by "replace internal sound" command for sound you are not using in your map, remember path, let it be PATH
  • open your model in War3 Model Editor, in Sequence Managed find attack, click edit, look at Interval From .. To values. Remember values. Choose one between min and max, let it be X.
  • Go to Node Manager: right click on empty area and use CreateEventObject, edit this new object: in EventTracks add one value (our: X), in EventData must be type:SND, Data: find your previosly replaced sound (PATH)
  • save and import do map
I did it that way in my campaing for Stalker unit who shoots laser with cool sound (from rail gun from quake):D
 
Level 6
Joined
Jan 2, 2015
Messages
171
That's the charm, you don't have to worry about that part.

The link given is a demonstration of how it works, not an actual system.

basically you do:
local sound udg_GuiVariable
play your sound
set GuiVariable = last played sound
wait 0.4 seconds
stop guiVariable, fade out

So you only use one custom script line.

Hi, i did as u said. but it seems new custom script gives me error.

Here's the action trigger:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DamageEventType Equal to 0
      • (Unit-type of DamageEventSource) Equal to Space Fel Orc
    • Then - Actions
      • Custom script: local sound udg_local_Sound = GetLastPlayedSound()
      • Sound - Play soundArray[51] at 100.00% volume, attached to DamageEventTarget
      • Set local_Sound = (Last played sound)
      • Wait 0.40 seconds
      • Sound - Stop local_Sound After fading
    • Else - Actions
 
Level 6
Joined
Jan 2, 2015
Messages
171
Put the custom script at the very top

Also, change "local sound udg_local_Sound = GetLastPlayedSound()" to "local sound udg_local_Sound"

It works! So i have like 5-10 different custom sound effect for combats. how do i make these 5-10 to works because if i set local_sound = last played sound..will it make game confuse? perhaps i should make local_sound array?
 
Level 6
Joined
Jan 2, 2015
Messages
171
It should work regardless.

play ANY sound
set variable = last played sound
wait 0.4
...

i tried to test if 2 same unit create sound on different time. it seems the sound was played by first unit who attack the target and second unit jst continue last played sound until it fades completely. was something went wrong or it was intended?
 
Level 6
Joined
Jan 2, 2015
Messages
171
It should work regardless.

play ANY sound
set variable = last played sound
wait 0.4
...

  • Custom script: local sound udg_local_Sound
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DamageEventType Equal to 0
      • (Unit-type of DamageEventSource) Equal to Space Fel Orc
    • Then - Actions
      • Sound - Play soundArray[51] at 100.00% volume, attached to DamageEventTarget
      • Set local_Sound = (Last played sound)
      • Wait 0.40 seconds
      • Sound - Stop local_Sound After fading
    • Else - Actions
i did as u said, its good for single unit but still problem if more than 1 unit using same sound effect..
 
Status
Not open for further replies.
Top