D3ltaQ's picture
Upload 2197 files
24b81cb verified
class BetaSound
{
static SoundOnVehicle SaySound(Object source, string sound_name, float distance, bool looped)
{
bool is_female = source.ConfigGetBool("woman");
string path_class = "CfgActionSounds " + sound_name;
string path_sound = path_class + " sounds";
//is the action sound class defined ? if not, try to play it as a regular sound
if( GetDayZGame().ConfigIsExisting(path_sound) )
{
string path_sound_female = path_class + "_female" + " sounds";
if(is_female && GetDayZGame().ConfigIsExisting(path_sound_female))
{
path_sound = path_sound_female;
}
GetGame().ConfigGetTextArray(path_sound,CachedObjectsArrays.ARRAY_STRING);
int rnd_index = Math.RandomInt(0,CachedObjectsArrays.ARRAY_STRING.Count());
string sound_class = CachedObjectsArrays.ARRAY_STRING.Get(rnd_index);
SoundOnVehicle sound_object = GetGame().CreateSoundOnObject(source, sound_class, distance, looped);
return sound_object;
}
else
{
return GetGame().CreateSoundOnObject(source, sound_name, distance, looped);
}
}
};