shanharlmal Posted October 9, 2015 Share Posted October 9, 2015 On the simplest level how would I make a prefab spawn lets say a rock, at a random time when it's doing a thing, like say running? That's really all I am looking for. I don't know LUA enough but I assume I would need a function that calls math.random() to generate a random 'time' but I don't know how to code in a time exactly, the only function I know that uses time values is the DoTaskInTime one. Link to comment https://forums.kleientertainment.com/forums/topic/58396-how-to-use-mathrandom/ Share on other sites More sharing options...
Arkathorn Posted October 9, 2015 Share Posted October 9, 2015 What do you mean? Why would a rock be running? I suggest you look at the code that causes gold nuggets to shine (found in scripts/prefabs/goldnugget.lua), and base your code off of that. Link to comment https://forums.kleientertainment.com/forums/topic/58396-how-to-use-mathrandom/#findComment-678961 Share on other sites More sharing options...
Mobbstar Posted October 10, 2015 Share Posted October 10, 2015 math.random() return a value between (including) 0 and (excluding) 1. It can be supplied with integers (whole numbers) to generate a random integer between 0 and the argument, or between two arguments. Link to comment https://forums.kleientertainment.com/forums/topic/58396-how-to-use-mathrandom/#findComment-679056 Share on other sites More sharing options...
pickleplayer Posted October 12, 2015 Share Posted October 12, 2015 math.random() return a value between (including) 0 and (excluding) 1. It can be supplied with integers (whole numbers) to generate a random integer between 0 and the argument, or between two arguments. so THATS what that does. I see it everywhere and never really knew what it was for Link to comment https://forums.kleientertainment.com/forums/topic/58396-how-to-use-mathrandom/#findComment-679596 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now