How to create a randomizer?
JakarottDBZ
22 Oct 2018, 12:44Hey i'm trying to create a randomizer for my game. I dunno how to do it. It's not mentioned anywhere!
For the randomizer i'm making, it's basically a list of stuff and i'm trying to randomize it and make it spit out a certain thing.
For example, there are three categories. A, B, and C. Now i all have items in the categories, and i'm trying to make it spit out three things, one from each category. The result of the randomization will end up like this:
(An item from category A)
(An item from category B)
(An item from category C)
Dgiunta100
24 Oct 2018, 16:44Hi. This works if you want a choice to go to a different direction randomly. I'm still working on how to add percentages to the choices.
[[home]]:
[[Go home.]](start)
[[start]]:
var names = ["sleep","work","play"];
var randInt = Math.floor(Math.random()*3)+0;
set("variable",names[randInt]);
[[{variable}]]
[[sleep]]:
I'm sleepy.
![](http://www.pethealthnetwork.com/sites/default/files/why-does-my-cat-sleep-so-much-461771577.jpg)
[[do it again]](home)
[[work]]:
boo work.
![]()
[[do it again]](home)
[[play]]: