Unsolved Add laps to loaded scenario

Discussion in 'Mod Support' started by bidwars, Oct 23, 2018.

  1. bidwars

    bidwars
    Expand Collapse

    Joined:
    Sep 23, 2014
    Messages:
    171
    I have not found an easy way to add the number laps after a scenario has been fully loaded and in running mode. It looks like we cannot change the scenario table in the scenarios file from any other function except for executeScenario but If I do this it completely reloads the scenario again. The only other option I see is to create a quickrace which creates a whole other set of problems. Any idea's?
     
  2. bidwars

    bidwars
    Expand Collapse

    Joined:
    Sep 23, 2014
    Messages:
    171
    I guess what I am saying is I need a way to edit the scenario_scenario.getScenario().
     
  3. bidwars

    bidwars
    Expand Collapse

    Joined:
    Sep 23, 2014
    Messages:
    171
    I created a function to do this. It takes the current scenario file and creates a function to update the scenario. It then resaves the scenario back with the new function.

    local function updateScenarioData(scenario)
    local newScenario = scenario
    local copyScenario = scenario_scenarios
    copyScenario['setScenario'] = function(sc)
    scenario = sc
    end
    scenario_scenarios = copyScenario
    scenario_scenarios.setScenario(newScenario)
    end
     
  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