Home   Help Search Login Register  

Author Topic: Weapon sounds  (Read 2192 times)

0 Members and 1 Guest are viewing this topic.

Offline jphilapy

  • Members
  • *
  • I'm a llama!
Weapon sounds
« on: 30 Dec 2005, 21:53:04 »
Is it possible to add a custom weapon sound to a mission without requiring someone to download a seperate download? If so how?

Thanks,
Jeff

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:Weapon sounds
« Reply #1 on: 30 Dec 2005, 22:15:37 »
You can use playSound command in a fired event handler to play your desired sound file every time unit fires his weapon. You can also add a condition with if () then {} straight to the event handler so you can control when and where the sound is allowed to play. This way you can easily modify the sound of weapons and no addons are needed. I recommend you try it out. Do not start a script file from the fired event handler, that would cause unnecessary load for the computer. You can put all necessary commands straight into the event handler.

I did an example for this some time ago. If you have difficulties trying the method I described, I might find that example from somewhere but just now I don't have the time to look for it.

For sure there are some conditions needed for the event handler. For example to prevent the sound from playing when a grenade has been thrown etc... I'll try to post an example during the weekend if you don't figure it out first by yourself.
« Last Edit: 30 Dec 2005, 22:26:10 by Baddo »

Offline jphilapy

  • Members
  • *
  • I'm a llama!
Re:Weapon sounds
« Reply #2 on: 31 Dec 2005, 22:52:01 »
I would need an example of this, thx.

Jeff

You can use playSound command in a fired event handler to play your desired sound file every time unit fires his weapon. You can also add a condition with if () then {} straight to the event handler so you can control when and where the sound is allowed to play. This way you can easily modify the sound of weapons and no addons are needed. I recommend you try it out. Do not start a script file from the fired event handler, that would cause unnecessary load for the computer. You can put all necessary commands straight into the event handler.

I did an example for this some time ago. If you have difficulties trying the method I described, I might find that example from somewhere but just now I don't have the time to look for it.

For sure there are some conditions needed for the event handler. For example to prevent the sound from playing when a grenade has been thrown etc... I'll try to post an example during the weekend if you don't figure it out first by yourself.

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:Weapon sounds
« Reply #3 on: 02 Jan 2006, 16:36:08 »
I will give you an example as soon as possible. I have the old example but it needs to be modified (I left it in an uncompleted state last time I modified it)  until I can post it here, and I am a bit busy with other things. :P But I will post it here for sure.
« Last Edit: 02 Jan 2006, 21:21:32 by Baddo »

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:Weapon sounds
« Reply #4 on: 02 Jan 2006, 21:18:17 »
OK now there is an example mission attached. You need to have version 1.85 or newer for this to work. Look in init.sqs to find out how it works. A fired event handler plays a different sound for each firing mode. It is best that the commands are put into the event handler so we get minimal computer load. Do not start a script file from a fired event handler.

Note that the original weapon sound is still being played and the custom sound is played in addition to it.

Only tested in single player.
« Last Edit: 02 Jan 2006, 21:56:43 by Baddo »

Offline jphilapy

  • Members
  • *
  • I'm a llama!
Re:Weapon sounds
« Reply #5 on: 06 Jan 2006, 14:06:47 »
ok, will give it a try and will get back to you.

Thanks alot,
jeff

Offline jphilapy

  • Members
  • *
  • I'm a llama!
Re:Weapon sounds
« Reply #6 on: 10 Jan 2006, 03:18:00 »
Hi baddo,

Thanks greatly for providing this example. I played with the mission you provided. I am now going to try and implement my own sounds.  Just  another question, is it possible to change smoke and muzzle flash on guns without using an addon?

Also where do I find a .wss player or converter?

EDITED: I noticed that I can hear the sound only when I shoot my gun. However if anyone else shoots their gun it sounds like the old gun from my perspective, but from their perspective it uses the new sound.  And likewise my gun sounds like the old gun from their perspective.  Also I tried to change this by adding the script to each persons initialize field and commenting it out in the init field. No matter where the other person is on the map, when he fires the gun sounds like it is mine firing, not the person who is over 300 m from me. Any way around this?

Thanks for a great snippet.

Jeff
« Last Edit: 10 Jan 2006, 03:39:37 by jphilapy »

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:Weapon sounds
« Reply #7 on: 10 Jan 2006, 20:33:16 »
  • The muzzle flash would probably be very hard to do with scripting. Also the weapon smoke could be difficult. But you can drop particles like in scripts which create gas clouds, maybe that technique could be used to provide additional smoke for a weapon. Addon makers could know this better.
  • For WSS files there exists programs which do conversion to and from a WAV file:
WSS File Decoding/Encoding Utils

  • The problem you are describing is actually something what I was expecting to hear about, but was not absolutely sure of. The additional sound from your weapon is played only on your computer and others will not hear it, and vice versa. That is because I used player in init.sqs to have the event handler. But putting the event handler to each unit's initialization field replacing player with this would mean that the event handler is attached to all units (having the event handler in initialization field) on all computers in the session. Then the sound should be heard on every computer. I understand that you got this to work? The sound plays on all computers?

    But the sound is heard everywhere as loud as it were each player's own weapon? I am not sure but it could be that instead playSound you could use say to play the sound file, so the distance where the sound is heard would be limited. I am not sure if it could be done like that, but test it and you will see how it works.