Solved How to get player vehicle config ??

Discussion in 'Mod Support' started by jojos38, Jul 6, 2017.

  1. jojos38

    jojos38
    Expand Collapse

    Joined:
    Oct 22, 2013
    Messages:
    1,071
    Hi, i am the creator of the mod "Siren and Horn Mod" but i have a problem:
    I would like to get the config of the vehicle that the player is driving but i don't find how to do...
    I tried this:

    local vehicleNames = scenetree.findClassObjects('BeamNGVehicle')
    for _, name in ipairs(vehicleNames) do
    local veh = scenetree.findObject(name)
    print(veh.partConfig)
    end


    but it return me all vehicle config, i want only the vehicle config the player is driving...
    Could you help me please ?
     
  2. thomatoes50

    thomatoes50
    Expand Collapse
    BeamNG Team

    Joined:
    Jan 31, 2013
    Messages:
    722
    on lua vehicle you can do
    Code:
    v.userPartConfig
    It return an empty table if you haven't load a .PC

    if you are on the GE side you will have to get the vehicle and you should be able to do the same

    i didn't understood what you wanted at first, use the sample code up there
     
  3. jojos38

    jojos38
    Expand Collapse

    Joined:
    Oct 22, 2013
    Messages:
    1,071
    Thank you for you answer !
    Okay but the table return me things like 0x61546.
    how to transform this "table" into a real string ? like "base.pc"
     
  4. thomatoes50

    thomatoes50
    Expand Collapse
    BeamNG Team

    Joined:
    Jan 31, 2013
    Messages:
    722


    For instance to get the Paint Design / Skin
    Code:
    v.userPartConfig.paint_design
    --or
    v.userPartConfig["paint_design"]
     
  5. thomatoes50

    thomatoes50
    Expand Collapse
    BeamNG Team

    Joined:
    Jan 31, 2013
    Messages:
    722
    for now you can't have the name of the configuration that is loaded.

    Next version will have it on the vehicle side.
    Code:
    partmgmt.pcPath
     
  6. jojos38

    jojos38
    Expand Collapse

    Joined:
    Oct 22, 2013
    Messages:
    1,071
    Okay thank you :/
    --- Post updated ---
    The next update is coming in how much time ?
     
  7. EruptionTyphlosion

    EruptionTyphlosion
    Expand Collapse

    Joined:
    Sep 24, 2016
    Messages:
    2,925
    When it's ready.
     
    • Agree Agree x 1
  8. jojos38

    jojos38
    Expand Collapse

    Joined:
    Oct 22, 2013
    Messages:
    1,071
    I FOUND
    obj:queueGameEngineLua("be:getPlayerVehicle(0):queueLuaCommand('drivingSounds.vehicleConfig = (\"'..be:getPlayerVehicle(0):getField('partConfig', '')..'\")')")

    print(drivingSounds.vehicleConfig)
     
  9. thomatoes50

    thomatoes50
    Expand Collapse
    BeamNG Team

    Joined:
    Jan 31, 2013
    Messages:
    722
  10. jojos38

    jojos38
    Expand Collapse

    Joined:
    Oct 22, 2013
    Messages:
    1,071
    • Like Like 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