So basically, OH I CANT BELIEVE YOU DONe THiS
oh not this
So basically, I have a addon in gmod. And I added sound to one of my objects. When it's far away in singleplayer I can hear it, I mean if it's too far I can't hear it, but that's what I want. But when I'm in multiplayer I can hear it only from really close range.
Can you guys help me with it?
.....what even?
with such a huge amount of details and informations? No.
I dont know how to give it details and informations.
I just have self:EmitSound("blebllbe.wav", 511) and I hear farther in singleplayer than in multiplayer.
Maybe this? sound.Add
Nope, it still doesn't work ;/
Hmm... Your sound does not work? Or you can not heat the sound far away?
As I said, the sound.play works the same as emitsound, so I hear farther the sound in singleplayer than in multiplayer.
I did some testing, and I think 500 DB is the highest. This is the variable you need to change if you want to hear it far far away.
sound.Add( {
name = "fireworks001",
channel = CHAN_STATIC,
volume = 1.0,
level = 500,
pitch = { 100, 130 },
sound = "firework/a_sound.wav"
} )
Still the same Try downloading my mod and launch the tangler rocket in singleplayer and in multiplayer and let me know if you will hear it in multiplayer.
sound levels appear to work differently in singleplayer and multiplayer.
i remember tinkering with that value before and in singleplayer, i could hear it MUCH further than in multiplayer when set to 0 (hear everywhere)
so in short, i don't think there's anything you can do.
OK! I made a "hack" for you ;)
*You can use my code officially on Workshop if you credit me for the "Sound Emitter" function !! .-) I spent some time on it.
My Credit: ravo (Norway), or you can add me as a contributer on Steam Workshop.
-- -- Instructions to install/modify your current files (takes maybe 30 min or less to do) -- --
First Unzip the files, and place the new ones as shown in the photo. Put the folder "fireworks_sound_emitter" in your already created "entities" folder:
https://files.facepunch.com/forum/upload/350606/61554224-a569-4f58-92da-de7b157a860a/instructions2.JPG
Then, edit you files. Adding: SoundData (run it as early as you can in the code) and Replacing: self:Remove() and the self:EmitSound(..) like so, where you want to hear the sound always:
https://files.facepunch.com/forum/upload/350606/69c745fb-bdb0-4188-9b54-a94d37d64a03/instructions1.JPG
https://files.facepunch.com/forum/upload/350606/1794db3c-3c58-496d-ba10-c8c220397722/instructions3.JPG
Under here, you can adjust the algorithm:
https://files.facepunch.com/forum/upload/350606/bfa2df4f-55ae-49a5-bbe5-50faab6fc59d/instructions4.JPG
---- -- -
Hope you want to use it! It works very well. I tried on singleplayer and multiplayer!
You need to fix your lua-errors Just add some strict checking wether or not a variable is nil, and it will be a better addon.
Explanation:
What this code does is, that it creates an entity which follows the Player always. Then when you want to play a sound, it emits that from the entity which follows you. This entity receives all the sounds you want to always hear. When the sound goes off, it sends this sound to all Players on the server. You then adjust the volume with the algorithm, which calculates it based on the distance between the Player and the firework.
*This sound should only be played locally for the player! I am running EmitSound on client side.
local SoundData = GetSoundDataEnts(self)
timer.Simple(0.2,function()
self:CheckReaction()
a = math.random(0,1)
if a == 0 then
--self:EmitSound("anaconda1.wav", 400, 100, 1, CHAN_AUTO )
SetSoundAndEntity(
SoundData.ent1,
SoundData.ent2,
"anaconda1.wav"
)
end
if a == 1 then
--self:EmitSound("anaconda1_2.wav", 400, 100, 1, CHAN_AUTO )
SetSoundAndEntity(
SoundData.ent1,
SoundData.ent2,
"anaconda1_2.wav"
)
end
ParticleEffect("explosion", self:GetPos(),Angle(0,0,0))
util.BlastDamage(self,self,self:GetPos(), 60, 180)
--self:Remove()
RemoveEnt(self)
end)
Test it with two persons before you apply it to everything, if you want to use it ;)
I can help you test it if you want.
I'll check it out! I'll give you a reply when it will work
Very good! :-) No problem!
I will most certanly use this in my own gamemode (My Base Defence) also; for knocking sounds.
I got this error when I tried your addon now :-)
Couldn't include file '.\script\fireworks_sound_emitter\fireworks_sound_emitter.lua' (File not found) (@lua/entities/anaconda 1/shared.lua (line 8))
You should be able to fix this by adding this line above:
AddCSLuaFile(".\script\fireworks_sound_emitter\fireworks_sound_emitter.lua")
Ah, I think maybe you just forgot to include the "script" folder! :-) I haven't checked into your files; just an assumption.
OK, so I made a version for my own gamemode, and I figured out that this:
* First, place the "script" folder in the "autorun" folder.
Then replace this line of code:
include("./script/fireworks_sound_emitter/fireworks_sound_emitter.lua")
With this:
AddCSLuaFile("script/fireworks_sound_emitter/fireworks_sound_emitter.lua")
include("script/fireworks_sound_emitter/fireworks_sound_emitter.lua")
That should be all! Worked for me.
Sorry, you need to Log In to post a reply to this thread.