Jump to content
Sign in to follow this  
swzssr

Multiple fire sounds for weapon like Arma's SoundBegin?

Recommended Posts

Hey guys

I've been a long-term OFP/CWA modder. I was wondering if there is a way to have multiple weapon sounds that change each gunshot like Arma II's SoundBegin setup?

Since OFP/CWA have multiple explosion/dammage sounds, I assume there is a way to do it? I assume the only way to do it would be to edit the main engines code, or make a script. I've tried the setup down below for a weapon fire sound, but CWA just chucks a spaz and won't work.

OFP/CWA runs this setup

sound[]={"\AK74SU\AK74SU_Fire.wss",1,1};

OFP Dammage/Hit sound setup

soundHit1[]={"\AK74SU\Sound\HitGround1.wss",db+5,1};

soundHit2[]={"\AK74SU\Sound\HitGround2.wss",db+5,1};

soundHit3[]={"\AK74SU\Sound\HitGround3.wss",db+5,1};

hitGround[]={"soundHit1",0.330000,"soundHit2",0.330000,"soundHit3",0.330000};

Arma II is this

begin1 = {"firearms\akm\Akm_single_0", 1.778279, 1, 1000};

begin2 = {"firearms\akm\Akm_single_1", 1.778279, 1, 1000};

begin3 = {"firearms\akm\Akm_single_2", 1.778279, 1, 1000};

soundBegin = {"begin1", 0.333330, "begin2", 0.333330, "begin2", 0.333330};

Share this post


Link to post
Share on other sites

Unfortunately no.There's no provision for that in CWA/OFP.

A scripted workaround,on the unit carrying the weapon,is the only option.

A small script or function would be run each time a fired event handler is triggered.

Then a random sound chosen from an array would be played.The sound wouldn't

emanate from the rifle itself though.But a trigger near the unit.

I'm not sure how that would function in a multi-player situation though.

_array = _this select 0
_unit = _array select 0
_weapon = _array select 1


?!(_weapon == "YourWeaponClass"):exit


_Fire = ["YourSounda","YourSoundb"]

_SoundSource = "EmptyDetector" createVehicle [0,0,0]

_SoundSource setpos [getpos _unit select 0,(getpos _unit select 1)+2,(getpos _unit select 2)+2]; 

_sound = random count _Fire

_sound = _sound - (_sound % 1)

_SoundSource say (_Fire select _sound)

~0.1

DeleteVehicle _Soundsource

In that script a trigger(emptydetector) is created at co-ordinates 0,0,0.

Then it's positioned near the unit's hands,roughly.A sound is randomly chosen

from the array(_fired) and played,from the location of the trigger.

Not very elegant.But then,I'm not really a scripter. :)

Edited by Maczer

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×