Jump to content

[SOUND] Coding help


Recommended Posts

I am just going to take a guess, but I am guessing your fsb path structure is either not made properly or you are not calling the correct path.

The path is project/eventgroup/event you'll see the path at the top when you click on one of your simple events in fmod.

This path is also what you want to call in game.

 

Link to comment
Share on other sites

I have made it like you said. The path is "mosin/gunshot/mosinfire" and I placed it in modmain.lua and weapon.lua in Assets as:   

Asset( "SOUND", "mosin/gunshot/mosinfire" )

and it crashed.

When I have tried with:

Asset( "SOUND", "mosin/gunshot/mosinfire.fsb" ), and Asset( "SOUND", "mosin/gunshot/mosinfire.fev" )
it had crashed too.

It can't hear sound in game or it just crashes.

I attach mosin.fdp just in case.

mosin.fdp

Edited by Yakuzashi
update
Link to comment
Share on other sites

The path I meant is for the Soundemitter not the Asset

    Asset("SOUNDPACKAGE", "sound/mosin.fev"),
    Asset("SOUND", "sound/mosin.fsb"),

inst.SoundEmitter:PlaySound("mosin/gunshot/mosinfire")

Assets should be where assets are defined either in the prefab files or modmain.

Link to comment
Share on other sites

Seeing as the sound is originating from the weapon but I am not sure, if sound emitters in inventories work.

Maybe try making it owner.SoundEmitter instead.

Also is there any functional difference between your identical functions?

I'll check it out later, when I get some spare time.

Link to comment
Share on other sites

Thank you. If you mean onattack_gun and mosinfire functions, the first one is to play sound when bullet hits and the second one is for gunshot sound. I have used the same sound for both as an indicator in case I screwed something up. Owner instead of entity didn't work too.

Edited by Yakuzashi
last sentence
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...