Cancelled Scenario creation, Loading pre saved and damaged cars

Discussion in 'Content Creation' started by slowgergo, Oct 7, 2018.

Tags:
  1. slowgergo

    slowgergo
    Expand Collapse

    Joined:
    May 3, 2017
    Messages:
    25
    Disclaimer: I dont know if theres a page for this already but i didnt find it. So if it exist Sorry!

    I wanted to make a race with custom route. I followed the existing tutorial by Nadeox1. I succesfully created a working scenario with objects and checkpoints. But then I realized who am I going to race? I tried searching on the internet then I foun out I need to use .LUAs. I tried making my own but no luck. I dont just want to use .LUAs for this so borrowing one from someone is no good.

    I dont know how these commands work nor how to get them from the files. And what files exactly?
    If someone could link a tutorial or something I would appreciate it.

    Thanks for response and Have a good day!
     
  2. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
  3. slowgergo

    slowgergo
    Expand Collapse

    Joined:
    May 3, 2017
    Messages:
    25
    Wow didnt expect a reply that fast.
    Thank you for the reply and i will start learing. I dont have 3 hours a day for this lol but i can free up some time. ;)
     
  4. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    You don't need daily time, once a week would be ok, but important is that you can make 3 hours or more at one sitting without interruptions, because that is how you train your brain to programming mindset, doing 1 hour or less now and then tends to work at first, but as you get further in, it will be just frustrating as no progress is happening, so to really learn one needs to have those longer sessions, even if it is bit less often.

    This guy has very good points which might be helpful to anyone wanting to learn coding, if I would of known that 30 years ago, instead I never sat down enough long...
     
    • Like Like x 1
  5. slowgergo

    slowgergo
    Expand Collapse

    Joined:
    May 3, 2017
    Messages:
    25
    Thanks for your advice much appreciated!

    Sorry I wasnt clear in the question... Im not new to programming and I know that every language differs a bit in the syntax. Thats not why Im here. Im here to ask what functions BeamNG .lua uses and what values I can change. I read through the BeamNG page and no examples nor function signatures says like how to add ai or something. I kow I might sound stupid but is there a full function sheet or example file containing these? Or how other people who can do something like this: How you started?

    I think more experienced people struggle with this too. I started experimenting with this because I really like BeamNG and saw all the mods and cool scenarios and I wanted to make one.

    PS: Sorry for my english its not my mother languge.
     
    #5 slowgergo, Oct 10, 2018
    Last edited: Oct 15, 2018
  6. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Mostly I believe you need to open for example scenarios and see how they are made, then figure from there. It is kinda reverse engineering the thing. So you probably need to open scenario like Hectic Delivery zip file and start examining what is in there. It is kinda what that guy says on video about how bad documentation usually is in software companies, one just has to open the code and figure out from that.

    Not really why that is industry standard, but yeah it is kinda annoying, especially when one is starting.
     
    • Like Like x 1
  7. RyvyLo

    RyvyLo
    Expand Collapse

    Joined:
    May 15, 2014
    Messages:
    438
    When I started as a modder, I exclusively reverse-engineered scenarios to understand what I could and couldn't do with BeamNG. The most important thing to do in my personal opinion is to study the existing scenarios and the lua code in BeamNG.drive\lua\ge\extensions\scenario , and when you have a rough knowledge of what can and can't be done, you can start thinking how to split your problem into the existing functions. Another key point is to search on the forum, there's a lot of knowledge hidden in old threads. You can also of course ask, for example this is how I understood how the functions written in the .lua file were called ( https://www.beamng.com/threads/solved-scenario-lua-not-loading-first-time.27071/ )

    So, If I understand, you wanted to make scenarios where you have to race against the AI. The AI is currently not at it's best state and is pretty easy to beat, but you can balance the scenario by giving the AI a faster car for the moment. There's already the 'Mountain Race' scenario that has all the necessary code to make an AI race.
    I believe you will just need to copy that code to your scenario, and edit the 'arg' variable in the onRaceStart() function, with your ai car name and the waypoints it has to cross ( the waypoints need to be connected to the AI network of the map or the car won't move, they usually auto-connect when they are placed on a decalRoad node with AI enabled (use AI app to check that)). You can also tweak the rest of the code, hopefully you will be able to understand it.

    And don't forget to use the console, it will be your best friend at telling you where you messed up !
     
    • Like Like x 2
  8. Gamergull

    Gamergull
    Expand Collapse
    BeamNG Team

    Joined:
    Jun 3, 2018
    Messages:
    460
    Yeah, right now, examples and existing files are the best way to learn how to script with scenarios. Maybe in the future, some in depth documentation will be done. When I started making custom scenarios, I was confused, and I realized that I needed to learn from the existing scenarios. But actually, you do remember it after that. Stuff like onRaceStart, onRaceTick, scenetree.findObject("a"), a:queueLuaCommand()... you can learn and use it quickly.

    What I'd like to do is create an example scenario that has lots of useful functions in the Lua code. I think it would be a great learning resource.
     
    • Like Like x 2
  9. slowgergo

    slowgergo
    Expand Collapse

    Joined:
    May 3, 2017
    Messages:
    25
    A BIG thank you to all of you guys helping me!

    I experimented with AIs and i found out an interesting thing. I had a scenario already where I just dumped in an another car and the .lua copied from the Corridor scenario. And surprisingly It worked!!!
    Then immediately I started a new scenario on Hirochi Raceway, dumped in 2 more cars and used the first .lua, modified the waypoints and just to see oh no it doesnt move. I made the other car just flee: it worked perfectly, the other one still didnt move. I read that somewhere that I should use the decal road nodes. I tried and it worked too I had 2 moving cars, one is just flee the other went where I wanted it to go.

    The thing is why I have to use decal road nodes? Why isnt the normal waypoints work on Hirochi Raceway ( I had ai working on other maps... )? This is a problem because I cant rename them ( or I dont know how ), I cant move them and its annoying writing half of a sentence in the .lua for 30 nodes.

    If I get this to work I will start making a big campaign (and a sceanrio pack just to play one by one).
    Thank you so much for help you really help me out here!!!
     
    #9 slowgergo, Oct 13, 2018
    Last edited: Oct 13, 2018
  10. slowgergo

    slowgergo
    Expand Collapse

    Joined:
    May 3, 2017
    Messages:
    25
    So i started making a scenario pack with a storyline and got to 12 parts. Its not complete but i saw a thread today where Nadeox1 said you can save pre damaged vehicles like this:

    "From the Radial menu (that circle thing that appears when you press ESC), you should find buttons to 'Save/Load'." (https://www.beamng.com/threads/vehicle-damage-save-states.32243/)

    And then i wondered how to load this in a scenario? Or choose between multiple damage-saves for one car.

    So to sum it up: How to load multiple damage-saves for ETK-i and load it into a scenario? (only one at a time, for example: the 1st one needs dmgsave1 the 5th one needs dmgsave2)

    Thanks for help beforehand!
     
  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