Code: ], "soundscape": [ ["name", "src"], ["siren", "radio/1.ogg"], Does anyone know how to replace the "1" with a variable so I can select between multiple tracks?
It depends on your mod. If your siren are selectable, just write several parts. Like this: Code: "X1":{ ... ... ... "soundscape": [ ["name", "src"], ["siren", "radio/1.ogg"], ... ... }, "X2":{ ... ... ... "soundscape": [ ["name", "src"], ["siren", "radio/2.ogg"], ... ... }, "X3":{ ... ... ... "soundscape": [ ["name", "src"], ["siren", "radio/3.ogg"], ... ... }, "X4":{ ... ... ... "soundscape": [ ["name", "src"], ["siren", "radio/4.ogg"], ... ... }, But if your sirens aren't selectable, I recommended you to write your these codes in your: In the jbeam: Code: "soundscape": [ ["name", "src"], ["siren", "radio/1.ogg"], ["siren", "radio/2.ogg"], ["siren", "radio/3.ogg"], ["siren", "radio/4.ogg"], And in your lua: Code: local siren1 = nil local siren2 = nil local siren3 = nil local siren4 = nil local function onInit() siren1 = siren1 or sounds.createSoundscapeSound("siren1") siren2 = siren2 or sounds.createSoundscapeSound("siren2") siren3 = siren3 or sounds.createSoundscapeSound("siren3") siren4 = siren4 or sounds.createSoundscapeSound("siren4") --- Post updated --- If you do it, you'll have several tracks and you can use them
I don't have a lua file, I would make one but I don't know the code. I'm just using the soundscape with the default lightbar function. Can I not use variables then?
Try something like this in .jbeam file. It will make several parts in a slot. Code: "X1":{ ... ... ... "soundscape": [ ["name", "src"], ["siren", "radio/1.ogg"], ... ... }, "X2":{ ... ... ... "soundscape": [ ["name", "src"], ["siren", "radio/2.ogg"], ... ... }, "X3":{ ... ... ... "soundscape": [ ["name", "src"], ["siren", "radio/3.ogg"], ... ... }, "X4":{ ... ... ... "soundscape": [ ["name", "src"], ["siren", "radio/4.ogg"], ... ... },