Solved Can't get the mainlevel.lua to work on WCUSA with lights!

Discussion in 'Mod Support' started by DerPedda, Aug 7, 2023.

  1. DerPedda

    DerPedda
    Expand Collapse

    Joined:
    Aug 2, 2020
    Messages:
    27
    Hey there,

    I am currently working on update for both of my maps "East Coast USA with lights!" and "West Coast USA with lights!" but I can't get the mainlevel.lua which controls the lighting to work anymore.

    The new update added a code for the garage on West Coast USA and it prevents me with my knowledge about this stuff, to get the original code to work.

    Code used 'till now :

    local M = {}
    local function setAllLightsEnabled(group, value)
    for i = 0, group.obj:getCount(), 1 do
    local id = group.obj:idAt(i)
    local obj = scenetree.findObjectById(id)
    if obj and obj.obj:isSubClassOf('LightBase') then
    obj.obj:setLightEnabled( value )
    end
    end
    end
    local lastValue = nil
    local function onUpdate()
    local tod = scenetree.tod
    if not tod then return end
    local value = false
    if tod.time > 0.21 and tod.time < 0.77 then
    value = true
    end
    if lastValue == value then return end
    lastValue = value
    if scenetree.auto_repair_lights then
    setAllLightsEnabled(scenetree.auto_repair_lights, value )
    setAllLightsEnabled(scenetree.tourist_center_lights, value )
    end
    end
    M.onUpdate = onUpdate
    return M



    The code on West Coast USA (currently) :

    local M = {}
    -- garage lights
    --local function setupGarageTables() -- creates garage lights data
    --if true then
    --extensions.load('core_extendedTriggers')
    --core_extendedTriggers.setup()
    --return
    --end
    --end
    return M





    Any help is appreciated
     
  2. SSRG

    SSRG
    Expand Collapse

    Joined:
    Jun 17, 2023
    Messages:
    4,332
    I have no clue how Lua works, but have you tried putting your code’s „inside” (between „local M” and „return M”) into copy of WCUSA’s files’ „inside”?
    So like this:
    local M
    [garage stuff]
    [your stuff]
    return M
     
  3. DerPedda

    DerPedda
    Expand Collapse

    Joined:
    Aug 2, 2020
    Messages:
    27
    Thanks for the reply.

    I am gonna try that right away.

    Edit :

    It didn't work.
    Or better, it might work but the main Menu background covers the game.
    I can drive the car (hear it driving) and I see the UI but the main Menu background covers everything when I load this map.
     
    #3 DerPedda, Aug 8, 2023
    Last edited: Aug 8, 2023
  4. SSRG

    SSRG
    Expand Collapse

    Joined:
    Jun 17, 2023
    Messages:
    4,332
    Huh.
     
  5. DerPedda

    DerPedda
    Expand Collapse

    Joined:
    Aug 2, 2020
    Messages:
    27
    Solved the issue by removing unnecessary lines from the code which referred to ingame-folders which weren't on the map.
     
  6. SSRG

    SSRG
    Expand Collapse

    Joined:
    Jun 17, 2023
    Messages:
    4,332
    Ah, that’s good.
     
  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