How can I play a specific sound effect from the games files?
-
I recently scripted a fully functioning drilling deposit boxes segment in my mod, now all I need to do is play the sound effects for the drill. I can't seem to get it working though so I came here to ask for help on what I am doing wrong.
Here is my sfx code:
Function.Call(Hash.REQUEST_SCRIPT_AUDIO_BANK, "CASINO_HEIST_FINALE_GENERAL_01", 1);
Function.Call(Hash.PLAY_SOUND_FROM_ENTITY, -1, "DRILL_POWER_UP", Game.Player.Character, "CASINO_HEIST_FINALE_GENERAL_01", 1);Besides that I also need to figure out how to make the sparks come out of the deposit box when you are drilling but once again I have no clue.
If anyone could help I would appreciate it.
-
@M8T You should take a look at the decompiled scripts. This is how Rockstar requests that specific audio bank in the casino heist script
AUDIO::REQUEST_SCRIPT_AUDIO_BANK("DLC_HEIST3/CASINO_HEIST_FINALE_GENERAL_01", false, -1)
, maybe that's why it's not working for you.
-
@JustDancePC Hi, I check the decompiled scripts earlier today and requested the Audio_Bank using that method, though it did not work. I made a workaround and I am using other sound effects though.
-
@M8T Probably because you have to wait until the audio bank actually loaded instead of trying to play the audio instantly, just like when you try to spawn an entity, you have to load the model first.
The
REQUEST_SCRIPT_AUDIO_BANK
function returns a bool, MAYBE that bool indicates if it's done loading or not.