AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Emit Sound Problem. Fire sound is overlapping my sounds (https://forums.alliedmods.net/showthread.php?t=308733)

esenrik 07-01-2018 09:51

Emit Sound Problem. Fire sound is overlapping my sounds
 
Hello!

I created a reloading sound for players, the character says with emit sound: "I'm reloading!!".

The sound works perfectly when no one is shooting, but the problem is that the engine shoot sounds overlaps my sound.

Any way to fix it?

My code (there are 4 possible reload sound random choosed):

PHP Code:

new random random_num(14)
        if (
random == 1) {
        
emit_sound(idCHAN_VOICEreload11.0ATTN_NORM0PITCH_NORM)
        } else if (
random == 2) {
        
emit_sound(idCHAN_VOICEreload21.0ATTN_NORM0PITCH_NORM)
        } else if (
random == 3) {
        
emit_sound(idCHAN_VOICEreload31.0ATTN_NORM0PITCH_NORM)
        } else if (
random == 4) {
        
emit_sound(idCHAN_VOICEreload41.0ATTN_NORM0PITCH_NORM)
        } 

I don't understand for example why Zombie Madness item of zombie plague always plays sound correctly and why my sounds are being overlapped :(

PD: I tested all channels. Including CHAN_AUTO.

Ghosted 07-01-2018 10:21

Re: Emit Sound Problem. Fire sound is overlapping my sounds
 
Have you tried other channels?

esenrik 07-01-2018 10:23

Re: Emit Sound Problem. Fire sound is overlapping my sounds
 
Quote:

Originally Posted by Ghosted (Post 2600317)
Have you tried other channels?

All channels

CrazY. 07-01-2018 14:07

Re: Emit Sound Problem. Fire sound is overlapping my sounds
 
To improve, use switch statement instead.

Ghosted 07-01-2018 15:36

Re: Emit Sound Problem. Fire sound is overlapping my sounds
 
Quote:

Originally Posted by CrazY. (Post 2600358)
To improve, use switch statement instead.

or create string array and use random function. :3

Celena Luna 07-01-2018 16:33

Re: Emit Sound Problem. Fire sound is overlapping my sounds
 
change from CHAN_VOICE to CHAN_WEAPON

Edit:
(From Zombie Madness)
PHP Code:

emit_sound(idCHAN_VOICEsound1.0ATTN_NORM0PITCH_NORM

Basically, Zombie Madness using CHAN_VOICE channel so the sound would overlap. I usually use CHAN_WEAPON for shooting sounds and CHAN_ITEM for other effect on the gun.

Ghosted 07-01-2018 17:00

Re: Emit Sound Problem. Fire sound is overlapping my sounds
 
But he said that he checked it on all channels

Celena Luna 07-01-2018 17:15

Re: Emit Sound Problem. Fire sound is overlapping my sounds
 
Check if any of your weapon you are using have CHAN_AUTO or CHAN_VOICE for shooting sound

esenrik 07-01-2018 17:23

Re: Emit Sound Problem. Fire sound is overlapping my sounds
 
Quote:

Originally Posted by Celena Luna (Post 2600415)
Check if any of your weapon you are using have CHAN_AUTO or CHAN_VOICE for shooting sound

I never modified weapon sounds, so they are using the default shooting channel...

Celena Luna 07-01-2018 17:30

Re: Emit Sound Problem. Fire sound is overlapping my sounds
 
Quote:

Originally Posted by esenrik (Post 2600416)
I never modified weapon sounds, so they are using the default shooting channel...

If possible, show full code is recommended (or that is all you wrote?)


All times are GMT -4. The time now is 12:28.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.