R.E.Z. Posted May 19, 2014 Share Posted May 19, 2014 Hello, I am working on a level, where different messages should be played in the backround. Do You know a scrit in Lua, that does this: randomise different sounds in the Backround? That would be really neat Does anyone knew help for this purpose? Have a nice day, C.U. R.E.Z. Quote Leadwerks Standart Edition RTS Creator Link to comment Share on other sites More sharing options...
Rick Posted May 19, 2014 Share Posted May 19, 2014 http://www.leadwerks.com/werkspace/files/download/420-random-output-scripts/ Place a pivot in your scene and attach this script to it (pick how many different sounds you want from 2-4 (if you need more you can see how to alter the script). Place pivots in your scene for each sound and attach the already available noise.lua script in your Scripts directory to them and assign your sounds. http://www.leadwerks.com/werkspace/files/file/419-scene-loaded/ Place another pivot in your scene and attach this script to it. Open the flowgraph editor and drag from the scene tab all these entities into the flowgraph. Drag the startup node output to the random node input. Then drag each random output to 1 noise play input. You are saying that when your scene starts call this random node which will randomly pick one of it's outputs to fire. That output is connected to the noise input to play the sound. If you want this to repeat then on each noise node finished output you can link it back to the random node input. This is the beauty of the flowgraph. Being able to piece together more complex functionality from basic components instead of having to rewrite everything specifically for your game! If you want a delay between sounds then place a pivot in the scene and attach http://www.leadwerks.com/werkspace/files/file/412-le3-timer-node/ . Fill out it's properties. Drag it into the flowgraph and link all noise nodes outputs to this timer nodes start and enable and then link it's tick output back to the random node input AND to itself disable to stop the timer. If you need help I can create the flowgraph tonight and show you the picture of how it should look. All of this functionality with 0 programming from your side 1 Quote Link to comment Share on other sites More sharing options...
R.E.Z. Posted May 20, 2014 Author Share Posted May 20, 2014 Hello Rick, thank You for Your very detailled answer and help to me I will go for that. Sounds really good. Thank You a lot Have a great week, C.U. R.E.Z. Quote Leadwerks Standart Edition RTS Creator Link to comment Share on other sites More sharing options...
R.E.Z. Posted June 14, 2014 Author Share Posted June 14, 2014 Hello, now I received a script error (New Post): http://www.leadwerks.com/werkspace/topic/10051-script-error-using-random-scripts/ C.U. R.E.Z. Quote Leadwerks Standart Edition RTS Creator Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.