1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice

what code will make a REV limiter sound under "RPM limiter"

Discussion in 'General Discussion' started by LiamXO13, Nov 8, 2015.

  1. LiamXO13

    LiamXO13
    Expand Collapse

    Joined:
    Apr 29, 2014
    Messages:
    40
    Hello. under drivetrain.lua there is a line of code called rpm limiter and has this string of code underneath it
    if engAV > engine.maxAV then torque = 0 end
    what can i add/change to subtract 100RPM every time the engine hits for example 8000RPM to create a rev limiter sound?

    Thanks,

    Liam.
     
  2. TheStatPow

    TheStatPow
    Expand Collapse

    Joined:
    Aug 8, 2013
    Messages:
    145
    For the sound:

    if Sounds == nil then Sounds = {} end
    if Sounds[1] == nil then Sounds[1] = {} end

    rev_limiter_sound = gameEngine:createSFXSource(path/to/sound.wav, "
    AudioLoop2D", ''rofile_name", false)

    Make sure the sound is mono, if you want the sound 3D use :AudioDefaultLoop3D

    and attach it to a node if its 3D using : obj:attachSFXNode(rev_limiter_sound, node_id)

    You can scavage some code to get a node from the engine and make the sound come out from there.

    Sounds[1]["profile_name"] = {obj = rev_limiter_sound, lastVol = 0, lastPitch = 0}



    az = Sounds[1]["profile_name"]
    obj:setVolume(az.obj, 0) --use this line but set the volume to 1 whenever you want it to make the rev limiter sound (its gonna loop over and over until you set the volume to 0)

    For the rev limiter try this although im not sure:

    if engAV > engine.maxAV then
    engAv = engAv - 100
    playRevLimiterSound(true) -- i assume you'll create a function to play the rev limiter sound
    end
     
  3. randomshortguy

    randomshortguy
    Expand Collapse

    Joined:
    Aug 9, 2013
    Messages:
    1,562
    I replied to you m8, check your inbox.

    @TheStatPow

    That may work, but:

    if engAV > engine.maxAV then
    torque = 0
    engAV = engAV - 100
    end

    also works, and it's much simpler
     
  4. LiamXO13

    LiamXO13
    Expand Collapse

    Joined:
    Apr 29, 2014
    Messages:
    40
    Thanks both of you :D
     
  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