Solved How to get engineId

Discussion in 'Mod Support' started by Stiegfried, Jun 17, 2018.

  1. Stiegfried

    Stiegfried
    Expand Collapse

    Joined:
    Feb 17, 2018
    Messages:
    16
    Hello everyone,

    for some reason I am currently trying to mute and unmute the engine sound while the game is running. To do so I found the function setEngineSoundParameter(vehicleId, engineId, paramName, paramValue). I do know how to get the vehicleId and I do know which paramName (engineVolume) and paramValue (0) to use (or at least I think so, can't try it out just yet). But I can't figure out how to get the engineId. Does anyone know how to get the Id of the engine?

    Thanks in advance,
    Stiegfried
     
  2. metalmuncher

    metalmuncher
    Expand Collapse

    Joined:
    Aug 6, 2012
    Messages:
    257
    powertrain.getDevice("mainEngine").engineSoundID seems to sequentially number the engines in a vehicle, so for most cars its 0. If the engine doesn't have a soundconfig it's nil.
     
  3. Stiegfried

    Stiegfried
    Expand Collapse

    Joined:
    Feb 17, 2018
    Messages:
    16
    Thanks for the response, as you mentioned it returned either 0 or nil depending on the vehicle I tried it on. I already tried 0 but sadly either that's not it or setEngineSoundParameter(be:getPlayerVehicleID(0),0,"engineVolume",0) just doesn't work. I would consider that a possibility as I found that for example the function delEngineSound looks like this:

    local function delEngineSound(vehicleId)

    end


    Or I just didn't get the other parameters right, though the console doesn't display an error when I try that but nothing happens (as far as I can tell).

    Anybody got any other ideas on how to get this working?
     
  4. metalmuncher

    metalmuncher
    Expand Collapse

    Joined:
    Aug 6, 2012
    Messages:
    257
    Try main_gain instead of engineVolume. Will have to be a big negative number to completely mute the sounds.
     
  5. Stiegfried

    Stiegfried
    Expand Collapse

    Joined:
    Feb 17, 2018
    Messages:
    16
    Doesn't work either.

    What I forgot to mention: A solution to mute the entire game would be fine as well. I was only asking specifically for the engine as I already found a way for all the other sound sources.
    However I just found settings.setValue("AudioMasterVol",0,nil,nil) which works perfectly fine for my needs.

    Thanks for your efforts anyways.
     
    • Agree Agree x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice