How to make an RNG? (Words not number)

I’m having trouble with making an RNG

I am not a programmer, so I basically just try to make a game blindly xD but I know some basic…

My code looks like this:
Next is your destiny… what is your natural talent? Are you a frontline maniac? Or maybe a shield for friends? Or even a good leader? Who are you?
Let’s roll the dice…
*choice
#Randomize
*goto randomizestat

*label randomizestat
*if(health > 0)
You are a Fighter!
*set strength +10
*set natural_talent “Fierce Fighter”
*if(health > 0)
You are a Great Leader!
*set leadership +10
*set natural_talent “Great Leader”
*if(health > 0)
You are Runner!
*set speed +10
*set natural_talent “Unavoidable”
*if(health > 0)
You are a Strategist!
*set intelligence +10
*set natural_talent “World Class Tactician”

So basically I put everything health > 0 because at the beginning health is 100 and I want the computer decide to choose one of them. Instead of one, they choose all of them.

I tried using rand as well, and add variable… but it is not readable.
*var natural_talent = [‘Fierce Fighter’, ‘Great Leader’, ‘Unavoidable’]

Can someone help?

What do you mean unreadable?
One thing I noticed immediately by copy-pasting your code is that you are using smart quotes to set string values. For coding, only use simple/straight quotes (for both single and double quotes). The CS compiler should complain too if you use smart quotes. If you use word processors that replace simple quotes with smart quotes, turn it off completely or at least turn off the quote replacement option.

*create strength 0
*create leadership 0
*create speed 0
*create intelligence 0
*create natural_talent ""

*choice
  #Randomize
    *goto randomizestat

*label randomizestat
*temp type 0
*rand type 1 4
*if (type = 1)
  You are a Fighter!
  *set strength +10
  *set natural_talent "Fierce Fighter"
  *goto randomizestat_end
*elseif (type = 2)
  You are a Great Leader!
  *set leadership +10
  *set natural_talent "Great Leader"
  *goto randomizestat_end
*elseif (type = 3)
  You are Runner!
  *set speed +10
  *set natural_talent "Unavoidable"
  *goto randomizestat_end
*else
  You are a Strategist!
  *set intelligence +10
  *set natural_talent "World Class Tactician"
  *goto randomizestat_end

*label randomizestat_end
(natural talent: ${natural_talent})
3 Likes

Man! Thanks a bunch for the help and tips! Appreciate it!

1 Like

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the @moderators.