Can an SBEAM be gear based?

Discussion in 'Programming' started by Mario64iscool2, Feb 7, 2017.

  1. Mario64iscool2

    Mario64iscool2
    Expand Collapse

    Joined:
    Mar 20, 2016
    Messages:
    124
    Hi Beamers!
    Quick question,

    Can an SBEAM be set up to have a sound file play for each gear the vehicle is in?
    For example, Sound file "A.ogg" plays when the car is at idle, "B.ogg" in Drive, etc. (You get the point...)

    Thanks,

    -Mario64iscool2
     
    #1 Mario64iscool2, Feb 7, 2017
    Last edited: Feb 7, 2017
  2. Mario64iscool2

    Mario64iscool2
    Expand Collapse

    Joined:
    Mar 20, 2016
    Messages:
    124
    ...

    I'm looking for an answer, and I'm surprised no one has one for me yet, despite my amount of views on this.
     
  3. Funky7Monkey

    Funky7Monkey
    Expand Collapse

    Joined:
    Oct 12, 2014
    Messages:
    977
    Have some patience. This is not something that the community is likely to know. In theory, it's possible. That's all I can tell you.
     
  4. Rainvest

    Rainvest
    Expand Collapse

    Joined:
    Dec 26, 2014
    Messages:
    1,902
    To be honest, I view random threads without knowing the problem just as other people do


    Anyway, back on topic.
     
    • Agree Agree x 3
    • Like Like x 1
  5. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    rpm in SBEAM is the source, it can be other things than rpm, but exactly what others that is unknown, but one would need to figure out what other than rpm can be used.

    I doubt that anyone outside the dev team really knows all the possible variables that could be used instead of rpm.

    You could of course play hacker and just start testing different possibilities, gear, gearbox, gear1 etc. in place of rpm. All that is needed is to figure out what possible string devs would of used for each gear, now if they have built such possibility that is pretty much only way I can see anyone finding out what is really possible.

    That is unless one of devs pastes all possible variables here and if upcoming 0.9 version changes sound system it would be wasted effort in 1-2 months time, but we can't know that of course, but as devs have mentioned how they need to improve sounds, they have hired sound guy etc. I guess next update has something in store for sounds.
     
  6. Miura

    Miura
    Expand Collapse

    Joined:
    Aug 5, 2012
    Messages:
    311
    It's possible with a custom lua file. You can make new electrics values and use them as sources for volume or pitch. In this case, each gear (or automatic shifter position?) would have 0 volume when it's not active.

    It's probably easier to just write the lua file than explain how to do it. How exactly do you want it to work?
     
    • Like Like x 1
  7. Mario64iscool2

    Mario64iscool2
    Expand Collapse

    Joined:
    Mar 20, 2016
    Messages:
    124
    I want it to work like in Mario Kart 8. I'm building a Mario Kart, so I'd like to be able to use it's source files.
     
  8. Miura

    Miura
    Expand Collapse

    Joined:
    Aug 5, 2012
    Messages:
    311
    After watching a couple of videos of it, I still don't know how it's meant to work. Anyway, I tried doing separate sounds for reverse, neutral and forward gears.

    First, put this in yourvehicle\lua\something.lua
    Code:
    local M = {}
    local function updateGFX(dt)
        electrics.values['throttleR'] = 0
        electrics.values['throttleN'] = 0
        electrics.values['throttleD'] = 0
        if     powertrain.getDevice("gearbox").gearIndex == -1 then electrics.values['throttleR'] = input.throttle*0.5 + 0.5
        elseif powertrain.getDevice("gearbox").gearIndex ==  0 then electrics.values['throttleN'] = input.throttle*0.5 + 0.5
        else electrics.values['throttleD'] = input.throttle*0.5 + 0.5
        end
    end
    M.updateGFX = updateGFX
    return M
    Then this in the .sbeam
    Code:
    {
      "modifiers":[
        ["name", "source", "factor", "offset", "min", "max"],
        ["throttleR", "throttleR",      1, 0, 0, 1],
        ["throttleN", "throttleN",      1, 0, 0, 1],
        ["throttleD", "throttleD",      1, 0, 0, 1],
      ],
      "sounds":[
        ["group", "filename", "profile", "nodeName", "source", "factor", "offset", "minVolume", "minPitch", "maxVolume", "maxPitch", "pitchBlendInStartValue", "pitchBlendInEndValue", "volumeBlendInStartValue",  "volumeBlendInEndValue", "volumeBlendOutStartValue", "volumeBlendOutEndValue", "volumeModifiers", "pitchModifiers"],
        ["default", "engineR.ogg",    "AudioDefaultLoop3D", "ENGINE",       "rpm", 1, 0, 0, 0, 1.0,  2.000, 0, 10000,    0,    0,10000,10000,    ["throttleR"], [] ],
        ["default", "engineN.ogg",    "AudioDefaultLoop3D", "ENGINE",       "rpm", 1, 0, 0, 0, 1.0,  2.000, 0, 10000,    0,    0,10000,10000,    ["throttleN"], [] ],
        ["default", "engineD.ogg",    "AudioDefaultLoop3D", "ENGINE",       "rpm", 1, 0, 0, 0, 1.0,  2.000, 0, 10000,    0,    0,10000,10000,    ["throttleD"], [] ],
      ],
    }
    If the car doesn't have the new powertrain, replace powertrain.getDevice("gearbox").gearIndex with drivetrain.gear . Should work, but I'm not sure.
     
  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