R.E.Z. Posted June 14, 2014 Share Posted June 14, 2014 Hello, I do reffer to the following random files: http://www.leadwerks.com/werkspace/files/download/420-random-output-scripts/ When I do use f.e. the random4.lua script, I get the following Script Error: attempt to index global 'os' (a nil value) Line 2 math.randomseed(os.time()) Might anyone know help to this problem? That would be great C.U. R.E.Z. Quote Leadwerks Standart Edition RTS Creator Link to comment Share on other sites More sharing options...
Rick Posted June 14, 2014 Share Posted June 14, 2014 Maybe Josh removed os object? Just comment out that line to see if you can get things working. That line just makes sure you get a random output. Without it, you'll get the same one each time, but for testing just comment it out to make sure it works. Then we can work on how to get that working again. Quote Link to comment Share on other sites More sharing options...
R.E.Z. Posted June 15, 2014 Author Share Posted June 15, 2014 Hello, @ Rick: Now I commented this line out: --math.randomseed(os.time()) I do receive no Script Error anymore ... but ... ALL 4 sounds are played simultaneously. No random effect. What object or (variable?) could be randomed to substitude a 'os-object' to make it work? Does anyone might new help? C.U. R.E.Z. Quote Leadwerks Standart Edition RTS Creator Link to comment Share on other sites More sharing options...
Ma-Shell Posted June 15, 2014 Share Posted June 15, 2014 try "Time:Millisecs()" instead of "os.time()" for seeding. For your other issue we need more of your code Quote Link to comment Share on other sites More sharing options...
Genebris Posted June 15, 2014 Share Posted June 15, 2014 I have got this problem today after updating my project it project manager. Disable "Sandbox lua" in the editor options and it will work. Quote Link to comment Share on other sites More sharing options...
Rick Posted June 15, 2014 Share Posted June 15, 2014 @REZ I wouldn't think not having a randomized time would play all 4 sounds. Can you show a screenshot of your flowgraph setup? Quote Link to comment Share on other sites More sharing options...
Josh Posted June 15, 2014 Share Posted June 15, 2014 By default, Lua games run from the editor are now run in sandbox mode. This disables potentially dangerous libraries like the os library. There's a checkbox in the Options dialog you can use to disable sandboxing. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
R.E.Z. Posted June 17, 2014 Author Share Posted June 17, 2014 Hello, thank You for Your Help With the change "Time:Millisecs()" the script runns with sandbox.lua enabled. Keeping the script in original style "os.time()" the script runns when sandbox.lua disabled. But ... In both cases the 4 sounds are played simultaneously. I am sorry, cant load up a screen of my flowgraph. (Do not own Webspace) Might anyone knew help? That would be nice C.U. R.E.Z. Quote Leadwerks Standart Edition RTS Creator Link to comment Share on other sites More sharing options...
Admin Posted June 17, 2014 Share Posted June 17, 2014 Press the "More Reply Options" button below to enter the full message composer. You can attach images to your post there. Quote Link to comment Share on other sites More sharing options...
Rick Posted June 18, 2014 Share Posted June 18, 2014 I'm glad to help as I wrote that script but need to see how you have your flowgraph setup. Quote Link to comment Share on other sites More sharing options...
R.E.Z. Posted June 19, 2014 Author Share Posted June 19, 2014 Hello, thank You Here is the screen: C.U. R.E.Z. Quote Leadwerks Standart Edition RTS Creator Link to comment Share on other sites More sharing options...
Rick Posted June 19, 2014 Share Posted June 19, 2014 I think that collision output is firing every frame which would make sense as to why it seems like all 4 are playing. It's probably playing constantly while you are inside the collision and on top of each other making it sound horrible right? Look in my sig for the wiki link and use the Lua section and look for the collision trigger script there. This one has an OnEnter and OnLeave that you can use to make it trigger once per collision. 1 Quote 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.