1. Trouble with the game?
    Try the troubleshooter!

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

    Dismiss Notice
  3. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.36 Bug Reporting thread
    Solutions and more information may already be available.

how to disable waypoint crossing sound

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by lellolillili, Dec 23, 2021.

  1. lellolillili

    lellolillili
    Expand Collapse

    Joined:
    Nov 29, 2021
    Messages:
    136
    Hi,

    There's a sound that plays whenever a waypoint is passed - precisely, right before the "onRaceWaypoint" and "onRaceWaypointReached" hooks are defined. I've been disabling the sound by commenting out 2 lines in ge/extensions/scenario/waypoint.lua:

    Code:
        
          -- Engine.Audio.playOnce('AudioGui', "event:>UI>Special>Checkpoint")
          extensions.hook( 'onRaceWaypoint', data)
        end
      elseif w.cur ~= -1 then
        local data = {cur = w.cur, curPos = wpData.pos, curRot = wpData.rot, curRadius = wpData.radius, next = w.next,
                      vehicleId = vid, vehicleName = bo:getField('name', ''),
                      waypointName = w.waypointConfig[w.cur] and w.waypointConfig[w.cur].cpName or "", time = scenario.timer - dtOff, lapDiff = lapDiff,
                      currentLapConfig = getVehicleLapConfig(vid)
                    }
    
        extensions.hook('onRaceWaypointReached', data)
    
        if (bo.playerUsable == true or bo.playerUsable == '1') then
          -- Engine.Audio.playOnce('AudioGui', "event:>UI>Special>Checkpoint")
          extensions.hook( 'onRaceWaypoint', data)
    
    1) is there a less hacky way to do this, possibly mod-friendly? Maybe I can have my mod load up and point to a modified version of waypoint.lua that has no sounds? Is there a way to do this?

    2) Ideally, it would be best if the devs could add an option to not play those sounds. That way, people that are designing more immersive gameplay mods (such as myself - I'm working on a rally thing that needs a lot of waypoints) can turn it off. For example, there's a "hide" method for the racemarker object. It makes sense that you can also mute the various audio clips.

    Thanks in advance!
     
  2. Gamergull

    Gamergull
    Expand Collapse
    BeamNG Team

    Joined:
    Jun 3, 2018
    Messages:
    460
    Hello!

    That's a good idea for the waypoint sounds. It can be good to give modders fine levels of control of some things. A lot of the scripts in the "ge/extensions/scenario" folder are a bit old and probably won't be updated much except to keep backwards compatibility for older scenarios. The Flowgraph and Missions systems are the new ways to create scripted gameplay.

    However
    , I tested a solution for this (because I still love the old scenario system). You can create an edited copy of "waypoints.lua" (with a different name, like waypointsCopy.lua), and then in your mod specific Lua file, paste this code:
    Code:
    M.onScenarioLoaded = function()
      scenario_waypoints = extensions.scenario_waypointsCopy
    end
    This will point all instances of scenario_waypoints to your modified script. Make sure you test this out fully; hopefully it won't break anything.
     
    #2 Gamergull, Dec 23, 2021
    Last edited: Dec 23, 2021
    • Like Like x 1
  3. lellolillili

    lellolillili
    Expand Collapse

    Joined:
    Nov 29, 2021
    Messages:
    136
    Thank you, it works, and it's super powerful, I was really hoping I could do something like that.

    The only issue is that I have to restart the game (R) for it to work properly. I'm sure there are many hacky ways to fix this probably (like, maybe forcing a reload?), but while you're here I might as well learn something. What's the cleanest way to get it to load on the first time?

    Thanks in advance!

    P.S.: it'd still be nice if we could disable the sound without having to do this.
     
  4. Gamergull

    Gamergull
    Expand Collapse
    BeamNG Team

    Joined:
    Jun 3, 2018
    Messages:
    460
    Oh, hmm I thought it would work. You might need to do M.onScenarioUIReady as well, or maybe with some other hook. But if it gets set too late, then it may not work at all.
     
    • Like Like x 1
  5. lellolillili

    lellolillili
    Expand Collapse

    Joined:
    Nov 29, 2021
    Messages:
    136
    Cool, thanks for the input. I'll experiment with it
     
  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