Jump to content

On-BeforeFunction Function Question


Kraezd

Recommended Posts

Hey all.

Love the great work contributed by so many. Just hoping for some guidance.

I am making a script to play an audio file of mine before the audio file requested by any given callout script would play.

I need help though. Is there any function that would help me do this? I'm thinking something on the lines of 'OnBeforeFunction'.

My guess as to how it would appear:

OnBeforeCalloutDisplayed() 
 - check if callout is in my list of what would be an emergency dispatch transmission.

OnBeforePlayScannerAudioUsingPosition
 - PlayScannerAudio("MY FILE THAT I PUT THE ALARM IN")

My vision is that when we have a callout like an officer shot, the dispatcher makes an emergency transmission on the radio. It would be an alarm tone followed by the dispatcher advising all units to respond immediately. 

Initially, I thought to edit the relevant audio files, however the range and shared use of audio files makes this not possible.

I am new to GTA V scripts, and to what LSPDFR has to offer in functionality, but I am appreciative of any help.

 

Cheers!

Edited by Kraezd
Link to comment
Share on other sites

Is this an issue solely with the Officer Shot callout, or is this for your own script?

As for playing the audio - I don't see why you couldn't play the scanner during OnBeforeCalloutsDisplayed().  I haven't tried that before though!

 

 

Link to comment
Share on other sites

9 hours ago, Kraezd said:

Hey all.

Love the great work contributed by so many. Just hoping for some guidance.

I am making a script to play an audio file of mine before the audio file requested by any given callout script would play.

I need help though. Is there any function that would help me do this? I'm thinking something on the lines of 'OnBeforeFunction'.


My guess as to how it would appear:

OnBeforeCalloutDisplayed() 
 - check if callout is in my list of what would be an emergency dispatch transmission.

OnBeforePlayScannerAudioUsingPosition
 - PlayScannerAudio("MY FILE THAT I PUT THE ALARM IN")

My vision is that when we have a callout like an officer shot, the dispatcher makes an emergency transmission on the radio. It would be an alarm tone followed by the dispatcher advising all units to respond immediately. 

Initially, I thought to edit the relevant audio files, however the range and shared use of audio files makes this not possible.

I am new to GTA V scripts, and to what LSPDFR has to offer in functionality, but I am appreciative of any help.

 

Cheers!

I don't really see the problem?  You can just add a Functions.PlayScannerAudio(youraudiofile) in the OnBeforeCalloutDisplayed override. 

My YouTube: Click here. 

My Discord Server - https://discord.gg/0taiZvBSiw5qGAXU

Useful post? Let me and others know by clicking the Like button.
Check out my many script modifications! 
Having issues? LSPDFR Troubleshooter by Albo1125.

Link to comment
Share on other sites

Thanks for the quick replies.

I will give it a shot with BeforeCalloutDisplayed and post an update...

I was just not sure if it would have a conflict playing audio (either overlapping with the callout audio or a delay) and it seemed more logical to call a function on the trigger of 'before the dispatch audio plays' as opposed to 'before you display the callout' but I will let you know!

Thanks @fiskey111 & @Albo1125

Link to comment
Share on other sites

The scanner only plays the first audio it gets to, unless it's finished by the time the next audio is set to play.  For instance, if you had this:

Functions.PlayScannerAudioUsingPosition("STUFF");
///

SOME

CODE

///

Functions.PlayScannerAudioUsingPosition("NEXT STUFF");

If the /// SOME CODE // doesn't take the length of time that "STUFF" would take (let's say 10 seconds) to play then the "NEXT STUFF" wouldn't play.  However, if the first takes enough time (as in the /// SOME CODE /// takes 15 seconds to run, 5 seconds over the length of "STUFF") then the second will play.

 

 

Link to comment
Share on other sites

Is there a way to tell when the scanner audiois done playing, like how you can wait until a task is finished? If not, that should be added to the API. 

[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

Link to comment
Share on other sites

3 minutes ago, PNWParksFan said:

Is there a way to tell when the scanner audiois done playing, like how you can wait until a task is finished? If not, that should be added to the API. 

Personally I just time the audio myself using all the pieces and make a new GameFiber that sleeps for that amount of time.  It's a bit annoying to do, but if you need to do that then that's the only option I know of (until it's added to the API)!

 

 

Link to comment
Share on other sites

3 minutes ago, fiskey111 said:

Personally I just time the audio myself using all the pieces and make a new GameFiber that sleeps for that amount of time.  It's a bit annoying to do, but if you need to do that then that's the only option I know of (until it's added to the API)!

It would be nice if the play scanner function took a bool for whether to play it after the current audio is done. And if it had a wait until finished method. 

@LMS any chance this could be implemented in the next API update?

Edited by PNWParksFan

[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...