[Tutorial] How to make automatic lights for your map. (with pics, gifs and video)

Discussion in 'Content Creation' started by S.Ali.M, Jul 10, 2021.

  1. S.Ali.M

    S.Ali.M
    Expand Collapse

    Joined:
    Jan 12, 2021
    Messages:
    1,079
    Hello everyone!

    It's a tutorial about how to make automatic lights for a map.

    This tutorial recorded on 0.22 but it works on 0.23 too

    I saw some questions about adding automatic lights to a map, so here's a tutorial for it.
    Well, back to the main subject. Here's what you should do:

    1. Add spot/point lights to your map.
    Screenshot_20210710-202601_Gallery.jpg
    2. Add a new group to your map.
    Screenshot_20210710-194811_Gallery.jpg

    3. (You don't need to do it but doing it is recommended). Rename that group to whatever you want. It's not important at all but a I prefer rename it to "auto_lights".


    4. Select the lights that you want to make them automatic, drag them, then drop them in the new group.


    5. Save the level.
    Screenshot_20210710-195316_Gallery.jpg

    6. Close the game

    7. Go to Beamng.drive/content/levels. Open small_island file. Next, go to levels/small_island, then you'll see a lua file called "mainLevel.lua". Copy it (or extract it, then copy it).

    8. Go to 0.23/levels. Then you'll see the folder of your edited map. Open it, then paste the mainLevel.lua file.

    9. Open the lua file, next, in the 27, 28 and 29 lines, you can see needed codes. Don't edit other lines
    (In this case, I don't need the line 29 so I delete it, because I have just 1 group that I want to make it automatic. If you have several groups that you want to make them automatic, you should write several lines.)
    Now, delete the harbour_lights and write the group name instead.



    10. Save the lua file

    11. Finish. Now you have automatic lights!


    Here's a video for all of these steps in the attachment files. (Sorry I don't have time to upload it on the YouTube)

    If you have any question, ask me here.
     

    Attached Files:

    • Like Like x 12
  2. prominecraft928

    prominecraft928
    Expand Collapse

    Joined:
    May 9, 2021
    Messages:
    17
    i edited a runway with adding light on a map called river high way. the problem is, i cant find the mainLevel.lua inside it, that file doesnt exists inside it, any solution?
     
  3. unyxium

    unyxium
    Expand Collapse

    Joined:
    Mar 30, 2019
    Messages:
    80
    It doesn't have one so just create the file instead.
     
    • Agree Agree x 1
  4. prominecraft928

    prominecraft928
    Expand Collapse

    Joined:
    May 9, 2021
    Messages:
    17
    wait so just create "mainLevel.lua" that was empty? i mean its empty so what do i do with that auto light thing "line 27 - 29" or whatever?
     
  5. unyxium

    unyxium
    Expand Collapse

    Joined:
    Mar 30, 2019
    Messages:
    80
    The tutorial tells you to copy the file from small island, just do that
     
    • Agree Agree x 2
  6. prominecraft928

    prominecraft928
    Expand Collapse

    Joined:
    May 9, 2021
    Messages:
    17
    oooh good idea, ill try it
     
  7. ltntai

    ltntai
    Expand Collapse

    Joined:
    Mar 18, 2017
    Messages:
    656
    Is it possible to make two or more light groups (SceneTree folders) that turn on and off at different times of day? How should the lua file be re-written to separate the groups?
     
  8. S.Ali.M

    S.Ali.M
    Expand Collapse

    Joined:
    Jan 12, 2021
    Messages:
    1,079
    Of course it's possible.
    I haven't tried it yet but this code should work.
    Just change the time of day of each group and change GROUP1_NAME, GROUP2_NAME and GROUP3_NAME to the name of your groups.
    You can also copy the codes of each group to have more than 3 groups. Just change the number of the value and lastValue to 4, 5 and more.
     

    Attached Files:

    • Like Like x 3
  9. ltntai

    ltntai
    Expand Collapse

    Joined:
    Mar 18, 2017
    Messages:
    656
    It works perfectly. Thank you for taking your time to help.
     
    • Like Like x 1
  10. AlecBarronDrift

    AlecBarronDrift
    Expand Collapse

    Joined:
    Feb 13, 2023
    Messages:
    1
    This method still works great in case anyone references it. i had to watch the video posted for clarity but worked like a charm once i did!
     
    • Like Like x 1
  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