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

Members Online

»
0 Active | 48 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 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: help with adding sound
dixie265
General Member
Since: Feb 15, 2006
Posts: 30
Last: Apr 4, 2007
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Friday, Jun. 23, 2006 08:38 am
Hi , I,m tring to add thunder sound to my map "im new at this and not too sure" Ive found a tut on adding sounds to cod and hope cod2 is the same, can someone have a look at what i have as im getting a "bad syntax" error in console
I,ve made a script_model with targetname "thunder3" in map
thanxs

//thunder3.gsc
main()
{
thread alert_sound();

}

alert_sound()
}
alerts = getentarray ("thunder3", "targetname");
while (1)
{

{
for (i=1;i alerts[0] playsound("thunder");

alerts[0] playsound("thunder");


wait (17);

self thread alert_sound();

return;
}
}
}


and in map.cgs have:
maps\mp\thunder3::main();




Share |
dixie265
General Member
Since: Feb 15, 2006
Posts: 30
Last: Apr 4, 2007
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Friday, Jun. 23, 2006 05:02 pm
[biggrin] dont worry guys ive sorted it and have it working now [jumping]
Share |
DarthBrooks
General Member
Since: Nov 24, 2005
Posts: 76
Last: Jun 14, 2007
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Sunday, Jan. 7, 2007 05:48 am
What was your answer? I'm getting ready to add some thunder to my map, and yes I'm new at this.
Share |
dixie265
General Member
Since: Feb 15, 2006
Posts: 30
Last: Apr 4, 2007
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Sunday, Jan. 7, 2007 07:41 am
This is what i ended up using:


//Thunder_Test.gsc
main()

{
start_thunder();

}

start_thunder()
{

alerts = getentarray ("thunder3", "targetname");
while (1)
{

{
for (i = 1; i < alerts.size; i++)
alerts [0] playsound("thunder");

alerts [0] playsound("thunder");

wait (17);

self thread start_thunder();

return;
}
}
}

Also add to soundaliases: "this has my map name change to suit"

#Ambient_bg
thunder 1 amb_elements/elm_thunder_y01.wav 0.85 0.99 0.8 1.1 100000 streamed mp_mohdm1
thunder 2 amb_elements/elm_thunder_y02.wav 0.85 0.99 0.8 1.1 100000 streamed mp_mohdm1
thunder 3 amb_elements/elm_thunder_y03.wav 0.85 0.99 0.8 1.1 100000 streamed mp_mohdm1
thunder 4 amb_elements/elm_thunder_y04.wav 0.85 0.99 0.8 1.1 100000 streamed mp_mohdm1

and thread in map.gsc

maps\mp\thunder_test::main();

i also added rain and lighting which can be found here with a search hope this helps
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Sunday, Jan. 7, 2007 08:47 am
How many entities do you have?

If more than one the way that script is written it will only play on the first entity in the array.

Here is a little script I just whipped up for a bit more randomness and is server friendly.

Code:
//
// Grassy's Thunder
// Accepts single or multiple origins
//

main()
{
	start_thunder();
}

start_thunder()
{
	ents = getentarray ("thunder", "targetname");
	if(isDefined(ents))
	{	
		if(ents.size > 1)
		{
			for (i = 1; i < ents.size; i++)
				ents[i] thread PlayItAgainSam();
		}
		else
			ents thread PlayItAgainSam();
	}
	else
		return;
}

PlayItAgainSam()
{
	while(1)
	{
		self playsound("thunder");
		delay = randomint(10)+15;
		wait delay;
	}
}


Enjoy!
Grassy
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Sunday, Jan. 7, 2007 09:14 am
Arghhh sorry folks, forum is playing up again.
Here it is again without the garbage, unfortunatly it has lost the indents. And a small fix, for loop starts at 0, not 1 :)

Quote:
//
// Grassy's Thunder
// Accepts single or multiple origins
//

main()
{
start_thunder();
}

start_thunder()
{
ents = getentarray ("thunder", "targetname");
if(isDefined(ents))
{
if(ents.size > 1)
{
for (a=0 ; a < ents.size; a++)
ents[a] thread PlayItAgainSam();
}
else
ents thread PlayItAgainSam();
}
else
return;
}

PlayItAgainSam()
{
while(1)
{
self playsound("thunder");
delay = randomint(10)+15;
wait delay;
}
}
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Monday, Jan. 8, 2007 12:50 am
Oh my, I must have been tired when I wrote that [crazy]
I just noticed a few errors above [banghead]

Here it is again, I tested it in UO and works ok.
Sorry if I caused any confusion.


//
// Grassy's Thunder
// Accepts single or multiple origins
//

main()
{
thread start_thunder();
}

start_thunder()
{
ents = getentarray ("thunder", "targetname");
if(isDefined(ents))
{
if(ents.size > 1)
{
for (a=0 ; a < ents.size; a++)
ents[a] thread PlayItAgainSam();
}
else
ents[0] thread PlayItAgainSam();
}
else
return;
}

PlayItAgainSam()
{
while(1)
{
self playsound("thunder");
delay = randomint(10)+15;
wait delay;
}
}
Share |
DarthBrooks
General Member
Since: Nov 24, 2005
Posts: 76
Last: Jun 14, 2007
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Tuesday, Jan. 9, 2007 06:32 pm
I got a "entity is origion only" error - Do we need an origin and a trigger? The tutorial made is sound as though you gave the trigger the origin texture and that that was enough.
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

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

»