Code: Select all
init:
#First we set up some variables:
$ gen_name = "" #The name that will appear
#Then we create the list with possible names.
$ name_list = ["Paul", "John", "George", "Ringo"]
$ l_name_list = ["McCartney", "Lennon", "Harrison", "Starr"]
Code: Select all
init python:
class GENERATOR:
def malename(self):
generatedname = renpy.random.choice(name_list)
#Take one name from the name_list list and store it at generatedname
generatedlastname = renpy.random.choice(l_name_list)
#Ditto
store.gen_name = generatedname + " " + generatedlastname
#Show the result of putting both together and store it on the gen_name variable.
#If not for the " " part we could get RingoStarr
Code: Select all
define e = DynamicCharacter("gen_name")
#This means the character name will be the one stored at gen_name
label start:
python:
gen = GENERATOR()
#This lets us use the GENERATOR class as just "gen"
$ gen.malename()
#At this point the game will run what you made it do on the malename
#function of the GENERATOR (now just gen) class. With that, it will
#create a name out both lists nad store it at gen_name
e "Now my name is [gen_name]"
Anyways, that's that, hope this helps you. If you have any trouble with this just let me know.