1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice
  3. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.35 Bug Reporting thread
    Solutions and more information may already be available.

HELP! My custom scenario's end message is wrong!

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by anthony1993, Feb 18, 2022.

  1. anthony1993

    anthony1993
    Expand Collapse

    Joined:
    Feb 17, 2022
    Messages:
    3
    I have been creating a sprint using the Deals Gap (The Dragons Tail) mod map and with a prelude and a civic racing. Everything works fine until you cross the finish, if I place 2nd it still tells me "success!" and my position was 1st, even though I was clearly behind the other racer. The scenario files are copies of the mountain race scenario, just slightly tweaked for my waypoints and my recorded path for the scenario opponent.

    I believe my issue is in the json, because I have read something on having "goals" in the syntax, but this could be it too.


    local function onBeamNGTrigger(data)
    log('I', logTag,'onBeamNGTrigger called ')
    dump(data)

    if data.subjectName == aiInstance and data.triggerName == finalTriggerName and data.event == 'enter' then
    --Since the end trigger is on the start line, the ai drives once into it at the start of the race, and once at the end. We need to detect only when AI finishes
    triggerCount = triggerCount + 1

    if triggerCount >= 2 then
    aiFinished = true
    end
    end
    end

    since mountain race is a looped race (which I didn't know.) I believe the issue is within that function onBeamNGTrigger because it says the ai will pass through the trigger twice since it is placed at the start.
     
  2. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,414
    Well the code literally says that the AI must pass the finish line 2 times to win. Change triggerCount from 2 to 1 and it should work.
     
  3. anthony1993

    anthony1993
    Expand Collapse

    Joined:
    Feb 17, 2022
    Messages:
    3
    Damn I feel like an idiot, thank you very much, it worked!
     
  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