3rd Party Models/Media Chat / weapon with multiple sounds

Author
Message
Disturbing 13
3D Media Maker
19
Years of Service
User Offline
Joined: 12th Apr 2005
Location: Murder Capital of the World
Posted: 18th Jun 2016 00:00
Has anybody looked into making a weapon that randomly chooses maybe 1 of a few sounds to play when it fires? This way every time you press the left mouse button a random sound plays. Should I look more into a scripted object that detects a left mouse button press instead with the random sound option? Any help would be great.
Wolf
Forum Support
17
Years of Service
User Offline
Joined: 8th Nov 2007
Location: Luxemburg
Posted: 26th Jun 2016 02:59
While I was looking into the default colt I have noticed that it comes with 4 different fire sounds but only references one in the gunspec.

Have you tried just naming the additional sounds fire2, fire3 etc. ?



-Wolf
"When I contradict myself, I am telling the truth"
"absurdity has become necessity"
PartTimeCoder
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location:
Posted: 26th Jun 2016 12:49
correct me if I am wrong I'm no firearms expert, but surly physics dictates that a certain weapon loaded with a particular ammo is only ever going to make the same sound its only the surrounding acoustics that would effect the tone, what would be good however is to be able to make the gun play fire sounds according to the current environment, outside would be just the gun crack as normal, indoors in a small environment the acoustics would soak up most of the sound and in a large environment it would have a bit of an echo ..... that would be awesome

it could be as easy as a Lua function called from a trigger zone to set the current gun sound set, outside, inside_small, inside_large, underground ETC it would be a lot more realistic and flexible this way
PM
Disturbing 13
3D Media Maker
19
Years of Service
User Offline
Joined: 12th Apr 2005
Location: Murder Capital of the World
Posted: 26th Jun 2016 15:29
Quote: "a particular ammo is only ever going to make the same sound"


You are correct, but the weapon I am making is no gun. It is a weapon only in the sense of its function in a videogame. Sorry to be so cryptic but the uniqueness of the game depends on this function and the project is nowhere near ready to release a wip or info on.

Quote: "Have you tried just naming the additional sounds fire2, fire3 etc."

I have not but I will give it a try. My other option is to have a script running that detects a left mouse button press and randomly plays one of ten sounds. Too bad I don't script.
Disturbing 13
3D Media Maker
19
Years of Service
User Offline
Joined: 12th Apr 2005
Location: Murder Capital of the World
Posted: 27th Jun 2016 08:03
Update- I have tried replacing the multiple sounds within the weapon to no avail. Looks like I will need to go the scripting route.
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 27th Jun 2016 10:39
Quote: "While I was looking into the default colt I have noticed that it comes with 4 different fire sounds but only references one in the gunspec.

Have you tried just naming the additional sounds fire2, fire3 etc. ?"


The sound slots in guns are for different actions, which are linked to animation steps.

Foe example the colt911's set is:

Sound0: zoom
Sound1: fire
Sound2: reload
Sound3: dry fire
Sound4: put away
Sound5: retrieve


they are configured in the HUD sound frames list, for example:

sframe1 = 11,5

That is telling it to play sound1 when the gun animates frame 11, not sure what the 5 is, I have a feeling it's from frame 11 for 5 frames, but i'm not sure.




i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
Errant AI
Forum Support
18
Years of Service
User Offline
Joined: 24th Aug 2006
Location: [REDACTED]
Posted: 27th Jun 2016 20:00 Edited at: 27th Jun 2016 20:08
Belidos has the right general idea.

My suggestion would be to have your default, engine-called fire.ogg be an essentially blank audio file (removing it completely may create problems)...

Then, specify your custom alternate sounds in gunspec as sound7,8,etc. (don't use any of the reserved slots Belidos mentioned above).

You can then tie the sound to an animation frame... In the sframe1 = 11,5 example, 11 is the frame and 5 is the sound ID.

Now, to make this all work you need to duplicate your fire animations three times (maximum) in your animation timeline and then specify as start fire, start fire2, start fire3, etc.

GG will automatically randomize between these animations each time the weapon is used (mostly useful for melee weapons) and by extension, also randomize between your linked sound calls.

The only foreseeable downside to this method is that if an enemy has the weapon it will likely make no sound when attacking but if it's for the player only there generally should be no problem unless framerate is really fluctuating and causing frames to be skipped. Multiplayer would probably not work either.

Example relevant bits using a lightsaber weapon (and totally unrelated anim ranges yanked from one of my weapons):

;strike vector 3
start fire = 240,244
end fire = 245,249

;strike vector 6
start fire 2 = 260,264
end fire 2 = 265,269

;strike vector 5
start fire 3 = 280,284
end fire 3 = 285,289

...

sound7 = woosh1.ogg
sound8 = woosh2.ogg
sound9 = woosh3.ogg

...

sframe4 = 241,7
sframe5 = 261,8
sframe6 = 281,9


That should give you the general idea. It would allow for 3 randomized attack animations with a different sound for each one.
Gigabyte P67A-UD4-B3, Intel Core i7 2600K (passmark 8555), 16GB Corsair DDR3, EVGA GTX 970 SC (passmark 8637), Win7 Pro 64-bit SP1, Primary monitor @ 1920x1080, secondary monitor @ 1024x1280
Disturbing 13
3D Media Maker
19
Years of Service
User Offline
Joined: 12th Apr 2005
Location: Murder Capital of the World
Posted: 28th Jun 2016 20:06
Greetings EAI! Thanks for the info; this will definitely help with some of my other weapons, especially melee weapons, but this 'weapon' is rather unconventional and pretty much only good for this game. Smallg came up with a scripting solution that works splendidly. I'm so looking forward to seeing what awesome new content you may bring to GG! Again, Thanks for the info!

Login to post a reply

Server time is: 2024-11-22 09:29:52
Your offset time is: 2024-11-22 09:29:52