How to limit *rand?

I’m aware this is a weird question, but how do I code a random but organized set of *rands? Like, let’s say, I have

${die1}${die2} and ${die3}, 

and each can be any number between 1 and 3, but neither of those numbers can be repeated. I have no idea how to accomplish a “2 can’t appear 2 times” without an awful set of *ifs, specially since I was planning to replace each *rand number with a “Name” and that I meant to have five *rand variables instead of three.

Any easier way to do this?

So, if I understand correctly, you need a code that assigns a string to a variable based on a die roll and the values have to be unique? It’s actually not too hard to pull off.

*label dieroll
*set die1 0
*set die2 0
*set die3 0
*rand die1 1 5
*rand die2 1 5
*rand die3 1 5
*goto diecheck

*label diecheck
*if die1 = die2
  *goto dieroll
*elseif die1 = die3
  *goto dieroll
*elseif die2 = die3
  *goto dieroll
  *goto assignstring

*label assignstring
*if die1 = 1
  *set die1string "String1"
*elseif die1 = 2
  *set die1string "String 2"

*if die2 = 1
  *set die2string "String1"
*Elseif die1 = 2
  *set die2string "String2"

*if die3 = 1
  *set die3string "String1"
*elseif die3 = 2
  *set die3string "String2"

I don’t really recommend doing this kind of randomness as it makes replaying more difficult for the player and rarely provided unique experiences, but if you absolutely want to do it, that is the best method.

1 Like

Yeah, I understood how to set the strings and such, but was missing the diecheck to compare them. Thank you!

1 Like

Question resolved