adding customized sound triggers for sound entities

Learn more on how to use Sandbox, or submit your own tutorials or resources.
Posts: 22
Joined: May 26th, 2012, 11:34 pm
Name: Joey

adding customized sound triggers for sound entities

Postby Littlejoe-42 » June 8th, 2012, 7:40 pm

adding a sound trigger to PAS, so that you can play a customized sound entity. :geek:

first, here's some information about the game I'm working on. Simply replace your names with the ones provided.

-mapname = "TheLand"
-game = fps
-model made in my map using edit mode in PAS = toilet
-sound to add = "flush.ogg" (it has been said Audacity [freeware] will make soundfiles editable and exportable in .ogg format) There is a few seconds of silence after the flush in the soundfile. The sound of the flushing toilet WILL loop, but your player will probably walk away from it after hearing the sound the first time.

- where to put the flush.ogg

open PAS/packages/sounds. create a new sub-folder named "mysounds". place your flush.ogg there.

the file is now included in your PAS folder.

- now it needs to be installed into the game

open PAS/my_stuff/packages/base/fps/TheLand-art.cfg (right click, "EDIT" with notebook.) This is the "configuration" file that tells PAS which artwork to install for "TheLand" map.

you should be looking at a text document covered with so much eye pollution it's mind boggling. don't panic, simply scroll to the end of the text.


enter the following line

mapsound "mysounds/flush" 255 32767 // 33

"mapsound" = load new sound command
"mysounds/flush" = (location of sub-folder in "sounds" folder)/(soundfile name)
"255" = not sure, but all the others are loaded with this number
"32767" = not sure, but all the others are loaded with this number
"// 33" = ("//" = "ignore everything after this statement until the next command") (33 is the a reference number for the new trigger, as there are 0-32 pre-loaded sound triggers to play with)

- time to save the TheLand-art.cfg file.

don't just "save" it, it'll just save as a .txt document. you want to "file" - "save as" the title name, "TheLand-art" and add ".cfg" to the end of it. Notebook will automatically save your file as a .cfg file.

[Notebook can do this with most filetypes (.html and .bat for sure).]

- restart PAS with your map, then close the game.

now, when you "edit" the TheLand-art.cfg file, you will see your command (mapsound "mysounds/flush" 255 32767 // 33
) has moved. it's now buried in the middle of the text, near the top, after all the other "mapsound" installs (0-32).



- play your map in PAS
- enter "editmode"
- "Esc" key to get to menus
- "Editing GUI"
- "Ents"
- "New Sound Entity"

now, in front of you, is a little box, appearing much like a particle. click "F3" to edit its properties. You should be able to adjust the Radius, which is the sphere the sound is heard in; the Size, which I barely understand, and a tag marked "Trigger Type"

- it is here, on "Trigger Type", that you enter the reference number of the sound. remember, there are already 33 (0-32) pre-installed sounds, ready for you to use. you can enter the trigger number either with text or the slide. also, the Trigger Type number is 33.

BUG - you can only get a maximum trigger number of 20 with this method. even if your sound trigger was 34, and you wanted to change it to 33; if you entered 33 into the trigger type, it'll revert to the maximum of 20. :|



-instead of using the menus, you can create a sound entity manually inside PAS, using an in-game command prompt.

play PAS, with your map, enter "editmode", and type "`" (just above the TAB key, it's like entering "t" and typing "/", allowing you to make commands in PAS). you'll see the text input at the bottom left of the screen. (>/)


newent sound 33 12 11

- "newent" = create a new entity
- "sound" = entity type
- "33" = trigger type (your sound file's reference number) (ANY number you want!)
- "12" = radius
- "11" = size

it is still possible to edit the radius and size by the usual methods, "F3". HOWEVER, do not touch the trigger type (unless you're willing to deal with a number 20 or less)

using standard editing controls, move your sound entity directly above your toilet (for some reason, I've noticed that the sound doesn't play sometimes if the player is standing in the center of the entity).

if you have multiple toilets, like I do, it's best to just copy the entity ( "ctrl" + "c") and past ( "ctrl" + "v" ) close to and above every toilet in the area.

Even in edit mode, you should hear the wonderful sound of a flushing toilet every time you go near one.

Another trick I did was to create a sound "environment". I have a forest on my map, and a made a quiet sound loop of forest sounds in an .ogg file. Using the above techniques, I made a sound entity that had a huge radius and size, and put it in the center of the forest. Now, whenever you go in, you hear the sound of rustling leaves and birds chirping.

SPECIAL NOTE : I've noticed that sound entities had the bad habit of "disappearing". If you don't know EXACTLY where your sound file is located, it's as hard to find as a particle that doesn't have any particles. GOOD LUCK FINDING THE CENTER OF ANYTHING WITH YOUR EARS! So, if you make it, lose it, and want to get rid of it, I hope you have a marker close by it. (I put a little mound of mushrooms directly under the forest's sound entity. And flushing sounds? Look over the toilet.)

Also, if you test out a sound entity, and erase it, you will still hear it playing. I've noticed they disappear the next time you load your map.

I'm hopeful this information is as useful to you, and your game creation, as it has proved to be for me. Technically (and remember, this is a noob who hadn't even of heard the word "cubescript" 72 hours ago) this was the only thing I really wanted to learn to do, but I've learned so much along the way. It is for this reason that I hope to make more "noob-friendly" tutorials in the future.

please let me know how I did. if ANYTHING is unclear, leave a reply, and I will check back every once in a while. (this is by no means a promise that I will reply).

Posts: 22
Joined: May 26th, 2012, 11:34 pm
Name: Joey

Re: adding customized sound triggers for sound entities

Postby Littlejoe-42 » June 10th, 2012, 1:19 pm

I found the above method had its problems

Here's another method of installing your new custom sound into the game's TheLand-art.cfg file.

- Play PAS
- "editmode"
- "Esc" (menu)
- "Edit GUI"
- "Edit cfg" (or something like that. it's the last choice). this area lets you type in commands into the TheLand-art.cfg (it is here where you type "mapsound "mysounds/flush.ogg 255 32767 //35")
- highlight (use the buttons at the bottom) and "execute" them (which installs the new sound permanently into your map)
- and let's you clear the command (I HIGHLY recommend removing any command you've typed in to be erased before you exit the game. I used this method to install a model, and every time I started PAS with my map, another model of the same zombie was added to my game's model menu).

I had to try this method because I had trouble doing the same thing a second time, using the exact same methods above. For some reason, my sound would never load. This was a quick test that was easy to type in, and test out right away, which WORKED!

Posts: 22
Joined: May 26th, 2012, 11:34 pm
Name: Joey

Re: adding customized sound triggers for sound entities

Postby Littlejoe-42 » June 10th, 2012, 3:12 pm

- another method of creating a sound entity with a sound trigger higher than 20 (discovered just minutes ago!)

1) Use the WRONG method (described above) to create your sound entity.

2) click on the sound entity while in editmode, and scroll your mousewheel. Now you can control the trigger number with a simple slide of the finger, choosing any number over 20 (up to and over 500!)

Return to “Tutorials and Resources”

Who is online

Users browsing this forum: No registered users and 1 guest