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

Solved [HELP] Emit Sound on Coordinates


Post New Thread Reply   
 
Thread Tools Display Modes
hellmonja
Senior Member
Join Date: Oct 2015
Old 10-04-2019 , 10:16   Re: [HELP] Emit Sound on Coordinates
Reply With Quote #11

Pardon my ignorance, I don't quite seem to follow. But if I understand correctly you're thinking I'm trying to make my own firing sounds, hence the muzzle blast and being opposite if bullet whiz which on the receiving end. What I'm trying to do is just distant sounds, firing sounds that echo from afar when in a battlefield.

Still I do agree that having 5 emit_sounds is rather much and very inefficient. Therefore I was inspired by you to think up of another way. I'm going to try finding all players within a radius using find_sphere_class then using client_cmd() to play the sound for those players. I think it might just work out.

In any case, lest I forget, thank very much all of you! I learned a lot from this...
__________________

Last edited by hellmonja; 10-04-2019 at 10:23.
hellmonja is offline
Old 10-04-2019, 14:25
DJEarthQuake
This message has been deleted by DJEarthQuake. Reason: double post
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 10-04-2019 , 14:35   Re: [HELP] Emit Sound on Coordinates
Reply With Quote #12

There is no question you are hankering to explore. The settings already exist in emit_sound. Volume normal does it when using MSG_ONE. Your vectors will need to be 9 digit numbers to make it to other side of map or stick with radius or viewcone to make a hey where did that shot come from effect. 2nd shot found them. 1000 especially in cstrike is damn near point blank. So if you were not trying to make this a muzzle radius you just did.

All last winter I used these sorts of things such that I had a fog in 2 different areas from 1 entity and depending on what sound was heard there was a different color fog and damage map wide. So it can be done. I had to borrow a overhead sound stock to make it easier to code. So with 1 ent I covered entire map when it exploded with purple which is instant death radiation and green which had time based. Needless to say entire server was sick of being nuked but then again I was sick of disarming or kicking campers. It got boring. So bot does it for me with style and entire server for not taking out the camper.

What we are doing seems like a consequence of not enough players. Forever ago there were enough shots and explosions nobody thought hey lets make more!! When I had popular Gearbox server it was loud but then again instant respawns whereas cstrike is a bit slower pace.

Really bullet whizz you can pick another sound and make the radius bigger. It has a cvar. Default is 40. Make it 1000 and test if that is what you wanted or have fun making your own. If you do I hope to see a nice clean stock we all can use. Here is one I adopted for overhead flyover sounds.

Code:
// Shoot the sound around the origin. public overhear(dist,origin2[3],Sound[]) {         for(new b = 0; b < 33; b++) {                 if(is_user_connected(b)) {                         new bOrigin[3]                         get_user_origin(b,bOrigin)                         if (dist==-1) emit_sound(b,CHAN_VOICE, Sound, 1.0, ATTN_NORM,0, PITCH_NORM);                         else if (get_distance(origin2,bOrigin) <= dist) emit_sound(b,CHAN_VOICE, Sound, 1.0, ATTN_NORM,0, PITCH_NORM);                         }            } } public BeaconSound(bid){ #if defined(DEBUG_ADV)                 server_print("Sound random b Called") #endif         new Float:origin2[3]         if (pev_valid(bid))         pev(bid,pev_origin,origin2)         new origin[3]         for(new i=0;i<3;i++) origin[i] = floatround(origin2[i]);         new Float:ran = random_float(-5000.0,5000.0)         new Float:avelo[3]         avelo[0] = 0.0         avelo[1] = ran         avelo[2] = 0.0         if (pev_valid(bid))         set_pev(bid,pev_avelocity,avelo)         overhear(1000,origin,"fvox/atmospherics_on.wav")         switch(random_num(0,7))         {               case 0: overhear(3000,origin,"ambience/warn2.wav")          case 1: overhear(3000,origin,"vox/contamination.wav")          case 2: overhear(3000,origin,"fvox/bell.wav")          case 3: overhear(3000,origin,"fvox/boop.wav")          case 4: overhear(3000,origin,"fvox/buzz.wav")          case 5: overhear(3000,origin,"fvox/danger.wav")          case 6: overhear(3000,origin,"x/nih_die2.wav")          case 7: client_cmd(0, "mp3 play sound/misc/sani.mp3")         }         for(new i=0;i<10;i++) voogru_effect( origin2 );         set_task(2.5,"BeaconSound",bid) }

Bid is an ent that is not a player. It's a model spinning and bouncing around emitting sound. Depending on if player is 1000 or 3000 distance they hear different sound. When in the middle of that one can hear both from different places. That might be the essence you are after. Past 3000 nothing.
__________________

Last edited by DJEarthQuake; 10-04-2019 at 14:48. Reason: post happened in my sentence!
DJEarthQuake is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-04-2019 , 14:51   Re: [HELP] Emit Sound on Coordinates
Reply With Quote #13

https://forums.alliedmods.net/showthread.php?t=238457
__________________








CrazY. 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 05:42.


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