I’m working on my first project using Perchance to create an RPG character generator. I want to add a feature where, if a generated character’s race has subraces, there’s a chance for a subrace to be generated as well.

For example, if the race “Elf” is generated, I want there to be a chance that it specifies “High Elf,” “Wood Elf,” or “Dark Elf” as a subrace. How can I implement this functionality in Perchance?

  • wthit56@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 months ago

    I know this has been answered, but I’d do this a different way, using inline lists:

    Races
      {Wood|High|Dark|} Elf
    

    {Wood|High|Dark|} gives you one of the options at random. So either Wood or High or Dark or nothing.

    You can add probabilities too, with ^# where # is some number you want to weight it by compared to the others. {Wood|High^0.5|Dark|^5} Now “High” will be added half as much as “Wood” or “Dark”. But “” (nothing) will be used 5 times more than “Wood” or “Dark”. (The others mentioned this, but that’s how it looks in an inline list.)