Code help, Nitrous by gear?

Discussion in 'Programming' started by Terzic, Apr 16, 2020.

  1. Terzic

    Terzic
    Expand Collapse

    Joined:
    Apr 16, 2020
    Messages:
    3
    Hi, I've been trying to program in N2o by gear, using similar code to boos by gear but the games not having it, I'm also trying to include a maximum rpm for the nitrous, (for example just to use off the line or to get up on the converter in an auto) but that doesn't work either. Any recommendations?

    Thanks,
    -Terzic

    Code for n20 by gear

    },
    "n2o_shot_variabler": {
    "information":{
    "authors":"BeamNG",
    "name":"Staged Shot Size",
    "value":200,
    },
    "slotType" : "n2o_shot",
    "variables": [
    ["name", "type", "unit", "category", "default", "min", "max", "title", "description"],
    ["$n20_gear1", "range", "kW", "Nitrous Oxide", 75, 25, 500, "1st Gear shot size", "Power increase the N2O injection grants in 1st gear"{"stepDis":5}],
    ["$n20_gear2", "range", "kW", "Nitrous Oxide", 75, 25, 500, "2nd Gear shot size", "Power increase the N2O injection grants in 2nd gear"{"stepDis":5}],
    ["$n20_gear3", "range", "kW", "Nitrous Oxide", 75, 25, 500, "3rd Gear shot size", "Power increase the N2O injection grants in 3rd gear"{"stepDis":5}],
    ["$n20_gear4", "range", "kW", "Nitrous Oxide", 75, 25, 500, "4th Gear shot size", "Power increase the N2O injection grants in 4th gear"{"stepDis":5}],
    ["$n20_gear5", "range", "kW", "Nitrous Oxide", 75, 25, 500, "5th Gear shot size", "Power increase the N2O injection grants in 5th gear"{"stepDis":5}],
    ["$n20_gear6", "range", "kW", "Nitrous Oxide", 75, 25, 500, "6th Gear shot size", "Power increase the N2O injection grants in 6th gear"{"stepDis":5}],
    ],
    "n2o": {
    "addedPower":["$n20_gear1", "$n20_gear2", "$n20_gear3", "$n20_gear4", "$n20_gear5", "$n20_gear6"],
    },
     
  2. Destroyer247_52

    Destroyer247_52
    Expand Collapse

    Joined:
    Mar 9, 2015
    Messages:
    188
    Personally I'd think you'd have better luck attempting to modify the nitrousOxideInjection.lua in the game to accommodate and track what gear and calculate a percentage per gear of a maximum value to use to modify the engines torque figures. It appears that the .lua uses a preset table and the engines rpm to calculate how much the n2o affects the engines output so it wouldn't be too hard to change. But one of the hard parts is getting the .lua to react to your new variables without breaking(which is something I have yet to figure out, most likely something that has to be added in the main.lua).
     
    • Agree Agree x 1
  3. Kalråttan

    Kalråttan
    Expand Collapse

    Joined:
    May 25, 2021
    Messages:
    1
    {
    "n2o_system": {
    "information":{
    "authors":"BeamNG",
    "name":"Nitrous Oxide Injection",
    "value":350,
    }
    "slotType" : "n2o_system",
    "slots": [
    ["type", "default", "description"]
    ["n2o_bottle","bottle", "Nitrous Oxide Bottle"],
    ["n2o_shot","size", "Nitrous Oxide Shot Size"],
    ],
    "variables": [
    ["name", "type", "unit", "category", "default", "min", "max", "title", "description"]
    ["$n20_gear1", "range", "kW", "Nitrous Oxide", 75, 25, 500, "1st Gear shot size", "Power increase the N2O injection grants in 1st gear"{"stepDis":5}],
    ["$n20_gear2", "range", "kW", "Nitrous Oxide", 75, 25, 500, "2nd Gear shot size", "Power increase the N2O injection grants in 2nd gear"{"stepDis":5}],
    ["$n20_gear3", "range", "kW", "Nitrous Oxide", 75, 25, 500, "3rd Gear shot size", "Power increase the N2O injection grants in 3rd gear"{"stepDis":5}],
    ["$n20_gear4", "range", "kW", "Nitrous Oxide", 75, 25, 500, "4th Gear shot size", "Power increase the N2O injection grants in 4th gear"{"stepDis":5}],
    ["$n20_gear5", "range", "kW", "Nitrous Oxide", 75, 25, 500, "5th Gear shot size", "Power increase the N2O injection grants in 5th gear"{"stepDis":5}],
    ["$n20_gear6", "range", "kW", "Nitrous Oxide", 75, 25, 500, "6th Gear shot size", "Power increase the N2O injection grants in 6th gear"{"stepDis":5}],
    ["$n2o_rpm", "range", "RPM", "Nitrous Oxide", 3500, 800, 15000, "Minimum RPM", "Minimum RPM where nitrous oxide can spray"{"stepDis":50}]
    ],
    "powertrain": [
    ["type", "name", "inputName", "inputIndex"],
    ],
    "mainEngine": {
    "nitrousOxideInjection": "n2o",
    },
    "n2o": {
    "cutInRPM": "$n2o_rpm",
    "minimumGear": "$n2o_gear",
    },
    "controller": [
    ["fileName"],
    ["nitrousOxideInjection", {}],
    ],
    "vehicleController": {
    },
    "soundConfig": {



    I fixt it
    },
    }
    "bottle": {
    "information":{
    "authors":"BeamNG",
    "name":"Nitrous Oxide Bottle",
    "value":200,
    }
    "slotType" : "n2o_bottle",

    "powertrain": [
    ["type", "name", "inputName", "inputIndex"],
    ],
    "energyStorage": [
    ["type", "name"],
    ["n2oTank", "mainBottle"],
    ],
    "mainBottle": {
    "capacity": 4.54,
    "startingCapacity": 4.54,
    }
    "mainEngine": {
    "energyStorage": ["mainTank", "mainBottle"],
    }
    "n2o": {
    "purgeValves:": ["f6r","f1r"],
    },
    "nodes": [
    {"group":"n2o_bottle"},
    {"nodeWeight":11},
    {"engineGroup":"n2o_bottle"}
    {"collision":false},
    ],
    "beams": [ ],
    }

    "size": {
    "information":{
    "authors":"BeamNG",
    "name":"Shot Size",
    "value":200,
    }
    "slotType" : "n2o_shot",
    "variables": [
    ["name", "type", "unit", "category", "default", "min", "max", "title", "description"]
    ["$n2o_power", "range", "kW", "Nitrous Oxide", 75, 25, 500, "Added Power", "Power increase the N2O injection grants"{"stepDis":5}]
    ["$n2o_capacity", "range", "L" ,"Nitrous Oxide", 4.54, 1.00, 25.0, "Nitros", "How much boost?"{"minDis":1, "maxDis":25, "stepDis":1}]
    ],
    "n2o": {
    "addedPower": "$n2o_power",
    },
    "mainBottle": {
    "capacity": "$n2o_capacity",
    "startingCapacity": "$n2o_capacity",
    }
    }
    }
     
  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