my custom scenario completion is wrong!

Discussion in 'Scenarios' 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.
    --- Post updated ---
    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
    --- Post updated ---
    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 since it is placed at the start.
    --- Post updated ---
    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.
     

    Attached Files:

    • luapt1.png
    • luapt2.png
    • image_2022-02-18_081811.png
    • image_2022-02-18_081909.png
  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