Unsolved make a Lua Triggerbox work only once

Discussion in 'Mod Support' started by petlua, Feb 12, 2023.

  1. petlua

    petlua
    Expand Collapse

    Joined:
    Nov 1, 2013
    Messages:
    12
    Currently working on sound pacenotes for the Dakar Style Mod.

    I am using this function to play a sound when the triggerbox is entered. But I want it to be played only at the first drivethrough/until the car is reset:

    local function mysoundCP01 (data)
    if data.event == "enter" then
    Engine.Audio.playOnce('AudioGui','sounds/petlua_dakar_01/sound_01.mp3')
    end
    end

    mysoundCP01


    Help is much appreciated!
     

    Attached Files:

    • BeamNGdrive-0272014705-RELEASE-x641202202300_45_54.png
  2. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,424
    Just add some value that checks if it already triggered before, should work but idk how triggers work so maybe it won't
     
  3. petlua

    petlua
    Expand Collapse

    Joined:
    Nov 1, 2013
    Messages:
    12
    Have tried that and several other methods. Not working so far.
     
  4. petlua

    petlua
    Expand Collapse

    Joined:
    Nov 1, 2013
    Messages:
    12
    Solved. Counters or similiar stuff must be implemented in the modScript.lua file.
     
  5. MysteryManGER

    MysteryManGER
    Expand Collapse

    Joined:
    May 25, 2016
    Messages:
    748
    Sorry for bumping the "old" thread...but my question is related to this one.

    Is there a possibility that the sound only plays when you are inside the trigger - and stops when you leave it?
     
  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