Results 1 to 4 of 4

Thread: Playing custom sounds using scripts

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

    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
    135
    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,383
    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

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
  •