Scenario cars with burst tyres

Discussion in 'Content Creation' started by Jurrunio, Jul 5, 2019.

  1. Jurrunio

    Jurrunio
    Expand Collapse

    Joined:
    Sep 23, 2015
    Messages:
    146
    I've seen bugs that cause this all the time, but is it possible to delibrately do it? Wanted to implement it for my mod.
     
  2. Gamergull

    Gamergull
    Expand Collapse
    BeamNG Team

    Joined:
    Jun 3, 2018
    Messages:
    460
    Yes, it is. If you're making a scenario and you want a vehicle to start with a burst tire, use this in the "driver" section of your .json file:

    Code:
    "command": "beamstate.deflateTire(0)",
    Alternatively, if you're good enough at Lua, you can use this line in a .lua file and trigger it in different ways:

    Code:
    scenetree.findObject("vehicleName"):queueLuaCommand("beamstate.deflateTire(0)")
    Btw, (0) is the tire ID (usually 0 to 3).
     
    • Informative Informative x 1
  3. Jurrunio

    Jurrunio
    Expand Collapse

    Joined:
    Sep 23, 2015
    Messages:
    146
    @Gamergull Like this?
    Code:
        "driver": {
            "command": "beamstate.deflateTire(3)",
        },
    I tried that and
    Code:
    "command": "beamstate.deflateTire(0)",
    in the json file but neither works
    --- Post updated ---
    This is the rest of the json file btw, total number of checkpoints not decided yet.
    Code:
    [
    {
        "name": "Mark 1 - Back home in Utah",
        "description": "Aftermath of some hooning in dirt, now you have to drive the ruined car back to where you came from earlier on.",
        "previews": ["Mark 1 - Back home in Utah.png"],
        "type": "race",
        "authors": "Jurrunio",
        
        "levelObjects": {
            "tod" : {
                "time" : 0.5,
                "dayLength" : 120,
                "play" : false,
            }
            
        },
    
        "difficulty": "50",
        
        "command": "beamstate.deflateTire(0)",
        
        "vehicles": {
            "scenario_player0": {"playerUsable": true, "startFocus": true },
            "*": {"playerUsable": false},
        },
        
        "whiteListActions": ["default_whitelist_scenario" ],
        "blackListActions": ["default_blacklist_scenario" ],
        
        //"lapConfig": ["p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9",
        // "p10", "p11", "p12", "p13", "p14", "p15", "p16", "p17", "p18",
        // "p19", "p20", "p21", "p22", "p22e1", "p23", "p24", "p25",
        // "p26", "p27", "p28", "p29", "p30", "p31", "p32", "p33", "p34"],
        "radiusMultiplierAI": 1
    },
    ]
     
  4. Gamergull

    Gamergull
    Expand Collapse
    BeamNG Team

    Joined:
    Jun 3, 2018
    Messages:
    460
    Ah, so "driver" should actually get nested after the vehicle name. Like this:

    Code:
      "vehicles": {
        "scenario_player0": {
          "driver": {
            "playerUsable": true,
            "startFocus": true,
            "command": "beamstate.deflateTire(0)"
          }
        },
        "*": {
          "driver": {
            "playerUsable": false
          }
        }
      },
    Make sure to double check the matching brackets.
     
    • Informative Informative x 1
  5. Jurrunio

    Jurrunio
    Expand Collapse

    Joined:
    Sep 23, 2015
    Messages:
    146
    @Gamergull So thanks to you, I can blow out one tyre at the start of the scenario. But what about two? I tried
    Code:
        "vehicles": {
            "scenario_player0": {
                "driver": {
                    "playerUsable": true,
                    "startFocus": true,
                    "command": "beamstate.deflateTire(2)"
                    "command": "beamstate.deflateTire(3)"
                }
            },
            "*": {
            "driver": {
                "playerUsable": false
                }
            }
        },
    and
    Code:
        "vehicles": {
            "scenario_player0": {
                "driver": {
                    "playerUsable": true,
                    "startFocus": true,
                    "command": {
                                     "beamstate.deflateTire(2)":
                                     "beamstate.deflateTire(3)"
                                   }
                }
            },
            "*": {
            "driver": {
                "playerUsable": false
                }
            }
        },
    Neither work. Seems like the game only execute beamstate.deflateTire(3).
     
  6. Gamergull

    Gamergull
    Expand Collapse
    BeamNG Team

    Joined:
    Jun 3, 2018
    Messages:
    460
    It may seem a bit counterintuitive, but you can stack commands by adding spaces, like this:

    Code:
    "command": "beamstate.deflateTire(1) beamstate.deflateTire(2) beamstate.deflateTire(3)",
     
    • Informative Informative x 1
  7. Jurrunio

    Jurrunio
    Expand Collapse

    Joined:
    Sep 23, 2015
    Messages:
    146
    @Gamergull Learnt it the hard way, actually it has to be like this
    Code:
        "vehicles": {
            "scenario_player0": {
                "playerUsable": true,
                "startFocus": true,
                "driver": {
                "command": "beamstate.deflateTire(0) beamstate.deflateTire(0)"
                },
            },
            "*": {"playerUsable": false},
        },
    having playerUsable and startFocus under driver stops the game from executing them properly, and I get freecam from the start instead of whatever driving camera
     
    • Like Like x 1
  8. Gamergull

    Gamergull
    Expand Collapse
    BeamNG Team

    Joined:
    Jun 3, 2018
    Messages:
    460
    Ah, my bad. I must've overlooked that when I was checking the format.
     
  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