Jump to content

[Solved] Randomize Scanner Audio?


OJS

Recommended Posts

So, I was wondering if it would be possible to randomize the Scanner Audio for a callout? You know like different combinations of the audio files rather than one for every time? Here is what I was thinking:

 

Mostly I want to do this for the Response Code part of the Scanner Audio since I noticed there are these files for Response Codes:

 

  • UNITS_RESPOND_CODE_02_01.wav
  • UNITS_RESPOND_CODE_02_02.wav
  • UNITS_RESPOND_CODE_03_01.wav
  • UNITS_RESPOND_CODE_03_02.wav
  • UNITS_RESPOND_CODE_99_01.wav
  • UNITS_RESPOND_CODE_99_02.wav
  • UNITS_RESPOND_CODE_99_03.wav

 

I was thinking I might be able to randomize the audio files played by doing this:

 

private readonly String[] ResponseCodes = new String[] { "UNITS_RESPOND_CODE_03_01", "UNITS_RESPOND_CODE_03_02" }; // A list of possible "said" response codes.
private String ChosenResponseCode; // Assigned later.
private readonly Random rnd = new Random(); // A new random (used later).

ChosenResponseCode = ResponseCodes[rnd.Next(ResponseCodes.Length)]; // Chooses random string from "ResponseCodes" String Array.
Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_GRAND_THEFT_AUTO IN_OR_ON_POSITION" + ChosenResponseCode, SVLCGSDSpawnPoint); // Plays the scanner audio.

Would this be a good way of handling this? Or is there a simpler way of doing this? Can LSPDFR Figure out which file it is or choose a random files if I only put in "UNITS_RESPOND_CODE_03" or do I need to specify?

 

Thanks in advanced,

- Johnny Shumway

Edited by OfficerJohnnyShumway
Question has been solved.
Link to comment
Share on other sites

10 hours ago, OfficerJohnnyShumway said:

So, I was wondering if it would be possible to randomize the Scanner Audio for a callout? You know like different combinations of the audio files rather than one for every time?

 

 

As far as i know LSPDFR is randomizing the files itself.

 

By using this for the string "UNITS_RESPOND_CODE_02", lspdfr will choose "_01" or "_02" to randomize these files. (as soon  as you have "UNITS_RESPOND_CODE_02_02.wav"

)
No need to write your own speech randomizer.

Edited by ziipzaaapM16A4

Take a look at my Plugins:

AmbientAICallouts: Ai get calls too. Callouts can turn into a backup request for the player [YouTube Link]

Search Vehicle Plugin: Simple and more Immersive Vehicle Search Plugin [YouTube Link]

What Was You Name Again?: Get the name of a Suspect even when arrested and placed in your Vehicle [YouTube Link]
Corpse Inspection:  Investigate the corpse. Interact and search for details in a more Cinematic way  [YouTube Link]
[WIP] EnvoirementalCallouts: A couple of Callouts and WorldEvents that are likely to happen to you while you're on duty [Youtube Link]

[OnHold] EMS Support: Be the First Responder of Medical Emergency's and do CPR on Patients [YouTube Link]

 

spacer.png

Checkout my Patreon for Early Access to my mods                                       checkout my Discord Server

Link to comment
Share on other sites

13 hours ago, ziipzaaapM16A4 said:

 

 

As far as i know LSPDFR is randomizing the files itself.

 

By using this for the string "UNITS_RESPOND_CODE_02", lspdfr will choose "_01" or "_02" to randomize these files. (as soon  as you have "UNITS_RESPOND_CODE_02_02.wav"

)
No need to write your own speech randomizer.

Thank you so much!

Link to comment
Share on other sites

  • The title was changed to [Solved] Randomize Scanner Audio?

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...