LUA access to pre-race countdown

Discussion in 'Programming' started by SouthernPotato, Mar 5, 2025.

  1. SouthernPotato

    SouthernPotato
    Expand Collapse

    Joined:
    Feb 7, 2016
    Messages:
    123
    I have a mod for rally pacenote playback (linked below), and I'm looking for a LUA way to get the current race time (3 2 1 countdown) before a race start. My intention is to play audio queues for 3, 2, 1, go.

    I've found that there is a GUI hook for the race start app, but I specifically want to do it even if my mod's GUI isn't there

    https://www.beamng.com/resources/custom-rally-pacenotes.32263/
     
  2. r3eckon

    r3eckon
    Expand Collapse

    Joined:
    Jun 15, 2013
    Messages:
    595
    If the race is a scenario this line seems to works:
    Code:
    scenario_scenarios.onSerialize().countDownTime
    For a different gameplay mode there might be something similar but I haven't really looked too deep so I don't know if you can access the value through public getters. And unfortunately there doesn't seem to be any extension hook for each number, there's onCountdownEnded and onCountdownStarted. These aren't the same as GUI hooks because GUI hooks don't trigger lua functions so you can't really use them for anything other than GUI stuff (unless you have the GUI active which can then call lua after the gui hook function is called).
     
    • Like Like x 1
  3. SouthernPotato

    SouthernPotato
    Expand Collapse

    Joined:
    Feb 7, 2016
    Messages:
    123
    I did find I could hook into onCountenStarted but the only thing worse than no countdown is a poorly timed countdown - thanks for the insight
     
  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