Playing custom sounds using scripts


(marcinkonys) #1

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.

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


(ryven) #2

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


(WuTangH) #3

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:


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.

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


(ronboy) #4

[QUOTE=marcinkonys;571642]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.

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[/QUOTE]

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

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?sid=733b1ec7624761dcab5b8a9f480180b6

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/


(marcinkonys) #5

This is definitely come in handy, thanks! Unfortunately in this instance, it crashes without anything extra printed to the log :frowning:

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

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 :slight_smile:

Thanks!

[QUOTE=ronboy;571667]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?sid=733b1ec7624761dcab5b8a9f480180b6

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/[/QUOTE]
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 :slight_smile:

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.


(marcinkonys) #6

This is definitely come in handy, thanks! Unfortunately in this instance, it crashes without anything extra printed to the log :frowning:

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

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 :slight_smile:

Thanks!

[QUOTE=ronboy;571667]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?sid=733b1ec7624761dcab5b8a9f480180b6

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/[/QUOTE]
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 :slight_smile:

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.


(Loffy) #7

[QUOTE=ronboy;571667]
… 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/[/QUOTE]

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)?


(ronboy) #8

[QUOTE=marcinkonys;571672]
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 :slight_smile:

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.[/QUOTE]

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

Did you get the version 1.2.11? It should have the old Q3map compiler bundled with it.


(Loffy) #9

I got the 1.2.11 but failed to find it. Attaching screenshot.



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!


(ryven) #10

[QUOTE=Loffy;572209]I got the 1.2.11 but failed to find it. Attaching screenshot.



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![/QUOTE]

This has tools you need http://www.moddb.com/mods/rtcw-classic-cooperative-campaign/downloads/rtcw-sdk-editing-tools-v11


(Loffy) #11

thx ryven, you were right — there is a Q3map version from 2001-10-22 in that download (in the file “din_nt”.


(ronboy) #12

[QUOTE=Loffy;572209]I got the 1.2.11 but failed to find it. Attaching screenshot.



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![/QUOTE]

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

Thanks for the link! :cool:


(Loffy) #13

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 :slight_smile:
Also working on a Wolf:ET map for that trackbase competition.
The best of times
:stroggtapir:


(ronboy) #14

[QUOTE=Loffy;572270]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 :slight_smile:
Also working on a Wolf:ET map for that trackbase competition.
The best of times
:stroggtapir:[/QUOTE]

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?sid=733b1ec7624761dcab5b8a9f480180b6