Random Fuel Level

Discussion in 'Ideas and Suggestions' started by fanofmods, Aug 29, 2023.

  1. fanofmods

    fanofmods
    Expand Collapse

    Joined:
    May 28, 2017
    Messages:
    61
    Add an option to the game in which it randomises the fuel level of a vehicle when it is spawned. I think it would be a neat feature which also adds some functionality to the fuel stations in game which otherwise would not be used unless the user has set their own fuel volume for the vehicle or just has driven for a very long time.
     
    • Agree Agree x 2
    • Like Like x 1
  2. fanofmods

    fanofmods
    Expand Collapse

    Joined:
    May 28, 2017
    Messages:
    61
    I think this would be a rather simple implementation as all that is required is when a vehicle is spawned, a random value for the fuel volume can be generated, though it would be ideal to have it so that the value generated is always greater than 0 as it would be inconvenient to spawn a vehicle with a fuel volume of zero.
     
  3. r3eckon

    r3eckon
    Expand Collapse

    Joined:
    Jun 15, 2013
    Messages:
    656
    I like the idea, could be a useful yet simple to build UI app. I might do it as a side project if I find enough time.

    For now try this in vlua console, might not work with all vehicles (some configs use "auxTank" instead of "mainTank") but on my end it worked:
    Code:
    energyStorage.getStorages()["mainTank"]:setRemainingVolume(math.random(1, energyStorage.getStorages()["mainTank"].capacity))
    The minimum bound of math.random is 1 liter but you can set it to something else if you think 1 liter isn't enough, also the upper bound is using the tank capacity but you could divide it by 2 so the tank is at most half full.
     
    • Like Like 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