WIP Beta released Part Randomizer...?

Discussion in 'Content Creation' started by umustbeloggedintododat, Apr 4, 2021.

  1. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    Alrighty, I see how it is structured...
    It's like a pc file.
    Code:
    "part", "part", "part" etc
    But it doesn't sort it by what part it belongs to. It's scrambled. I need some help.
    The problem is that I know how to code the basic lua logic, but I don't know how to code BeamNG lua. It's not clear to me, and I'm not using that outdated wiki again.[/QUOTE]

    I'm not sure what you mean but I ended up coding it for you:
    Code:
    local M = {}
    
    local function rolldice()
        print("if you see this in console that means this works")
        --Gets vehicle's name
        local carname = be:getPlayerVehicle(0):getJBeamFilename()
    
        local config = extensions.core_vehicle_partmgmt.getConfig()
    
        --Get all slots
        local all_slots = require('jbeam/io').getAvailableSlotMap(extensions.core_vehicle_manager.getPlayerVehicleData().ioCtx)
    
        --Cycle through each slot
        for slot_name, curr_part in pairs(config.parts) do
            local parts_for_slot = all_slots[slot_name]
    
            if parts_for_slot then
                --table.insert(parts_for_slot, "")
                
                --Get random part
                local keyset = {}
                for k in pairs(parts_for_slot) do
                    table.insert(keyset, k)
                    
                end
    
                local random_part = parts_for_slot[keyset[math.random(#keyset)]]
                
                --print(random_part)
                
                config.parts[slot_name] = random_part           
            end
        end
        
        extensions.core_vehicle_partmgmt.setPartsConfig(config.parts, true)
    end
    
    M.rolldice = rolldice
    
    return M
     
  2. umustbeloggedintododat

    umustbeloggedintododat
    Expand Collapse

    Joined:
    Feb 16, 2019
    Messages:
    1,381
    this is fine
    I got a weird prerunner thingy
    nice.png
     
    • Like Like x 4
  3. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,056
    Will this be released? I want it
     
    • Agree Agree x 2
  4. umustbeloggedintododat

    umustbeloggedintododat
    Expand Collapse

    Joined:
    Feb 16, 2019
    Messages:
    1,381
    sure
    @bread for button
    and a big big thanks to @angelo234 for the coding
    also works with mods, but it might not work with some

    This is the original mod. Anywhere else is not the original, it's been stolen.
     

    Attached Files:

    #44 umustbeloggedintododat, Apr 17, 2021
    Last edited: May 10, 2021
    • Like Like x 7
  5. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,056
    Thank you, this is what it generated for me for the first time:
    dwwdaadasd.png
    It picked the weakest engine setup possible but with the strongest nitrous possible so it blows up when using nitrous, it has a drag radiator, wheelie bar and front drag wheels and brakes but it's RWD and very slow, on the rear it has half hillclimb half stock suspension and Hirochi wheels, and apparently it's a police car because it has a police livery (but purple) and a beacon light covered by a roof box. I can confirm it uses stuff from my mods too, it has the car jump system I was working on. Simple but amazing mod.
    Second time I got a drift police car:
    aasdasd.png
    For the ETK 800 it usually just generates stuff that causes LUA error or can't drive at all. For the Barstow, however, it gave me a car straight from a zombie apocalypse:
    dasasddas.png
    For the Bluebuck i got a derby taxi:
    sdaasdasd.png
    Can't do anything interesting for the Bolide, but it made a Rally Driver School Covet:
    asdasdd.png
    And a cursed Vivace-Tograc hybrid that also has JATO:
    asdasdsasee.png
    It made a beater Grand Marshal too...
    wedaada.png
    Wide wheelbase I-Series without widebody...
    wddzsd.png
    It has the same issues with K-Series as with ETK 800, but for the LeGran it works flawlessly, it made me something that resembles the skidplate Covet in a way:
    asdsdd.png
    It made a Miramar that looks like the rally Lada I made with Lada Car Pack a few months ago, even has the same no texture license plate:
    asdasda.png
    For the Sunburst it made a rally police:
    sadddw.png
    It works the best on the D-Series, it made the... what? Beater police prerunner?
    wasdw.png
    And also the square wheels police???
    waddw.png
    It made a derby bus with a cape, ram plow, window bars, locking diff and nitrous:
    wdas.png
    For the H-Series it made something i have seen in CrashHard's video except it was a D-Series:
    wdsas.png
    For the Roamer, I don't even know...
    weasdaae.png
    For the new Pessima it made the worst sounding car ever that hurts ears, and for the old one it made a car that doesn't drive, for the Piccolina it added JATO, for the Pigeon it added a welded diff and stabilizers so it can drift, for the SBR4 it made the second worst sounding car ever, for the Burnside it made a very funny sounding suspension due to a weird bug, for the Wendover it made a race car with the slowest engine possible with JATO, it made a drift Hopper, and for the T-Series it just kept giving me normal ones. I'm scared of what it will do for mod cars...
    --- Post updated ---
    It works weird with the Gavril Vertex, it didn't want to work for some time, then it generated a car that explodes on spawn, and then... this
    dasddww.png
     
    #45 Agent_Y, Apr 17, 2021
    Last edited: Apr 17, 2021
    • Like Like x 6
  6. Geraldo_o_geral

    Geraldo_o_geral
    Expand Collapse

    Joined:
    Jan 30, 2021
    Messages:
    211
    how to use ingame?
     
  7. S.Ali.M

    S.Ali.M
    Expand Collapse

    Joined:
    Jan 12, 2021
    Messages:
    1,079
    It's an ui app. (I still didn't use this but there is an ui app in the zip file)
     
    • Like Like x 1
  8. Geraldo_o_geral

    Geraldo_o_geral
    Expand Collapse

    Joined:
    Jan 30, 2021
    Messages:
    211
    thanks
     
  9. Penguin72

    Penguin72
    Expand Collapse

    Joined:
    Dec 11, 2020
    Messages:
    729
    Is it gonna be released on the repo?
     
  10. Geraldo_o_geral

    Geraldo_o_geral
    Expand Collapse

    Joined:
    Jan 30, 2021
    Messages:
    211
    thanks for this mod!
    screenshot_2021-04-17_14-19-26.png screenshot_2021-04-17_14-27-59.png screenshot_2021-04-17_14-36-15.png
     
    #50 Geraldo_o_geral, Apr 17, 2021
    Last edited: Apr 17, 2021
  11. a plane guy

    a plane guy
    Expand Collapse

    Joined:
    Mar 14, 2021
    Messages:
    4,143
    It doesn’t work
     
  12. Geraldo_o_geral

    Geraldo_o_geral
    Expand Collapse

    Joined:
    Jan 30, 2021
    Messages:
    211
    add it as an ui app
    it works for me
    --- Post updated ---
    upload_2021-4-20_18-49-37.png upload_2021-4-20_18-49-54.png
     
    • Like Like x 1
  13. SuperShep1

    SuperShep1
    Expand Collapse

    Joined:
    Apr 14, 2019
    Messages:
    2,682
    screenshot_2021-04-20_15-05-03.png screenshot_2021-04-20_16-04-41.png screenshot_2021-04-20_14-46-43.png
     
    • Like Like x 1
  14. a plane guy

    a plane guy
    Expand Collapse

    Joined:
    Mar 14, 2021
    Messages:
    4,143

    Attached Files:

    • 2021-04-21.png
  15. S.Ali.M

    S.Ali.M
    Expand Collapse

    Joined:
    Jan 12, 2021
    Messages:
    1,079
    Hi @umustbeloggedintododat! Share this mod on the repo is highly recommended. Now your mod just has 52 views but when it upload it on the repo, thousands of people will download it. (It's just a suggestion)
     
    #55 S.Ali.M, Apr 21, 2021
    Last edited: Apr 21, 2021
  16. umustbeloggedintododat

    umustbeloggedintododat
    Expand Collapse

    Joined:
    Feb 16, 2019
    Messages:
    1,381
    I did take the button code from @bread, but he doesnt seem to be active anymore
     
  17. S.Ali.M

    S.Ali.M
    Expand Collapse

    Joined:
    Jan 12, 2021
    Messages:
    1,079
    Ok. Btw I found an issue, can you please update it and solve it? Sometimes cars spawn with diesel engine but with gasoline fuel tank or cars spawn with gasoline engine but with diesel fuel tank, or electric engines spawn with gasoline fuel tank. Can you solve this problem?
     
  18. Nissan versa

    Nissan versa
    Expand Collapse

    Joined:
    Feb 20, 2021
    Messages:
    136
    wtf upload_2021-4-21_11-48-52.png
     
    • Like Like x 1
  19. Noobinator_83

    Noobinator_83
    Expand Collapse

    Joined:
    Mar 8, 2021
    Messages:
    228
    This mod is so fun, I'm glad you made it work umustbeloggedintododat!
     
    • Like Like x 1
    • Agree Agree x 1
  20. aircooledboii

    aircooledboii
    Expand Collapse

    Joined:
    Feb 16, 2021
    Messages:
    37
    ery noice
    --- Post updated ---
    no honestly, this is one of the funniest mods to play with
     
    • Agree Agree x 2
  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