Unsolved Choosing a Random Part at Spawn

Discussion in 'Mod Support' started by BombBoy4, Sep 25, 2017.

  1. BombBoy4

    BombBoy4
    Expand Collapse

    Joined:
    May 16, 2015
    Messages:
    1,601
    I just got a truckload of ad carrier skins in for my Ultimate Configuration Pack, and now there's about 15. Is there a way to make the config choose a random one at spawn?
    Thanks :)
     
  2. thomatoes50

    thomatoes50
    Expand Collapse
    BeamNG Team

    Joined:
    Jan 31, 2013
    Messages:
    722
    you can create a LUA module which once your skin is detected will choose one randomly
    Code:
    -- This Source Code Form is subject to the terms of the bCDDL, v. 1.1.
    -- If a copy of the bCDDL was not distributed with this
    -- file, You can obtain one at http://beamng.com/bCDDL-1.1.txt
    
    local M = {}
    
    local data = {}
    
    local function onLoad()
    
        if v.userPartConfig.ad_skin~= nil then
            --do something
        end
    
    end
    
    local function onReset()
        onLoad() --when you reset the car
    end
    
    local function updateGFX(dt)
    end
    
    
    -- public interface
    M.onLoad    = onLoad
    M.onReset   = onReset
    M.updateGFX = updateGFX
    
    return M
     
  3. BombBoy4

    BombBoy4
    Expand Collapse

    Joined:
    May 16, 2015
    Messages:
    1,601
    Thank you, but I don't know much about LUA programming (I'm more of a C++/jBeam) to finish 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