1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Stuck, Having problems with creating your mod? Let us help you: Mod Support
  3. The ingame repository is currently offline for maintenance. Downloading and installing the mods manually via our website will still work: Repository
    Dismiss Notice

Introduction to scenarios creation

Discussion in 'Content Creation' started by Nadeox1, Jul 14, 2015.

  1. Peepsed

    Peepsed
    Expand Collapse

    Joined:
    Jul 12, 2015
    Messages:
    11
    I've been trying to make a simple drag race scenario but I'm having a hard time. As far as I can tell, there are no "goals" that detect when the AI has passed a waypoint? I just want the scenario to fail the user if the AI car passes a waypoint first.

    And since I'm here, is there anyway to allow the players car to rev beyond about 2500 rpm during the scenario count down?
     
    #201 Peepsed, Sep 13, 2017
    Last edited: Sep 13, 2017
  2. ThreeDTech21

    ThreeDTech21
    Expand Collapse

    Joined:
    Sep 26, 2013
    Messages:
    1,199
    I created a race scenario but my AI car won't drive, here is my .prefab and .json file. Much of it is copy pasted from the drag race scenario from jungle rock island, the scenario im creating is in Hirochi Raceway.


    Yellow AI car wont drive
    AICar.png

    .json
    Code:
    [
    {
        "name": "scenarios.jungle_rock_island.drag_race.title",
        "description": "scenarios.jungle_rock_island.drag_race.description",
        "authors": "BeamNG",
        "difficulty": "55",
        "date": 1456401873,
        "levelObjects": {
            "tod" : {
                "time" : 0.85,
                "dayLength" : 120,
                "play" : false,
                },
          
        },
        "blackListActions": ["toggleShifterMode"]
        "lapConfig": ["wp_player_target"],
        "radiusMultiplierAI": 3,
    },
    ]
    .prefab
    Code:
    //--- OBJECT WRITE BEGIN ---
    $ThisPrefab = new SimGroup() {
       canSave = "1";
       canSaveDynamicFields = "1";
          groupPosition = "0.000000 0.000000 0.000000";
    
       new BeamNGWaypoint(wp_target_distance) {
          drawDebug = "0";
          position = "-350.248993 169.878006 24.8045006";
          rotation = "1 0 0 0";
          scale = "1 1 1";
          canSave = "1";
          canSaveDynamicFields = "1";
       };
       new TSStatic() {
          shapeName = "levels/jungle_rock_island/art/shapes/race/race_rally_finish_checkpoint_red.dae";
          playAmbient = "1";
          meshCulling = "0";
          originSort = "0";
          useInstanceRenderData = "0";
          instanceColor = "White";
          collisionType = "Collision Mesh";
          decalType = "Collision Mesh";
          allowPlayerStep = "1";
          prebuildCollisionData = "0";
          renderNormals = "0";
          forceDetail = "-1";
          position = "684.166 -550.067 160.5";
          rotation = "0 0 1 141.857";
          scale = "1 1 1";
          canSave = "1";
          canSaveDynamicFields = "1";
       };
       new TSStatic() {
          shapeName = "levels/jungle_rock_island/art/shapes/race/race_rally_finish_checkpoint_red.dae";
          playAmbient = "1";
          meshCulling = "0";
          originSort = "0";
          useInstanceRenderData = "0";
          instanceColor = "White";
          collisionType = "Collision Mesh";
          decalType = "Collision Mesh";
          allowPlayerStep = "1";
          prebuildCollisionData = "0";
          renderNormals = "0";
          forceDetail = "-1";
          position = "707.797 -530.368 160.193";
          rotation = "0 0 1 139.809";
          scale = "1 1 1";
          canSave = "1";
          canSaveDynamicFields = "1";
       };
       new BeamNGWaypoint(wp_player_target) {
          drawDebug = "0";
          position = "-386.574005 236.376999 24.9909";
          rotation = "1 0 0 0";
          scale = "6 6 6";
          canSave = "1";
          canSaveDynamicFields = "1";
       };
       new BeamNGWaypoint(wp_ai_target) {
          drawDebug = "0";
          position = "-386.574005 236.376999 24.9909";
          rotation = "1 0 0 0";
          scale = "6 6 6";
          canSave = "1";
          canSaveDynamicFields = "1";
       };
       new BeamNGVehicle(aiCar) {
          JBeam = "sbr";
          color = "0.996078 0.960784 0.00392157 1.248";
          colorPalette0 = "White";
          colorPalette1 = "0.5 0.5 0.5 0";
          colorPalette2 = "White";
          colorPalette3 = "White";
          partConfig = "vehicles/sbr/hillclimb.pc";
          renderDistance = "500";
          renderFade = "0.1";
          isAIControlled = "0";
          dataBlock = "default_vehicle";
          position = "-390.542633 251.309128 25.2136135";
          rotation = "0.0859509 0.00601851 -0.996281 40.9113";
          scale = "1 1 1";
          canSave = "1";
          canSaveDynamicFields = "1";
       };
       new BeamNGVehicle(scenario_player0) {
          JBeam = "sbr";
          color = "0.0784314 0.109804 0.568627 1.132";
          colorPalette0 = "White";
          colorPalette1 = "White";
          colorPalette2 = "White";
          colorPalette3 = "White";
          partConfig = "vehicles/sbr/hillclimb.pc";
          renderDistance = "500";
          renderFade = "0.1";
          isAIControlled = "0";
          dataBlock = "default_vehicle";
          position = "-397.632874 253.663025 25.2136135";
          rotation = "0 0 -1 40.5897";
          scale = "1 1 1";
          canSave = "1";
          canSaveDynamicFields = "1";
       };
    };
    //--- OBJECT WRITE END ---
     
    #202 ThreeDTech21, Sep 19, 2017
    Last edited: Sep 19, 2017
  3. Gavril T85

    Gavril T85
    Expand Collapse

    Joined:
    Aug 14, 2017
    Messages:
    491
    (slight bump) Ok, I found out the answer to my other question. But whenever I repack the scenario folder thingy, It doesn't ask me where to save it to. Everything else about it seemed to work, until I reloaded it with all seven of my checkpoints (since it didn't save a .prefab AFIAK, I filled in the waypoints section myself.) None of the checkpoints were there except the first one, but when I went into the level editor, all the yellow sphere checkpoint thingies were where I put them. Here are some pictures to help:
    How I set it up in Notepad++
    Untitled.png

    Showing my Waypoints
    20171030171846_1.jpg
     
  4. Nadeox1

    Nadeox1
    Expand Collapse
    BeamNG.Support
    Staff Member

    Joined:
    Aug 5, 2012
    Messages:
    9,971
    Some things changed since I wrote this guide.
    The prefab saving should happen correctly in Documents/BeamNG.Drive/levels now.

    As for your problem, please note 'waypoints' vs 'Waypoints'.
    It's case sensitive IIRC.
     
  5. Instant Winrar

    Instant Winrar
    Expand Collapse

    Joined:
    Jun 12, 2015
    Messages:
    584
    Scenarios and Time Trials seem pretty similar in-game, and in the game files. Are there are any major differences between the two that I should know about?
    I can't find a guide or any information at all on the creation of Time Trials, but I don't see them being much different than Scenarios - That's why I'm asking in this thread.

    I have several scenarios I made for personal use that are simply short circuits that I wanted to time myself around, so I feel like turning some into Time Trials as I'd have a leader board of my results.
     
  6. RyvyLo

    RyvyLo
    Expand Collapse

    Joined:
    May 15, 2014
    Messages:
    384
    They are indeed pretty similar, and the creation process is the same. There are some differences though, if i remember correctly the main differences are :
    - The folder they're in
    - In the .prefab, the player position is no longer 'scenario_player0', it's represented by various spawn spheres for each case (normal, rolling start, etc...). The best thing to do is to copy-paste a spawn-sphere from an existing quickrace and change it's name.
    - In the .json the 'vehicle' field is no longer needed, and a bunch of new fields are in place
    - There are brackets on the .json that are here on scenarios and not in quickrace

    Anyway, it's easy to port scenarios to quickraces, the best way to do it is to open official files on one side and your scenario files in the other, then play a game of spot the differences. The name of the fields are pretty clear, so it should be easy to guess what the new functions does.

    EDIT : You could also check my Juggernaut scenarios, they have scenarios and quickraces for the same track, so it will be even faster to spot the differences.

    And while I'm at it, here are some useful things about quickraces :
    - prefab named yourQuickraceName_forward and yourQuickraceName_reverse are only loaded when the quickrace is not in reverse for the 1st one, and in reverse for the second one. Useful for signs for example
    - If you want to have custom lua extensions, the game looks for the .lua file to load in levels\theLevel\theQuickraceName.lua, and not in levels\theLevel\quickrace\theQuickraceName.lua. It doesn't work like the scenarios that looks in levels\theLevel\scenarios\theScenarioName.lua.
     
    #206 RyvyLo, Nov 8, 2017
    Last edited: Nov 8, 2017