Audio files are not added into build standalone game

  • #1, by vanyanieSaturday, 02. January, 14:55 2 weeks ago
    My character has an action that calls a Lua script to play different footstep sounds on different areas:
    local v = getObject("Values[FootstepSound]"):getStr(VValueString)
    local r = math.random(1,5)
    startSound("vispath:sounds/steps/" .. v .. r .. ".ogg", {flags=1, volume=20})
    1
    2
    3
    4

    The audio files are in the folder "sounds/steps" in my project folder (see picture)

    It workes very well when starting my game within Visionaire but when I build my game the output says "Missing sound/steps" (see picture) and the footstep audios are not play in the standalone game.

    How to fix that?

    Newbie

    10 Posts


  • #2, by SimonSSaturday, 02. January, 14:57 2 weeks ago
    Visionaire needs to now the files at build time, it can't runs these scripts and see what's coming out.

    So you need to have the paths like this:

    "vispath:sounds/steps/11.ogg", "vispath:sounds/steps/12.ogg", "vispath:sounds/steps/13.ogg"

    and select some of this table.

    Thread Captain

    1401 Posts

  • #3, by vanyanieSaturday, 02. January, 15:36 2 weeks ago
    I understand the problem, but not how to fix it.  The script part

    "vispath:sounds/steps/" .. v .. r .. ".ogg"
    1

    creates something like "sounds/steps/stone5.ogg"
    When I understand right, Visionare don't know the files bc it's not a fixed string, it's a string build on runtime. But how to tell VS there are files in folder x you need?

    What do you mean with "select some of this table"?

    Newbie

    10 Posts

  • #4, by SimonSSaturday, 02. January, 15:40 2 weeks ago
    You need to build up a table with all options in advance. Example:

    local soundtable = {
      stone = {
         "vispath:sounds/steps/stone1.ogg",
         "vispath:sounds/steps/stone2.ogg" ,
         "vispath:sounds/steps/stone3.ogg" ,
         "vispath:sounds/steps/stone4.ogg"
      },
      wood {
         "vispath:sounds/steps/wood1.ogg",
         "vispath:sounds/steps/wood2.ogg" ,
         "vispath:sounds/steps/wood3.ogg" ,
         "vispath:sounds/steps/wood4.ogg"
      }
    }

    local v = getObject("Values[FootstepSound]"):getStr(VValueString)
    local r = math.random(1,5)
    startSound(soundtable[v][r], {flags=1, volume=20})

    Thread Captain

    1401 Posts

  • #5, by vanyanieSaturday, 02. January, 17:08 2 weeks ago
    Ok, I wanted to avoid to work with a table like this but I see it's nessasary.
    Thank you, it workes.

    Newbie

    10 Posts

  • #6, by sebastianMonday, 04. January, 03:37 A week ago
    cant the table be built up dynamically as well? 

    Thread Captain

    2342 Posts

Write post