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

Members Online

»
0 Active | 100 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 4
Category: CoD4 MP Mapping
CoD 4 mapping and level design for multiplayer.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Multiplayer Sound/Muic triggers
Zaphax
General Member
Since: Jun 17, 2008
Posts: 251
Last: Dec 29, 2013
[view latest posts]
Level 5
Category: CoD4 MP Mapping
Posted: Wednesday, Oct. 5, 2011 02:13 pm
Hello, long time ago since i visited this site haven't mapped for a month or two now.

Well i got this question. I know its possible to make a trigger that plays the specific sound that is linked with the soundalias

But! I know its possible for Singleplayer how can i make it for Multiplayer? is it same? and also if it is the question I am here to ask is can i make the trigger that plays sound that i recorded, lets say i record "Damn it! the door is locked." and when the player gets on that trigger and/or presses "use" button (F) it will play it. But i record few sounds that are for different teams as British (Sas) and American (U.S.M.C.) and Russian (Spetsnaz) don't have same accent. So if your in Sas team and play Vs. Spetsnaz if your Spetsnaz and get on that trigger it will play the sound that i have for that team and if you are Sas then you hear different sound file for that team.

Hope i get positive and fast replies, Thank you!
Share |
cskiller86
General Member
Since: Nov 23, 2009
Posts: 528
Last: Oct 25, 2011
[view latest posts]
Level 6
Category: CoD4 MP Mapping
Posted: Wednesday, Oct. 5, 2011 05:20 pm
Yeah, it's possible to trigger a sound, using the playsound() or playloopsound() functions. See Zeroy's list.

I'm not sure I fully understood the second question. There is also a function PlaySoundToTeam() which plays the sound only to members of one team.
Though I'm not sure if the sound is played to the whole team or can be called only on the client that triggers it.

Another way is to make two triggers, each usable by one of the teams, with the SetTeamForTrigger() function. So you'd have something like this:
Code:
main()
{
players = getEntArray("player", "classname");
for(i=0; i<players.size;i++)
{
players[i] thread soundSAS();
players[i] thread soundSPETSNAZ();
}
}

soundSAS()
{
trigger_sas = getEntity("trigger1", "targetname");
trigger_sas SetTeamForTrigger( game["attackers"] );//only the attackers can activate the trigger

while(1)
{
trigger_sas waittill("trigger");
self playsound("sound_sas");
wait 0.5;//this value should be a little bit greater than the length of the sound, so that it doesn't play overlapped
}
}

soundSPETSNAZ()
{
trigger_spetsnaz = getEntity("trigger2", "targetname");
trigger_spetsnaz SetTeamForTrigger( game["defenders"] );

while(1)
{
trigger_spetsnaz waittill("trigger");
self playsound("sound_spetsnaz");
wait 0.5;
}
}

This is only a basic form of code and it's not tested. The playsound() function has to be called on an entity (a client, in this case), so I made a list of all the players and threaded the functions on each. However, it would be better to make two lists, one for each team, and thread the SAS function on the SAS players (and likewise for Spetsnaz).
The 'attackers' and 'defenders' are defined in your map's main GSC.
Share |
Zaphax
General Member
Since: Jun 17, 2008
Posts: 251
Last: Dec 29, 2013
[view latest posts]
Level 5
Category: CoD4 MP Mapping
Posted: Thursday, Oct. 6, 2011 02:10 pm
Great!

Thanks a lot. I will try to make a map and use this script for it but as i see the sound_sas and sound_spetsnaz is the name for the .mp3 file located in sound folder right? that is the name i should change to make it work to my own .mp3 file right?


Is it just a basic .csv sound alias or is it anything special with it? :)
Share |
Zaphax
General Member
Since: Jun 17, 2008
Posts: 251
Last: Dec 29, 2013
[view latest posts]
Level 5
Category: CoD4 MP Mapping
Posted: Thursday, Oct. 6, 2011 02:48 pm
Will this script work for other cod games as well? Like if i use it for Call of Duty 2 i change trigger_spetsnaz to trigger_american or trigger_german? same with other script files like change all sas to american and spetsnaz to german right? and it will be for cod2 then right? :)
Share |
cskiller86
General Member
Since: Nov 23, 2009
Posts: 528
Last: Oct 25, 2011
[view latest posts]
Level 6
Category: CoD4 MP Mapping
Posted: Friday, Oct. 7, 2011 04:25 pm
The name used with the playsound() command is a soundalias. I haven't worked with soundaliases so I can't help you there. But you'll find a lot of tutorials and posts on this subject (check out DeekCiti's Outline).

About using the script on other CoD games, it should work if all the functions are supported by those games (especially SetTeamForTrigger and playsound). The trigger names are just random names I selected.
Like I said before, the teams are defined in the SetTeamForTrigger function as 'attackers' and 'defenders'. Which team is attacker and which is defender is defined in the main GSC of your map. In CoD4 it's like this:
Code:
	game["allies"] = "marines";
	game["axis"] = "opfor";
	game["attackers"] = "allies";
	game["defenders"] = "axis";
The marines are the allies and they will be attacking.
If CoD2 uses the same method, then you don't have to change anything in the code.
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 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

»