Location Settings: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Line 57: Line 57:
:This will send a command to the speaker to play the ambient it has registered under "snd_streets" that you entered.  When you enter a new zone, the new info_location sends a command to the speaker to turn off that ambient and start a new one.   
:This will send a command to the speaker to play the ambient it has registered under "snd_streets" that you entered.  When you enter a new zone, the new info_location sends a command to the speaker to turn off that ambient and start a new one.   


:If you wanted to have no ambient playing in the zone (and turn off any ambient started from another zone), you would use "snd_silence" as the value.  Also, if you have an info_location with no "ambient" value at all, it will also turn off the ambient (however, this is still under debate; so check back again to see if this still works.)   
:If you wanted to have no ambient playing in the zone (and turn off any ambient started from another zone), you would use "snd_silence" as the value to command the speaker to turn off.  Also, if you have an info_location with no "ambient" value at all, it will also turn off the ambient (however, this is still under debate; so check back again to see if this still works.)   


:Here are two info_locations on two sides of a portal, with a info_locationseparator touching the portal, and with each info_location containing the name of the ambient that will play in its respective zone.
:Here are two info_locations on two sides of a portal, with a info_locationseparator touching the portal, and with each info_location containing the name of the ambient that will play in its respective zone.

Revision as of 22:31, 19 June 2009

written by demagogue

This describes a method of doing ambient sounds in which entering a "location" zone (the area inside a set of portals) turns on an omni ambient inside that area, then turns it off when you leave, possibly starting a new ambient for the new zone.

It uses three entities: a special speaker (speaker_zone_ambient), info_location's, and location dividers.


The Speaker

Create a speaker_zone_ambient entity in your blueroom (i.e., a room off to the side the player will never enter).
In the speaker's spawnargs, put the names of all the ambient sounds you want to play in your map. (This pre-loads the sounds into the speaker so there isn't a pause when they start playing.) Put it in this key/value form:
"snd_streets" "city_night01_loop_z"
"snd_mansion" "mansion_tense01a_z"
The left hand spawnarg should have a "snd_" prefix, and any name but most useful is probably the name of the area it is for. The right hand value should be the name of the sound (i.e., the soundshader name) that will play. You can see the names of ambient-ready sounds in the sub-folder "Darkmod/sound/tdm_ambient_ambience_zoned.sndshd". (The shader names add the "_z" at the end to the sound filenames to distinguish them for use with the zone approach.)
To listen to the sounds, they are located in the sub-folder "Darkmod\sound\ambient\ambience" and are in .ogg format.
(Note, need to check if adding "looping", "global", etc in the speaker will work, so you aren't restricted to only using soundshader-ready sounds. You can also technically enter the sound's address in the right hand side, such as "sounds/ambient/ambience/mansion_tense01a.ogg", but it doesn't help if it's not global and you can't hear it. For now, use the soundshader name until we get "global" working without it.)
Your speaker will look like this:

Kd04d5.jpg

It is worth noting that one special "sound" is already loaded by default.
"snd_silence" "silence"
You can see it if you check "Show Inhereted Properties". This is the sound you use to turn "off" the ambient sounds playing, so there is silence in the zone.
You are finished with the speaker now.
Unlike normal speakers, things like the volume, looping, global, etc, are handled by the speaker and soundshader by default. If you want to change the volume or stop the looping for a single ambient, you will need to do it in a soundshader for the sound (at the present time, this may change later). I'll explain how to do that at the end.

The Location Entities

Now you need to set up the location system so the game knows where the zones are.

info_locationseparator.

A location is basically any area that's closed in by brushes and portals. However, you have to close off the entrance/exit portals by hand. You do this with an entity called a info_locationseparator. Create one so it touches the portal you want as a boundary. If you don't touch a portal with this entity, than it will not register in the game as the boundary to a new zone, and the zone will continue into the area on the other side of the portal. This happens even if you have two info_locations in a zone (the game will just pick one and use that for the whole zone).
I have read discussion that a door touching a portal makes it a location boundary, but in my experiments the door did not create a new location and I still had to use a info_locationseparator over the portal to register it as a boundary.


info_location

Now, inside the zone you want to be covered with an ambient, create a info_location entity. Anywhere in the space of the zone is fine. Name it the name of the zone you want (to make it easy to find when you push "j").
Now create a spawnarg property of "ambient" with the value being the speaker-name of the sound you used in the speaker above (NOT the soundshader name or file name). For example,
"ambient" "snd_streets"
This will send a command to the speaker to play the ambient it has registered under "snd_streets" that you entered. When you enter a new zone, the new info_location sends a command to the speaker to turn off that ambient and start a new one.
If you wanted to have no ambient playing in the zone (and turn off any ambient started from another zone), you would use "snd_silence" as the value to command the speaker to turn off. Also, if you have an info_location with no "ambient" value at all, it will also turn off the ambient (however, this is still under debate; so check back again to see if this still works.)
Here are two info_locations on two sides of a portal, with a info_locationseparator touching the portal, and with each info_location containing the name of the ambient that will play in its respective zone.

Snd streets.jpg

Snd silence.jpg

That's basically it. The ambients will now turn on when you enter a zone and turn off when you enter a new zone, turning on the new ambient in that new zone.
Finally, there are a few other spawnargs on the info_locations that you don't have to worry about, but you can use them if you like, so I will mention them.

(to be done)...

No fade2.jpg


See also