UGX-Mods

Call of Duty: Black Ops 3 => Help Desk => Scripting => Topic started by: Conbini2017 on April 30, 2017, 06:25:36 am

Title: I want to make it so that it can not be heard by sounding a radio and going far
Post by: Conbini2017 on April 30, 2017, 06:25:36 am
I want to make it so that it can not be heard by sounding a radio and going far away. :)
Title: Re: I want to make it so that it can not be heard by sounding a radio and going far
Post by: Archaicvirus on April 30, 2017, 07:22:41 am
If what your're looking for is falloff distance, that is set up in the csv file that the sound you are playing is located in. You will need to make this a 3D sound and set the distances up. If I were you I would read "sound_mod_docs" in your bo3root/docs_modtools folder. It explains setting up aliases. Basically a "sound file" within the cod engine is sort of an array of variables in which the engine processes and modifes the way the sound is played based on the criteria that you declare in the csv file. So essentially, the game will never just play a raw wav file without adjusting the properties of the sound based on the csv, for the most part.

But first before you get into that headache, what function exactly are you using to play the radios? Generally if you want a 3d sound to have falloff distance, default sounds probably have this set up in the csv already, so if you are doing:
Code Snippet
Plaintext
player PlaySound("radio_sound");    //This function plays the sound TO the player, not in 3d space. So it is at full volume always, at least as I have observed before.

//You want to do :
PlaySoundAtPosition("radio_sound", (x,y,z));  //While this function plays the sound in 3d space, so the volume will scale according to the distance the player is from the origin of the sound.
//or
PlaySoundAtPosition("radio_sound", entity.origin);

Hope that helps you.

*Keep in mind some of the sounds you might be using could possibly be set up as 2D sounds and not 3D, so you probably won't hear them in game if you are doing PlaySoundAtPosition() in some cases. Also, be careful when editing the sound aliases, because if you put erroneous data into any of the fields, this will fuck up the sound and it will either not play at all, or just sound undesirable. That is why I recommend reading that document I pointed out earlier. I went through this hassle before setting up sounds, and as long as you have patience and a bit of time it's not really that hard you will find. says yoda
Title: Re: I want to make it so that it can not be heard by sounding a radio and going far
Post by: HitmanVere on April 30, 2017, 09:46:55 am
If what your're looking for is falloff distance, that is set up in the csv file that the sound you are playing is located in. You will need to make this a 3D sound and set the distances up. If I were you I would read "sound_mod_docs" in your bo3root/docs_modtools folder. It explains setting up aliases. Basically a "sound file" within the cod engine is sort of an array of variables in which the engine processes and modifes the way the sound is played based on the criteria that you declare in the csv file. So essentially, the game will never just play a raw wav file without adjusting the properties of the sound based on the csv, for the most part.

But first before you get into that headache, what function exactly are you using to play the radios? Generally if you want a 3d sound to have falloff distance, default sounds probably have this set up in the csv already, so if you are doing:
Code Snippet
Plaintext
player PlaySound("radio_sound");    //This function plays the sound TO the player, not in 3d space. So it is at full volume always, at least as I have observed before.

//You want to do :
PlaySoundAtPosition("radio_sound", (x,y,z));  //While this function plays the sound in 3d space, so the volume will scale according to the distance the player is from the origin of the sound.
//or
PlaySoundAtPosition("radio_sound", entity.origin);

Hope that helps you.

*Keep in mind some of the sounds you might be using could possibly be set up as 2D sounds and not 3D, so you probably won't hear them in game if you are doing PlaySoundAtPosition() in some cases. Also, be careful when editing the sound aliases, because if you put erroneous data into any of the fields, this will fuck up the sound and it will either not play at all, or just sound undesirable. That is why I recommend reading that document I pointed out earlier. I went through this hassle before setting up sounds, and as long as you have patience and a bit of time it's not really that hard you will find. says yoda

playSound plays at the location it is threaded on, so you are playing sound on player's location rather than to that player. If you want to play sound to a player only (2D), you do player playLocalSound("");
Title: Re: I want to make it so that it can not be heard by sounding a radio and going far
Post by: Conbini2017 on April 30, 2017, 09:58:21 am
If what your're looking for is falloff distance, that is set up in the csv file that the sound you are playing is located in. You will need to make this a 3D sound and set the distances up. If I were you I would read "sound_mod_docs" in your bo3root/docs_modtools folder. It explains setting up aliases. Basically a "sound file" within the cod engine is sort of an array of variables in which the engine processes and modifes the way the sound is played based on the criteria that you declare in the csv file. So essentially, the game will never just play a raw wav file without adjusting the properties of the sound based on the csv, for the most part.

But first before you get into that headache, what function exactly are you using to play the radios? Generally if you want a 3d sound to have falloff distance, default sounds probably have this set up in the csv already, so if you are doing:
Code Snippet
Plaintext
player PlaySound("radio_sound");    //This function plays the sound TO the player, not in 3d space. So it is at full volume always, at least as I have observed before.

//You want to do :
PlaySoundAtPosition("radio_sound", (x,y,z));  //While this function plays the sound in 3d space, so the volume will scale according to the distance the player is from the origin of the sound.
//or
PlaySoundAtPosition("radio_sound", entity.origin);

Hope that helps you.

*Keep in mind some of the sounds you might be using could possibly be set up as 2D sounds and not 3D, so you probably won't hear them in game if you are doing PlaySoundAtPosition() in some cases. Also, be careful when editing the sound aliases, because if you put erroneous data into any of the fields, this will fuck up the sound and it will either not play at all, or just sound undesirable. That is why I recommend reading that document I pointed out earlier. I went through this hassle before setting up sounds, and as long as you have patience and a bit of time it's not really that hard you will find. says yoda
Thank you for your reply. :)
Is targetname etc. necessary?
I did this way, but have anything changed?
Code Snippet
Plaintext
function radio_sound()
{
//You want to do :
PlaySoundAtPosition("radio_sound", (20,20,20));  //While this function plays the sound in 3d space, so the volume will scale according to the distance the player is from the origin of the sound.
//or
PlaySoundAtPosition("radio_sound", entity.origin);
}
Title: Re: I want to make it so that it can not be heard by sounding a radio and going far
Post by: Archaicvirus on April 30, 2017, 03:30:47 pm
Quote
playSound plays at the location it is threaded on, so you are playing sound on player's location rather than to that player. If you want to play sound to a player only (2D), you do player playLocalSound("");

Thanks for the clarification.

Quote
Thank you for your reply. :)
Is targetname etc. necessary?
I did this way, but have anything changed?
Code: [Select]
function radio_sound()
{
   //You want to do :
   PlaySoundAtPosition("radio_sound", (20,20,20));  //While this function plays the sound in 3d space, so the volume will scale according to the distance the player is from the origin of the sound.
   //or
   PlaySoundAtPosition("radio_sound", entity.origin);
}

I don't understand what you mean about the targetname, but I think what you need to do is something like this
Code Snippet
Plaintext
//First give all the radio triggers the same targetname 'radio', but a unique script_sound - 'name_of_sound' kvp 

function radio_sounds(){
radios = GetEntArray("radio", "targetname");
foreach(radio in radios){
radio thread wait_for_trig();
}
}

function wait_for_trig(){
self waittill("trigger");
PlaySoundAtPosition(self.script_sound, self.origin);
}
Title: Re: I want to make it so that it can not be heard by sounding a radio and going far
Post by: BluntStuffy on April 30, 2017, 06:53:00 pm
I don't understand what you mean about the targetname, but I think what you need to do is something like this

I think what he means is if he can just enter x,y,z-coordinates in the script, instead of getting the ent's origin.
In wich case the answer is yes.
Title: Re: I want to make it so that it can not be heard by sounding a radio and going far
Post by: Conbini2017 on May 03, 2017, 01:30:03 pm
Thanks for the clarification.

I don't understand what you mean about the targetname, but I think what you need to do is something like this
Code Snippet
Plaintext
//First give all the radio triggers the same targetname 'radio', but a unique script_sound - 'name_of_sound' kvp 

function radio_sounds(){
radios = GetEntArray("radio", "targetname");
foreach(radio in radios){
radio thread wait_for_trig();
}
}

function wait_for_trig(){
self waittill("trigger");
PlaySoundAtPosition(self.script_sound, self.origin);
}
Thank you! :D
Title: Re: I want to make it so that it can not be heard by sounding a radio and going far
Post by: Archaicvirus on May 04, 2017, 03:39:20 am
No problem man. Thanks to the vets also for more information on this subject