Jump to content
Wkboy714

Minor Edit to Siren Script

Recommended Posts

Edit: Never mind, I've figured it out. Thread is redundant.

 

Hello all,

 

I understand that the default LA Siren script chooses randomly between two siren files to play when activating the siren script. For my private mod, I am trying to edit this so that it randomly chooses from three (or more) audio files. I imagine the edit to be a pretty simple one but I'm not sure what I need to change - I'm pretty new to scripting. I'd appreciate any help!

 

Am I thinking along the right lines with something like this?

                int random = Math::rand()%3;                if (random == 0)                {                      soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren01.wav", CarPos, true);                if (random == 1)                {                      soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren02.wav", CarPos, true);                } else                {                      soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren03.wav", CarPos, true);                }

Edit: So I tested that script and it works so far as choosing between the three of them. But the problem is if it chooses Siren01, the siren continues looping forever even after I turn the sirens off. Why?

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.
Note: Your post will require moderator approval before it will be visible.

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