|
| 03 Oct 2013 02:38 PM |
How do I do math.random, chooses a number, and if it, for example, chose the first choice then it would do this?
I'm trying to make a weather script. 7 weathers (weather = {"Rain", "Thunder", "Fog", "Drizzle", "Foggy Rain", "Foggy Rain and Thunder", "Clear"}).
I know how to do the rest, just not the math.random if chose this then do that part, I forgot (I used to know). |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2013 02:44 PM |
rand = math.random(1, #weather) print(weather[rand]) |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2013 02:46 PM |
if rand = 1 then bla bla bla end
is that correct? |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2013 02:48 PM |
local weather = {"Rain", "Thunder", "Fog", "Drizzle", "Foggy Rain", "Foggy Rain and Thunder", "Clear"} local rand = math.random(1, #weather) if weather[rand] == "Thunder" then --stuff end |
|
|
| Report Abuse |
|
|