Preset Character Names if the Input Screen is Left Blank

● ARCHIVED · READ-ONLY
Started by Pittoo 3 posts View original ↗
  1. Okay, so, I'm wanting to allow a name character screen, but if the player doesn't name the character, then a default name will appear.

    An example of this I can think of is the Pokémon games and how, if the name field is left empty, the game will then choose from a list of presets per gender such as Red, Fire, or Ash for the male and Leaf or Green for the female.

    I can't seem to figure out how to code this, exactly... Can someone explain how to code this, please?
  2. I think you can make that work with conditions.

    Set a condition where it checks if the actor has a blank name - do that for how many spaces you can set in the name input. For example, if you set that the character can have a name up to 6 letters, put the names in the condition boxes as " ", " " and so on.

    Then you can set a random variable to pick a random name to the character.

    Something like this:

    6dDl1f0.png

    Unfortunately I don't have XP, so I don't know if it can work like this.
  3. add your preset names into an array:
    Code:
    ary = ["name", "name", "name", "name", "name"]
    then, pick a random number, based on the array's own length, and return the result, and use *it* to have *the array* pick the name.
    Code:
    rnd = rand(ary.length)
    name = ary[rnd]
    you can also save the name to a global variable and use the editor commands to pass it to the character.
    Code:
    $game_variables[ID] = ary[rnd]

    you can fit all that into one single script block.
    if you need to operate between script and condition blocks, set the variables to global
    Code:
    @ary = [ ]
    @rnd = rand(@ary.length)
    so they can be accessed outside of the script block, by the editor