Raised This Month: $51 Target: $400
 12% 

Ambient


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 05-23-2006 , 19:27   Ambient
Reply With Quote #1

Could someone explain how I would use this?

Quote:
Originally Posted by AMXX Funcwiki
EF_EmitAmbientSound -
Syntax:
EF_EmitAmbientSound ( const ENTITY, Float:pos[3], const SAMPLE[], Float:volume, Float:attenuation, fFlags, pitch )
Type:
Stock
Notes:
My thoughts are:
Code:
new entity[33]; new position1[33][3] = {origin, origin, origin} EF_EmitAmbientSound(entity, position1, NotSureAtAllHere, 1.0, NotSureATAllHere);

May I please have an explanatory example?
__________________
LEWL.
NewUser is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-23-2006 , 20:21  
Reply With Quote #2

Code:
emit_sound ( id, CHAN_AUTO, g_szSound, 1.0, ATTN_NORM, 0, PITCH_NORM )

What is this?

id - entity to emit from
CHAN_AUTO - the channel to emit from. More details here: http://www.amxmodx.org/funcwiki.php?...=1#const_sound
g_szSound - any sound file, like "mysound.wav"
1.0 - volume
ATTN_NORM - attenuation level
0 - flags, not generally needed
PITCH_NORM - You can modify the pitch with this sound it sounds more high or low.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 05-24-2006 , 18:43  
Reply With Quote #3

I know how to use emit_sound. I was looking for the thing closest to "ambient_generic" that I could find. I don't want the sound to be emitted on a player. At an origin. Then again, emit sound might work at an origin?

Code:
new position[33][3] {origin, origin, origin} emit_sound(position, CHAN_AUTO, "mysound.wav", ATTN_NORM, 0, PITCH_NORM);
__________________
LEWL.
NewUser is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-24-2006 , 18:52  
Reply With Quote #4

Here's what you can do:

Case 1: You want to emit it on all players. Just client_cmd(0,"spk sound.wav")

Case 2: You want to emit it from an ambient generic.

Steps:

1) Create an ambient_generic (create_entity)
2) Set its origin and whatever other properties (entity_set_x, DispatchSpawn)
3) emit_sound on it

I'm not quite sure how to use EF_EmitAmbientSound, I'm guessing it's very similar if not the same as emit_sound.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 05-24-2006 , 19:53  
Reply With Quote #5

One last thing, how would I "replay" the sound after the file was finished playing. Other than an infinite set_task loop until it ends to execute it again.
__________________
LEWL.
NewUser is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-24-2006 , 19:55  
Reply With Quote #6

Quote:
Originally Posted by NewUser
One last thing, how would I "replay" the sound after the file was finished playing. Other than an infinite set_task loop until it ends to execute it again.
Set EV_FL_nextthink on the ent to the end of the sound, and then play it on each think (using register_think)

I think there's a loop thing somewhere but I'm not sure how to do it.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
VEN
Veteran Member
Join Date: Jan 2005
Old 05-25-2006 , 05:05  
Reply With Quote #7

Quote:
Case 1: You want to emit it on all players. Just client_cmd(0,"spk sound.wav")
Normally just set attenuation to 0.0 (ATTN_NONE)

Quote:
Case 2: You want to emit it from an ambient generic.

Steps:

1) Create an ambient_generic (create_entity)
2) Set its origin and whatever other properties (entity_set_x, DispatchSpawn)
3) emit_sound on it
No: 3) use ambient_generic by other entity

Emit[Ambient]Sound flags
Code:
#define SND_SPAWNING        (1<<8)    // duplicated in protocol.h we're spawing, used in some cases for ambients #define SND_STOP        (1<<5)    // duplicated in protocol.h stop sound #define SND_CHANGE_VOL    (1<<6)        // duplicated in protocol.h change sound vol #define SND_CHANGE_PITCH    (1<<7)    // duplicated in protocol.h change sound pitch

ambient_generic spawnlags
Code:
#define AMBIENT_SOUND_STATIC            0   // medium radius attenuation #define AMBIENT_SOUND_EVERYWHERE        1 #define AMBIENT_SOUND_SMALLRADIUS      2 #define AMBIENT_SOUND_MEDIUMRADIUS    4 #define AMBIENT_SOUND_LARGERADIUS      8 #define AMBIENT_SOUND_START_SILENT    16 #define AMBIENT_SOUND_NOT_LOOPING      32

Normally ambient_generic is looping.

Also if you have an issues with ambient_generic look into Fall Scream plugin.
VEN is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 05-25-2006 , 16:07  
Reply With Quote #8

I'm probably wrong about this, I don't much about the way HL handles sound, but when you set the channel to CHAN_STATIC, it seems to repeat the sound endlessly.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 05-25-2006 , 18:59  
Reply With Quote #9

Would I put the ambient_generic code in public client_putinserver?
__________________
LEWL.
NewUser is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 05-26-2006 , 09:57  
Reply With Quote #10

Depends on what did you mean by "ambient_generic code". ;)
VEN is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:41.


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