Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 66 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 MP Mapping
CoD 2 mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Adding sound to a specific area on a map???
weasel
General Member
Since: Oct 23, 2007
Posts: 90
Last: Jan 29, 2008
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Sunday, Nov. 25, 2007 02:43 am
Hey gang,

Is it possible to add ambient sounds to a specific area?

My map is totally indoors and I want to add some ambient sounds to different areas and rooms.

I also want them to continue playing while a player or players remain in the area then stop when the area is empty.


Cheers!!

[thumbs_up]
Share |
Mystic
General Member
Since: Apr 10, 2004
Posts: 6147
Last: Apr 15, 2018
[view latest posts]
Level 10
Forum Moderator
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Sunday, Nov. 25, 2007 09:36 am
You may be able to achieve this through a script.. Like if the player is touching a trigger then play a sound. This would mean you would need a seperate trigger_multiple for each area you want a different sound. Also don't forget to not have any ambient playing from your .gsc or it will sound very messy.
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 MP Mapping
Posted: Sunday, Nov. 25, 2007 10:16 am
Check out the sound tutorials for CoDUO, there is one about adding sound to a truck, if I'm not mistaken.. the same principle can be applied to your rooms.

Combine it with the triggers Rasta mentions and you're done.
Share |
weasel
General Member
Since: Oct 23, 2007
Posts: 90
Last: Jan 29, 2008
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Sunday, Nov. 25, 2007 03:56 pm
Thanks guys, I got it working!

But what I need to do now is modify it so that I can either have two instances of the same sound playing or two sounds the same running indipendantly.

What I have is a large area with trucks so I want to trigger the first truck when the player enters the area which I have already done, then I need a delay before the sequence is repeated a little further into the building in another truck even if the first sequence is playing.
So that the player is always within earshot of some sound no matter where in the area they are and the sound remains as long as the player is in the area by chaining sounds one after the other.

Ultmately, I want sound in the room for as long as there are players in it and the reason I want delays is so that the sounds are not playing together to give a random feel to the trucks starting.

Is it possible??

The sounds.gsc I am using is this:

Code:


main() {   //START GSC


thread tank_engine();


}
tank_engine()
{ 
	tanktrig = getent ("tank_engine_trigger","targetname");
	tanktrig waittill ("trigger");

	alert = getentarray ("tank_enginesource", "targetname");
	alert playsound("tank_engine");

} //END GSC



which relates to this sounds.csv

Code:

name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max,channel,type,probability,loop,masterslave,loadspec,subtitle,compression,secondaryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage


tank_engine,,misc/tank_engine.wav,1,,,,,800,900,auto,,,nonlooping,,,,,,,,,,


Also, can I use mp3 formats rather than wav because wav's seem really big :/

Cheers.
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 MP Mapping
Posted: Sunday, Nov. 25, 2007 06:00 pm
SP or MP?

you could do something like this

tank_engine()
{
tanktrig = getent ("tank_engine_trigger","targetname");
tanktrig waittill ("trigger");

alert = getentarray ("tank_enginesource", "targetname");
alert[randomint(alert.size)] playsound("tank_engine");
wait(10);
tank_engine();
}


you can make the wait as long as you like, or make it randomish by using something like

wait(5+randomint(5));

to make the wait somewhere between 6 and 10 seconds..

Share |
weasel
General Member
Since: Oct 23, 2007
Posts: 90
Last: Jan 29, 2008
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Sunday, Nov. 25, 2007 06:21 pm
Hey caretaker,

Thanks, Yes, its for MP...

I have tried your code but it didn't solve the problem of triggering the second sound :/

I need engine one to trigger then engine two to trigger a few seconds later meaning two sounds will be running together.

I can get engine one to trigger but engine two wont play after the wait (4); line.

The code I was using was this:

Code:

main() {   //START GSC


thread tank_engine();


}
tank_engine()
{ 
	tanktrig = getent ("tank_engine_trigger","targetname");
	tanktrig waittill ("trigger");

	alert = getent ("tank_enginesource", "targetname");
	alert playsound("tank_engine");

wait (4);

	alert = getent ("tank_enginesource2", "targetname");
	alert playsound("tank_engine2");



} //END GSC


Strangely, I get no console errors just no sound from script_model 2 (engine2)
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 MP Mapping
Posted: Sunday, Nov. 25, 2007 06:26 pm
Did you add the tank_engine2 to your csv file?
You can just use the same sound alias if you want to instead of making a new one for the second engine.
Share |
weasel
General Member
Since: Oct 23, 2007
Posts: 90
Last: Jan 29, 2008
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Sunday, Nov. 25, 2007 06:40 pm
Ahaaaaaaaaaa!!!!!!!

Solved it...

I was using alert = for the second sound call and it didnt like it.
Changed it to alert2 and bingo!!!!


Weeeey Heeeeey!!!![rocking]

Strange I got no errors for that :/

edited on Nov. 25, 2007 01:45 pm by weasel
Share |
Zero_Rain
General Member
Since: Jun 5, 2006
Posts: 94
Last: Jan 13, 2008
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Wednesday, Dec. 5, 2007 11:26 am
I ran across this thread if its something like a radio playing sound , or my fav is wind when you high up in a tower this is all i do and it works fine. you dont need anyting in the map itself, no targets, scripts etc..

in my .gsc
maps\mp\_fx::loopSound("radio1", (3352, 1384, 144)); //sound from field radio
maps\mp\_fx::loopSound("town2", (-24, 1408 ,0)); //sound from tank battle outside of town
maps\mp\_fx::loopSound("wind1", (1048, 160, 580)); // sound up high in tower
maps\mp\_fx::loopSound("wind2", (1016, 480, 580)); // sound in secound tower


in my .csv
ambient_mp_tower_town,,ambient/amb_africa_tankbattle.mp3,0.63,,,,,,,local,streamed,,looping,,mp_tower_town,,,,,,,,
radio1,,amb_emitters/emt_radio_loop_1c.wav,0.7,1,,,,100,600,voice,,,looping,,mp_tower_town,,,,,,,,
wind1,,amb_elements/elm_windgust3mono.wav,0.9,1,,,,100,600,voice,,,looping,,mp_tower_town,,,,,,,,
wind2,,amb_elements/elm_windgust3mono.wav,0.9,1,,,,100,600,voice,,,looping,,mp_tower_town,,,,,,,,
town2,,ambient/amb_france04_ext.mp3,0.9,1,,,,100,600,voice,,,looping,,mp_tower_town,,,,,,,,


THATS IT
Share |
playername
Preferred Member
Since: Aug 24, 2006
Posts: 821
Last: Apr 15, 2011
[view latest posts]
Level 7
Forum Moderator
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Wednesday, Dec. 5, 2007 01:40 pm
yes, this is how it works.
maps\mp\_fx::loopSound("radio1", (3352, 1384, 144));

Call the loopSound() function.
"radio1" is the sound called from the .csv.
(3352, 1384,144) is the origain to loop the sound at.
nullFew tips for coding.
1. Keep the script as short as possible.
2. Don't comment every line. Only comment portions where they may be needed to point something out.
3. Don't over complicate the script, keep it organized and easy to read.

These help you find simple errors and makes it easy to make changes.
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 MP Mapping

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»