Name Generator Problem

0 favourites
  • 10 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hi!

    I wanted to create a simple name generator systems for a few RPG books.

    The generator would create names based on pre-selected race (elves, dwarves, humans, etc.).

    But I'm stuck at the very beginning because I have a problem with the generation of names. I tried to assign names to the numbers and add the script choosing random numbers (tutorial section), but in spite of all the script does not work.

    Actually I have no idea how to create such a script. I would be grateful for advice for a beginner <img src="smileys/smiley1.gif" border="0" align="middle" />

  • You could type all names in a single string variable, separated by ; or whatever you prefer (one string for each race perhaps). Then when you wish to assign a random name from the string do this:

    NameVariable = tokenat(NameString, floor(random(tokencount(NameString, ";"))), ";")

  • I would build a dictionary of phonemes like:

    dictionary['elf_0'] = 'aeg'
    dictionary['elf_1'] = 'am'
    dictionary['elf_2'] = 'ama'
    dictionary['elf_3'] = 'dir'
    dictionary['elf_4'] = 'nor'
    dictionary['elf_5'] = 'ri?'
    ...
    dictionary['dwarf_0'] = 'dah'
    dictionary['dwarf_1'] = 'lon'
    dictionary['dwarf_2'] = 'mor'
    dictionary['dwarf_3'] = 'ren'
    dictionary['dwarf_4'] = 'tero'
    dictionary['dwarf_5'] = 'war'
    ...
    dictionary['human_0'] = 'rob'
    dictionary['human_1'] = 'ali'
    dictionary['human_2'] = 'dove'
    dictionary['human_3'] = 'fha'
    dictionary['human_4'] = 'vyre'
    dictionary['human_5'] = 'quo'
    ...

    etc

    and then generating a name by picking 2 or 3 phonem at random like

    name = dictionary[race&"_"&floor(random(6))]&dictionary[race&"_"&floor(random(6))]&choose("",dictionary[race&"_"&floor(random(6))])

    Of course you could complexify a bit by having phoneme reserved to be only at the start or end of a name, other that could be in both.

    Should also keep track of how much phoneme you have per category. (for the range of the randomness)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yann sorry for my ignorance, so how do you set a text with this phonem at random?

  • Joannesalfa

    name = dictionary[race&"_"&floor(random(6))]&dictionary[race&"_"&floor(random(6))]&choose("",dictionary[race&"_"&floor(random(6))])

    doesn't work?

  • Yann

    I'm using this comparing 2 values as event by picking

    I copied the same to action to set text which didn't work

  • works for me

    I was too lazy to reproduce exactly what I wrote before.

    I used string parsing instead of dictionary look up but the principal is the same.

    Instead of a dictionnary.Get('elf_4')

    I do a list = dictionnary.Get('elf') and then tokenat(list,4,newline)

    same idea

    Which made me write a little function to keep things clear.

    basicNameGenerator.capx

  • You are fantastic! Thanks for your help friends :)

  • thanks! this works great...

  • yann you are gem I was looking for something like this but, looking after and playing with grandchildrens I did not have time thank you so much

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)