Pulling Random Data

Padrinos
If I have various groups of monsters, can I have the encounters be random where they can pull one of the groups to fight. I know you can use this to get the random number based on what you set, such as 1 through 30 below:
var randomnumber = function rng(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}

set ("kill", randomnumber(1,30));
set ("life", get("life") + get("kill"));
<br>

But is there a way to have the random number pull a specific response, such as assigning each number to a monster group?

leobos67
You can try something like this:

Clicking this [link] you'll see a group of monsters.

[link]:
var monsters=['vampires','zombies','orcs','goblins','undeads'];
var getRndMonsters=function()
{return monsters[Math.floor(Math.random()*monsters.length)];}
squiffy.set('monsters',getRndMonsters());

You can see a group of {monsters}.

Padrinos
What if I labeled each group, or more simply a question. 1 through whatever and used the random number generated like I posted above, could that number be pulled? Hmmm
This one is tricky

This topic is now closed. Topics are closed after 180 days of inactivity.

Support

Forums