Page 1 of 1
Remove engine idle sound from car?
Posted: Sat Sep 10, 2016 5:20 pm
by Teralink
Hi!
I want the car to make sounds while driving only. At current state the car starts to make sounds directly on entering. It's easy to remove the 'engine start' sound. But I can't get rid of this engine idle sound.
I tried it with
so the sound stops when the engine stops. But it doesn't do anything.
Is there some command that would let me set the engine sound volume to zero during stops? I appreciate every tip!
Re: Remove engine idle sound from car?
Posted: Sat Sep 10, 2016 7:42 pm
by Nexela
Silly hybrid electric vehicles wanting to turn their engines off when not moving!
Unfortunately I can't think of a way to do this
Re: Remove engine idle sound from car?
Posted: Sun Sep 11, 2016 10:59 am
by Teralink
Thanks for your reply! That's exactly what I had in mind. An engine idle sound doesn't really fit to an electric car..
I feared that there is no way to do that.
Re: Remove engine idle sound from car?
Posted: Sun Sep 11, 2016 12:06 pm
by steinio
Maybe you can reference to an empty soumd file?
Re: Remove engine idle sound from car?
Posted: Sun Sep 11, 2016 12:39 pm
by LuziferSenpai
steinio wrote:Maybe you can reference to an empty soumd file?
The easyst way is to detect if the Car is driving, when it is than the sound volume = 0.9 or so and if not than 0.001 or 0.0
Re: Remove engine idle sound from car?
Posted: Mon Sep 12, 2016 6:15 pm
by Teralink
steinio wrote:Maybe you can reference to an empty soumd file?
That would mute the engine all the time, I think.
LuziferSenpai wrote:The easyst way is to detect if the Car is driving, when it is than the sound volume = 0.9 or so and if not than 0.001 or 0.0
Thanks for that idea! I found out how to get the car speed, but how do I access the engine volume during playtime?
I tried that code
Code: Select all
function electricSound()
for __, player in pairs(game.players) do
local vehicle = player.vehicle
if player.connected and vehicle and vehicle.name == "vwtransporterelectric" then
if vehicle.speed == 0 then
vehicle.working_sound.sound.volume = 0
else
vehicle.working_sound.sound.volume = 0.5
end
end
end
end
but on entering the vehicle, it tells me 'LuaEntity doesn't contain key 'working_sound'.
Do you know how to do that?
Re: Remove engine idle sound from car?
Posted: Mon Sep 12, 2016 6:27 pm
by LuziferSenpai
Teralink wrote:steinio wrote:Maybe you can reference to an empty soumd file?
That would mute the engine all the time, I think.
LuziferSenpai wrote:The easyst way is to detect if the Car is driving, when it is than the sound volume = 0.9 or so and if not than 0.001 or 0.0
Thanks for that idea! I found out how to get the car speed, but how do I access the engine volume during playtime?
I tried that code
Code: Select all
function electricSound()
for __, player in pairs(game.players) do
local vehicle = player.vehicle
if player.connected and vehicle and vehicle.name == "vwtransporterelectric" then
if vehicle.speed == 0 then
vehicle.working_sound.sound.volume = 0
else
vehicle.working_sound.sound.volume = 0.5
end
end
end
end
but on entering the vehicle, it tells me 'LuaEntity doesn't contain key 'working_sound'.
Do you know how to do that?
Than make it: 0.001 or so
Re: Remove engine idle sound from car?
Posted: Mon Sep 12, 2016 6:35 pm
by Teralink
That makes no difference, sadly. I think the problem isn't the value - it's the key 'working_sound' itself that doesn't exist (at this place). I know this key from the entity definition only. It seems not to be accessible during playtime..