Results 1 to 13 of 13

Thread: Playing custom sounds using scripts

  1. #1
    Junior Member
    Join Date
    Jan 2018
    Posts
    2

    Playing custom sounds using scripts

    Hello everyone,

    it's so great to see a modding community for RtCW is still active. After playing the game for ages I finally decided to try out GTK Radiant myself. Running v1.4 as I had some issues with the later versions in Windows 10.

    I've just been playing around with simple test maps so far, trying out the various features. Right now I'm trying to figure out how to play a custom sound via a script.

    I placed a .wav file in <base>\Main\sound\my_sound.wav (the sound directory wasn't there so I created it).

    Then, for my map, called testmap, I set up a testmap.ai file in the maps directory.

    Code:
    player
    {
        trigger play_custom_sound
        {
            playsound sound/my_sound.wav
        }
    }
    In the map there's a target_script_trigger with a "target" value of "play_custom_sound", and an "ainame" with value "player". That target_script_trigger is linked to a trigger_multiple brush.

    As soon as I walk up to it, the game crashes immediately.

    I tried using some other command, e.g. "changelevel escape1 persistant" instead of "playsound", and it works just fine.

    Do the wav files need to be in a specific format? I'm clueless as to what's wrong here. Are there log files I can look at that contain information about the last crash?

    Thanks in advance,
    Marty

  2. #2

    Re: Playing custom sounds using scripts

    You could try running logfile 1 on level loading, the log file should be generated in your Main folder of your installation directory (if you are using iortcw, it would be in in Documents/RTCW/Main i believe).

  3. #3
    Senior Member WuTangH's Avatar
    Join Date
    Jan 2012
    Location
    Seas of cheese
    Posts
    140
    Most Recent Awards:

    Re: Playing custom sounds using scripts

    I've never setup ai stuff for RTCW so I hope I wont say something stupid, but I did make target_script_trigger few times in ET.
    I always gave it a scriptname (in your case with value "player").. and as every script, it should have a spawn stage, even if its blank.. like this:
    Code:
    player
    {
        spawn
        {
        }
        
        trigger play_custom_sound
        {
            playsound sound/my_sound.wav
        }
    }
    Then the game will run the target play_custom_sound, that is located in player script.

    Quote Originally Posted by marcinkonys View Post
    Do the wav files need to be in a specific format?
    I guess the wav file must be 22k mono.

    Anyway, errors and warnings from console or logfile are best way to find out whats wrong.

  4. #4
    #360NoscopeHeadshot ronboy's Avatar
    Join Date
    May 2010
    Location
    United States of America
    Posts
    1,455
    Most Recent Awards:

    Re: Playing custom sounds using scripts

    Quote Originally Posted by marcinkonys View Post
    Hello everyone,

    it's so great to see a modding community for RtCW is still active. After playing the game for ages I finally decided to try out GTK Radiant myself. Running v1.4 as I had some issues with the later versions in Windows 10.

    I've just been playing around with simple test maps so far, trying out the various features. Right now I'm trying to figure out how to play a custom sound via a script.

    I placed a .wav file in <base>\Main\sound\my_sound.wav (the sound directory wasn't there so I created it).

    Then, for my map, called testmap, I set up a testmap.ai file in the maps directory.

    Code:
    player
    {
        trigger play_custom_sound
        {
            playsound sound/my_sound.wav
        }
    }
    In the map there's a target_script_trigger with a "target" value of "play_custom_sound", and an "ainame" with value "player". That target_script_trigger is linked to a trigger_multiple brush.

    As soon as I walk up to it, the game crashes immediately.

    I tried using some other command, e.g. "changelevel escape1 persistant" instead of "playsound", and it works just fine.

    Do the wav files need to be in a specific format? I'm clueless as to what's wrong here. Are there log files I can look at that contain information about the last crash?

    Thanks in advance,
    Marty
    Hello, Marty, and welcome to Rtcw SP mapping. You say that it's great to see an active modding community, and while I agree with that, I also say that it's great to see another person who is interested in mapping for this amazing game.

    Regarding your problem, you could try the suggestion that WuTangH posted, but I personally use a target_relay, which is connected to a target_speaker, and then I call the target_relay via the AI script. It's simple but effective.

    By the way, you can find more community members here, which know more about Rtcw SP mapping: http://wolfmap.ru/forum/index.php?si...5b8a9f480180b6

    This forum is in the Russian language, but an English option is available to those who register there. I've been at this forum since 2011, so I highly recommend it, especially if you want to get into Rtcw SP mapping.

    One more thing: I highly recommend Gtk Radiant 1.2.11 for Rtcw SP mapping, as the newer versions of Gtk Radiant rely only on Q3map2, which has the nasty "shader overflow bug", which you'll see eventually if you create large/detailed maps. For MP mapping, the newer versions are fine, but for SP mapping, I would go with this old version. You can download it here: https://icculus.org/gtkradiant/downloads/1.2/


    RTCW SP Mapper

    My website:
    http://mikebwolf.wix.com/ronboyproductions

    Blogspot site with reviews of recent Rtcw Sp Maps: http://ronboyreviews.blogspot.com/

    My Mod DB page

    My playthroughs on Youtube

  5. #5
    Junior Member
    Join Date
    Jan 2018
    Posts
    2

    Re: Playing custom sounds using scripts

    Quote Originally Posted by ryven View Post
    You could try running logfile 1 on level loading, the log file should be generated in your Main folder of your installation directory (if you are using iortcw, it would be in in Documents/RTCW/Main i believe).
    This is definitely come in handy, thanks! Unfortunately in this instance, it crashes without anything extra printed to the log :-(

    Code:
    UI menu load time = 2 milli seconds
    CL_InitCGame:  1.92 seconds
    4 msec to draw all images
    Com_TouchMemory: 0 msec
    ----- Client Shutdown (Received signal 11) -----
    RE_Shutdown( 1 )
    OpenAL capture device closed.
    -----------------------
    ----- Server Shutdown (Received signal 11) -----
    AAS shutdown.
    forcefully unloading qagame vm
    ---------------------------
    Quote Originally Posted by WuTangH View Post
    *snip*
    Thanks WuTangH. I tried adding the extra section under "player", but it didn't help.

    Interestingly the sound does play if I use play in the console, e.g. play sounds/my_custom_sound.wav.
    I tried using Audacity to update the WAV to 22k mono and it plays really slowly and with this static noise in the background. Guess I'm not using Audacity correctly, time to look up some tutorials :-)

    Quote Originally Posted by ronboy View Post
    Hello, Marty, and welcome to Rtcw SP mapping. You say that it's great to see an active modding community, and while I agree with that, I also say that it's great to see another person who is interested in mapping for this amazing game.
    Thanks!

    Quote Originally Posted by ronboy View Post
    Regarding your problem, you could try the suggestion that WuTangH posted, but I personally use a target_relay, which is connected to a target_speaker, and then I call the target_relay via the AI script. It's simple but effective.

    By the way, you can find more community members here, which know more about Rtcw SP mapping: http://wolfmap.ru/forum/index.php?si...5b8a9f480180b6

    This forum is in the Russian language, but an English option is available to those who register there. I've been at this forum since 2011, so I highly recommend it, especially if you want to get into Rtcw SP mapping.

    One more thing: I highly recommend Gtk Radiant 1.2.11 for Rtcw SP mapping, as the newer versions of Gtk Radiant rely only on Q3map2, which has the nasty "shader overflow bug", which you'll see eventually if you create large/detailed maps. For MP mapping, the newer versions are fine, but for SP mapping, I would go with this old version. You can download it here: https://icculus.org/gtkradiant/downloads/1.2/
    Gotcha, I'll download an older GTKRadiant asap. I haven't tried your suggestion regarding target_relay yet, but I'll update this thread once I do. You'd think that either way would work though. I mean I can clearly see it enters the trigger section in the script. I looked at some of the original .script and .ai files in pak0 and all the usages of playsound I've seen were under entities other than player. Wonder if that makes a difference. Another thing to try out tomorrow when I'm back to modding :-)

    And yes I noticed that forum a few days ago! Didn't immediately register as I noticed it was Russian and I have only veeery basic knowledge of it. Will need to go back and sign up now if you're saying it has more activity than the Warchest forums.

  6. #6

    Re: Playing custom sounds using scripts

    Quote Originally Posted by ronboy View Post
    ... recommend Gtk Radiant 1.2.11 for Rtcw SP mapping, as the newer versions of Gtk Radiant rely only on Q3map2, which has the nasty "shader overflow bug", which you'll see eventually if you create large/detailed maps. For MP mapping, the newer versions are fine, but for SP mapping, I would go with this old version. You can download it here: https://icculus.org/gtkradiant/downloads/1.2/
    Thx for dl link, but when I get 1.2 it comes with q3map2 (not q3map1). Perhaps I did something wrong. I really want to test that trick (to use the original q3map1) to fight the shader overflow bug. does anyone know where to get q3map1 (not 2)?
    YouTube | Twitch | Homepage | Twitter | Facebook

    Operating System: Windows 10 Home 64-bit
    . Processor: Intel i7-2600 CPU @ 3.4 GHz (8 CPUs). Memory and graphics: 12Gb RAM, NVIDIA GeForce GTX 970. Resolution and sound: 1920 x 1080 (16:9), Realtek Audio.

  7. #7
    #360NoscopeHeadshot ronboy's Avatar
    Join Date
    May 2010
    Location
    United States of America
    Posts
    1,455
    Most Recent Awards:

    Re: Playing custom sounds using scripts

    Quote Originally Posted by marcinkonys View Post
    Gotcha, I'll download an older GTKRadiant asap. I haven't tried your suggestion regarding target_relay yet, but I'll update this thread once I do. You'd think that either way would work though. I mean I can clearly see it enters the trigger section in the script. I looked at some of the original .script and .ai files in pak0 and all the usages of playsound I've seen were under entities other than player. Wonder if that makes a difference. Another thing to try out tomorrow when I'm back to modding :-)

    And yes I noticed that forum a few days ago! Didn't immediately register as I noticed it was Russian and I have only veeery basic knowledge of it. Will need to go back and sign up now if you're saying it has more activity than the Warchest forums.
    Yes, there are multiple ways to set up some entities, but not all of them. About the Russian Wolf's Lair Forums, I saw that you registered there. It's indeed more active than this forum, as far as Rtcw is concerned. As I said, you can change the forum's language to English. Let me know if you need any help.

    Quote Originally Posted by Loffy View Post
    Thx for dl link, but when I get 1.2 it comes with q3map2 (not q3map1). Perhaps I did something wrong. I really want to test that trick (to use the original q3map1) to fight the shader overflow bug. does anyone know where to get q3map1 (not 2)?
    Did you get the version 1.2.11? It should have the old Q3map compiler bundled with it.


    RTCW SP Mapper

    My website:
    http://mikebwolf.wix.com/ronboyproductions

    Blogspot site with reviews of recent Rtcw Sp Maps: http://ronboyreviews.blogspot.com/

    My Mod DB page

    My playthroughs on Youtube

  8. #8

    Re: Playing custom sounds using scripts

    I got the 1.2.11 but failed to find it. Attaching screenshot.
    1211-w-q3map2.jpg
    But it is not a real problem for me personally anymore, because I am sometimes too lazy to wait/optimize... so I just moved on, i.e. I split the map into two smaller maps (to reduce the number of shaders, and reducing the risk for that dreaded overflow bug). Mapping is fun!
    YouTube | Twitch | Homepage | Twitter | Facebook

    Operating System: Windows 10 Home 64-bit
    . Processor: Intel i7-2600 CPU @ 3.4 GHz (8 CPUs). Memory and graphics: 12Gb RAM, NVIDIA GeForce GTX 970. Resolution and sound: 1920 x 1080 (16:9), Realtek Audio.

  9. #9

    Re: Playing custom sounds using scripts

    Quote Originally Posted by Loffy View Post
    I got the 1.2.11 but failed to find it. Attaching screenshot.
    1211-w-q3map2.jpg
    But it is not a real problem for me personally anymore, because I am sometimes too lazy to wait/optimize... so I just moved on, i.e. I split the map into two smaller maps (to reduce the number of shaders, and reducing the risk for that dreaded overflow bug). Mapping is fun!

    This has tools you need http://www.moddb.com/mods/rtcw-class...ting-tools-v11

  10. #10

    Re: Playing custom sounds using scripts

    thx ryven, you were right --- there is a Q3map version from 2001-10-22 in that download (in the file "din_nt".
    YouTube | Twitch | Homepage | Twitter | Facebook

    Operating System: Windows 10 Home 64-bit
    . Processor: Intel i7-2600 CPU @ 3.4 GHz (8 CPUs). Memory and graphics: 12Gb RAM, NVIDIA GeForce GTX 970. Resolution and sound: 1920 x 1080 (16:9), Realtek Audio.

  11. #11
    #360NoscopeHeadshot ronboy's Avatar
    Join Date
    May 2010
    Location
    United States of America
    Posts
    1,455
    Most Recent Awards:

    Re: Playing custom sounds using scripts

    Quote Originally Posted by Loffy View Post
    I got the 1.2.11 but failed to find it. Attaching screenshot.
    1211-w-q3map2.jpg
    But it is not a real problem for me personally anymore, because I am sometimes too lazy to wait/optimize... so I just moved on, i.e. I split the map into two smaller maps (to reduce the number of shaders, and reducing the risk for that dreaded overflow bug). Mapping is fun!
    That's strange, because when I downloaded Gtk Radiant 1.2.11, the original Q3map was included along with Q3map2. However, I did download it from another location, so perhaps the download was different. It's been over a year since I downloaded it, so I can't remember where I got it from.

    I recall that you made a small test map for Rtcw SP a few years ago. Why not work on a small project sometime? The game is still alive, if you didn't know.

    Quote Originally Posted by ryven View Post
    Thanks for the link!


    RTCW SP Mapper

    My website:
    http://mikebwolf.wix.com/ronboyproductions

    Blogspot site with reviews of recent Rtcw Sp Maps: http://ronboyreviews.blogspot.com/

    My Mod DB page

    My playthroughs on Youtube

  12. #12

    Re: Playing custom sounds using scripts

    yeah, I got a multiple maps/levels RTCW single-player adventure coming (nothing fancy), but it is some weeks/months into the future due to, well, you guys know, rl :-)
    Also working on a Wolf:ET map for that trackbase competition.
    The best of times
    YouTube | Twitch | Homepage | Twitter | Facebook

    Operating System: Windows 10 Home 64-bit
    . Processor: Intel i7-2600 CPU @ 3.4 GHz (8 CPUs). Memory and graphics: 12Gb RAM, NVIDIA GeForce GTX 970. Resolution and sound: 1920 x 1080 (16:9), Realtek Audio.

  13. #13
    #360NoscopeHeadshot ronboy's Avatar
    Join Date
    May 2010
    Location
    United States of America
    Posts
    1,455
    Most Recent Awards:

    Re: Playing custom sounds using scripts

    Quote Originally Posted by Loffy View Post
    yeah, I got a multiple maps/levels RTCW single-player adventure coming (nothing fancy), but it is some weeks/months into the future due to, well, you guys know, rl :-)
    Also working on a Wolf:ET map for that trackbase competition.
    The best of times
    Great news, I honestly didn't expect you to be working on a project for Rtcw SP.

    I highly recommend that you post your work here, once it's ready, for public testing: http://wolfmap.ru/forum/index.php?si...5b8a9f480180b6


    RTCW SP Mapper

    My website:
    http://mikebwolf.wix.com/ronboyproductions

    Blogspot site with reviews of recent Rtcw Sp Maps: http://ronboyreviews.blogspot.com/

    My Mod DB page

    My playthroughs on Youtube

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •