Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

*DO NOT* SHARE MEDIA OR LINKS TO LEAKED COPYRIGHTED MATERIAL. Discussion is allowed.

wav files


deltadude
 Share

Recommended Posts

I am trying to get a wav file to play (sound_security_alarm) when CJ walks into a marker. here is my code can u help me

 

 

 

:WAV03A4: name_thread 'WAVI'0001: wait $default_wait_time ms00D6: if  000FF: actor $PLAYER_ACTOR  0 ()near_point_on_foot  2263.559 -1260.789 23.97656 radius  2.0  2.0  2.0004D: jump_if_false ££WAV03CF: load_wav  42801 as  103D1: play_wav  1004E: end_thread

 

 

any help is much apreciated

Link to comment
Share on other sites

That's not how the original code did it. Do it the way the original code did it. This will include a loop to see if the wav is loaded before you play it. Also, you're limited to WAVs the game came with or ones named just like them.
Link to comment
Share on other sites

Ok i changed the coding to match some coding I found ingame and it froze after the cutscene at the start of a new game.

 

 

:audio003A4: name_thread 'audio'00D6: if  000FF:   actor $PLAYER_ACTOR  0 ()near_point_on_foot  2263.559  -1260.789  23.97656 radius  2.0  2.0  2.0004D: jump_if_false ££audio0:audio03CF: load_wav  42801 as  1:audio200D6: if  083D0:   NOT   wav  1 loaded004D: jump_if_false ££audio20001: wait  0 ms00D6: if  08256:   NOT   player $PLAYER_CHAR defined004D: jump_if_false ££audio30002: jump ££audio4:audio30002: jump ££audio2:audio403D1: play_wav  1004E: end_thread

 

 

Any ideas why?

Link to comment
Share on other sites

All loops require a wait command, even if it's 0 milliseconds.

 

Whenever there's an if statement that could loop back on itself, insert a wait command before it.

 

Also, your audio2 label is going to loop ONLY when the wav is loaded, completely defeating the point of the whole loading process. Change that to the normal wav_loaded opcode.

 

Same deal with the player defined check.

 

Just out of interest, are you able to actually read the code and follow the path it could take? Because if you can't troubleshoot basic things like this on your own you're going to have a lot of problems with scripting.

Link to comment
Share on other sites

Thanks, I can see where the code is going etc. It was just stupid mistake by me that i didn't see some of the errors in it.

 

 

Link to comment
Share on other sites

Thanks, I can see where the code is going etc. It was just stupid mistake by me that i didn't see some of the errors in it.

Yeah, we all run into that. But when it's crashing that's when it's time to take a closer look at it. I'll try and help you grasp the path a bit better. Here's the way your code should look. It contains OP's suggestions and a few of my own. Can you spot the differences? Do you understand why? If not, just ask colgate.gif

 

 

:audio03A4: name_thread 'audio':audio10001: wait  250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££audio100D6: if  000FF:   actor $PLAYER_ACTOR  0 ()near_point_on_foot  2263.559  -1260.789  23.97656 radius  2.0  2.0  2.0004D: jump_if_false ££audio103CF: load_wav  42801 as  1:audio20001: wait  0 ms00D6: if  003D0:   wav  1 loaded004D: jump_if_false ££audio203D1: play_wav  1004E: end_thread

 

Link to comment
Share on other sites

I already made one that works for me, without the player defined op code.

It ain't as complexe, but it will work for me smile.gif

(i added the unload_wav in because I was afraid without it, the game would crash....)

 

 

:AUDIO_103A4: name_thread 'AUDIO'00D6: if  000FF:   actor $PLAYER_ACTOR  0 ()near_point_on_foot  2239.094 -1264.577  24.24618 radius  2.0  2.0  2.00001: wait  0 ms004D: jump_if_false ££AUDIO_103CF: load_wav  1155 as  1:AUDIO_700D6: if  083D0:   NOT   wav  1 loaded004D: jump_if_false ££AUDIO_120001: wait  0 ms0002: jump ££AUDIO_7:AUDIO_1203D1: play_wav  1040D: unload_wav  1004E: end_thread

 

 

I know I can make it better but i'm gonna try some other cool things with coding etc.

Edited by deltadude
Link to comment
Share on other sites

I already made one that works for me, without the player defined op code.

Doesn't mean it's right. And the player defined check wasn't all that I did. For one, you'll notice that my if loaded check is cleaner, etc.

 

Your code loops the name thread command, you have a wait inside an if... Including the unload wav is a good idea, but if it's the only one you're going to employ, why bother?

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

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.