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

Members Online

»
0 Active | 15 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

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: Play sound only when in distance
csocsi96
General Member
Since: Aug 9, 2010
Posts: 75
Last: Aug 24, 2014
[view latest posts]
Level 3
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Sunday, Apr. 21, 2013 09:44 am
Hey there,

I'd like to make the bomb tickling sound in sd to be hearable only from a distance.

I looked into the csv files and now I have this line:

bomb_tick,,misc/bomb_tick.wav,0.0,0.93,na,,,50,300,local,,,looping,,,,,,,,,,


and in my sd.gsc i have:

Code:

bomb_countdown()
{
	self endon("bomb_defused");
	level endon("intermission");

	thread showBombTimers();
//	level.bombmodel playLoopSound("bomb_tick");
	xqt_bombtickdist = getCvarInt("xqt_bombtickdist");
	xqt_bombtickenabled = getCvarInt("xqt_bombtickenabled");
	
	if(getCvar("xqt_bombtickenabled") == "1")
	{
		level.bombmodel playLoopSound("bomb_tick");
	}
	

	wait level.bombtimer;

	// other stuff here.... wont post....
}


and that did not work (i could hear the tickling from any distance), so that i tried to make a script for the distant sound.

Code:

bomb_countdown()
{
	self endon("bomb_defused");
	level endon("intermission");

	thread showBombTimers();
//	level.bombmodel playLoopSound("bomb_tick");
	xqt_bombtickdist = getCvarInt("xqt_bombtickdist");
	xqt_bombtickenabled = getCvarInt("xqt_bombtickenabled");
	
	if(getCvar("xqt_bombtickenabled") == "1")
	{
		for(;;)
		{
			selforg = self.origin;
			wait 0.1;
			bomborg = level.bombmodel.origin;
			
			dst = distance(bomborg,selforg);
			
			if(dst < 300)
			{
				self playLoopSound("bomb_tick");
			}
		}
	}
}



I'm not sure, but if my mind serves my right, when I used self playloopsound instead of level.bombmodel playloopsound, and when i armed the bomb, a tree model appeared on top of the bomb xDDD was very funny but why did it appear? lol [lol]
Share |
PatmanSan
General Member
Since: Jul 3, 2009
Posts: 8
Last: Feb 6, 2014
[view latest posts]
Level 0
Category: CoD2 Scripting
Posted: Tuesday, Apr. 23, 2013 06:36 pm
It takes the dist_min and dist_max from the sound alias to decide whether to play or not. Reversing min and max won't help either.
This is hard to do, especially with a looping sound. You can play the looping sound on any player entity in (or out) of range, but if you are not careful in setting the right sound alias variables, you end up with players hearing each other ticking.
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

»