Hello all, first time posting as I'm currently stuck as to what to do, I'm trying to make it so you can take the woefully tiny 10lb No2 bottles and make them near infinite, as I have very little lua knowledge this doesn't help, but any help or suggestions would be appreciated
To do this, all you need to do is add a variable in the jBeam, no lua knowledge needed Stock 10lb N2O bottle: Code: "n2o_bottle_10lb": { "information":{ "authors":"BeamNG", "name":"10lb Nitrous Oxide Bottle", "value":200, } "slotType" : "n2o_bottle", "flexbodies": [ ["mesh", "[group]:", "nonFlexMaterials"], ], "props": [ ["func", "mesh", "idRef:", "idX:", "idY:", "baseRotation", "rotation", "translation", "min", "max", "offset", "multiplier"] {"optional":true} ["null", "n2o_bottle_10lb", "b7ll","b7","b8ll", {"x":90, "y":90, "z":175}, {"x":0, "y":0, "z":0}, {"x":0, "y":0, "z":0}, 0, 0, 0, 1, {"baseTranslation":{"x":0.13,"y":0.1, "z":0.09}}], {"optional":false} ], "powertrain": [ ["type", "name", "inputName", "inputIndex"], ], "energyStorage": [ ["type", "name"], ["n2oTank", "mainBottle"], ], "mainBottle": { "capacity": 4.54, "startingCapacity": 4.54, } "mainEngine": { "energyStorage": ["mainTank", "mainBottle"], } "n2o": { "purgeValves:": ["b11r","b1r"], }, "nodes": [ ["id", "posX", "posY", "posZ"], //--N2O Bottle-- {"nodeMaterial":"|NM_METAL"}, {"frictionCoef":0.5}, {"collision":true}, {"selfCollision":false}, {"group":"n2o_bottle"}, {"nodeWeight":11}, {"engineGroup":"n2o_bottle"} ["n2o", 0.42, 1.92, 0.63], {"engineGroup":""} {"group":""}, {"collision":true}, ], "beams": [ ["id1:", "id2:"], {"beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0}, {"beamSpring":1501000,"beamDamp":150}, {"beamDeform":15000,"beamStrength":"FLT_MAX"}, ["n2o", "b7ll"], ["n2o", "b8ll"], ["n2o", "b7"], ["n2o", "b8"], {"beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0}, ], } Adjustable N2O bottle: Code: "n2o_bottle_adjustable":{ "authors":"BeamNG, BombBoy4", "name":"Adjustable Nitrous Oxide Bottle", "value":200, } "slotType" : "n2o_bottle", "flexbodies": [ ["mesh", "[group]:", "nonFlexMaterials"], ], "props": [ ["func", "mesh", "idRef:", "idX:", "idY:", "baseRotation", "rotation", "translation", "min", "max", "offset", "multiplier"] {"optional":true} ["null", "n2o_bottle_10lb", "b7ll","b7","b8ll", {"x":90, "y":90, "z":175}, {"x":0, "y":0, "z":0}, {"x":0, "y":0, "z":0}, 0, 0, 0, 1, {"baseTranslation":{"x":0.13,"y":0.1, "z":0.09}}], {"optional":false} ], "powertrain": [ ["type", "name", "inputName", "inputIndex"], ], "energyStorage": [ ["type", "name"], ["n2oTank", "mainBottle"], ], "variables": [ ["name", "type", "unit", "category", "default", "min", "max", "title", "description"] ["$n2o_capacity", "range", "lb", "Nitrous Oxide", 10, 0, 1000, "Capacity", "Capacity of N2O bottle."{"stepDis":5}] ], "mainBottle": { "capacity": "$n2o_capacity", "startingCapacity": "$n2o_capacity", } "mainEngine": { "energyStorage": ["mainTank", "mainBottle"], } "n2o": { "purgeValves:": ["b11r","b1r"], }, "nodes": [ ["id", "posX", "posY", "posZ"], //--N2O Bottle-- {"nodeMaterial":"|NM_METAL"}, {"frictionCoef":0.5}, {"collision":true}, {"selfCollision":false}, {"group":"n2o_bottle"}, {"nodeWeight":11}, {"engineGroup":"n2o_bottle"} ["n2o", 0.42, 1.92, 0.63], {"engineGroup":""} {"group":""}, {"collision":true}, ], "beams": [ ["id1:", "id2:"], {"beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0}, {"beamSpring":1501000,"beamDamp":150}, {"beamDeform":15000,"beamStrength":"FLT_MAX"}, ["n2o", "b7ll"], ["n2o", "b8ll"], ["n2o", "b7"], ["n2o", "b8"], {"beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0}, ], } Haven't tested it as I created it in about a minute, but that should be all that's needed.
Sounds easy enough, how would I do that? Would it go in the lua\vehicle\energyStorage\n2oTank? I'm clueless on how to set about this, so a bit of a walkthrough would be amazing
Nope, no lua is actually needed for this. There's a section in jBeam that defines variables Code: "variables": [ ["name", "type", "unit", "category", "default", "min", "max", "title", "description"] ["$n2o_capacity", "range", "lb", "Nitrous Oxide", 10, 0, 100, "Capacity", "Capacity of N2O bottle."{"stepDis":5}] ], and then all you have to do is use the variable Code: "mainBottle": { "capacity": "$n2o_capacity", "startingCapacity": "$n2o_capacity", } An example of variables that you probably use often is the alignment tuning menu Code: "variables": [ ["name", "type", "unit", "category", "default", "min", "max", "title", "description"] ["$camber_FR", "range", "", "Alignment", 0.99, 0.96, 1.03, "Front Right Camber", "Percentage of adjustment range"] ["$camber_FL", "range", "", "Alignment", 0.99, 0.96, 1.03, "Front Left Camber", "Percentage of adjustment range"] ["$caster_FR", "range", "", "Alignment", 1, 0.985, 1.015, "Front Right Caster", "Percentage of adjustment range"], ["$caster_FL", "range", "", "Alignment", 1, 0.985, 1.015, "Front Left Caster", "Percentage of adjustment range"], ["$trackwidth_F", "range", "m", "Wheels", 0.325, 0.325, 0.355, "Front Track Width", "Widen or narrow the wheel track"{"stepDis":0.005}] ], A few notes: "name"is the name that you enter into any value you want that variable to control, make sure to have quotes ("") and a dollar symbol ($) "type" is the type of data entered in, usually range "unit" is what you see after the slider, just telling what unit you are controlling it by (%, RPM, or lb to name a few) "category" is what header the tune is under (ex. alignment in the above image) "default" is the default value set "min/max/title/description" self-explanitory You can find the N2O jBeam files under BeamNG.drive\content\vehicles\VEHICLE.zip\vehicles\VEHICLE\VEHICLE_n2o.jbeam
So where would I paste those first two code sections? would it be in a new file or in either n2otank or nitrousoxideinjection?
The attached file is where I'm at with this idea, when placed in a zipped folder, in the mods folder, it is loaded by beamng(viewable in the game), but no part or variable shows in the menus.
No no, you have to put the file into the right folders. What car do yo want it in? If you want it in say, the Barstow, you'd put the file in /MODNAME.zip/vehicles/barstow/N2otank.jbeam. Here's a quick tutorial on paths.
Okay so I've got it set up like this Documents\BeamNG.drive\mods\Variable N2o Tank v0.1.zip\Vehicles\etki\N2otank, but it isn't showing up in the vehicle menu anywhere... Am I doing something wrong?
Don't use dots in the file name (generally speaking spaces are a bad thing too). Also it's "vehicles" not "Vehicles", not sure if that matters.
Dots don't matter 9 times out of 10, and neither do letter-case. As a rule of thumb don't use either, but it shouldn't matter. Also, work in an unpacked folder, makes it much easier.