Simple Name Generator Plugin 1.0 [MV]

Name Generator 1.0
By Florodude
Introduction

This script pulls in random names from one or more text files to be used however you want it in your game. It also features a very simple random number generation script.


Instructions
1. Install the plugin.
2. Find or create a txt file with one name on every line. You can google things like "male names txt" for a bunch of these, or create your own, and place the file in your /data/ folder.
3. Simply call the script SelectRandomName(fileName) where fileName is a string of the filename in the data folder. For exampple SelectRandomName("maleNames").
4. You may also use RandomNumber(min,max) to pull a random number. This is better than the game's default random number feature as you can set it to game variables.

Features
-A simple script call to get a random name out of a txt file.
-Use this to display random content, or set variables to be random names. I personally created this as a part of a dynamic NPC creation project I'm working on, where I'm using this script to set a game variable storing the NPCs name to a random name.

Download

https://www.mediafire.com/file/3ropingk2gnpew7/Namegenerator.js/file


You may use this in whatever commercial fashion you wish freely, I just ask that you credit me. Please link back to this plugin when sharing. Thanks!
I tried to use this but I am confused as to how exactly it works
@Amberfira it's like he said,
if you have an NPC (male), and NPC(female), and you have 2 files.txt
you can use the scriptcall (or by choice to run male/female.txt)
SelectRandomName("male") or SelectRandomName("female").

the name doesn't matter as long as you use the filename.txt name of it.
as for the number part.

which is: RandomNumber(min,max) is also a bit of a riddle how
to use it or how to role a random number, store in a variable to use.

or how to use that number in a conditional branch.
but I play around to see how things work.
I'm confused about how to use as well.
If I use script calls such as $gameActors.actor(2).SelectRandomName("malenames")
It says SelectRandomName is not a function.

If I don't put " ", it says Reference error, names is not defined. (I've put the malenames.txt to data folder)

Also tried lines in item such as b.SelectRandomName("maleNames.txt", true); or without " " but neither shows any effect.

Therefore, I assume this is generating a variable? And to save the variable it needs to look something like SelectRandomName(names; variable #) or SelectRandomName(malenames); $gameVariables.setValue(15, value); b.setName($gameVariables.value(15))? (if I use variable 15 to save the generated name)

The one I really want is this so I can setup a name purchase items shop to name instance characters.
I've solved the question I had, also seem to found an error.

The way to make the item formula
it. b.setName($gameVariables.value(15, true))
and effect
TP 0
Common event (Control variable 15 > set > script > SelectRandomName("malenames"))


The first time will change the character name to 0, second time would generate regularly, so make a common event on auto somewhere prior to getting the items would fix the first 0.
Putting a line behind the common event like \V[15] is your new name will always have a lagged name that was the "last name" though.

Here is the error, it seems to have a chance to generate more 0 (or rather, an invalid variable) after the first one, which crash the new project.

In the new test project, it often shows TypeError cannot read property 'charAt' of underdefined when generating the variable while old project works normally (other than generating 0). It crashes either as dialogue or as item.

The new test project has only the namedgenerator plugin while old project has over 200, so not sure what old project prevents it from crashing.

I've tried copying the error character, who has control variable and a text showing the variable, to the old project. Change the variable according to the project and it works without error other than generating the 0s.
doing it that way keep generating a new name.
as it is best using a scriptcall if you want to place it inside on a gameVariable.

something like:
let name = SelectRandomName("male"); //male to teh txt file
let gv = $gameVariables.value(15);
$gameVariables.setValue(gv, name);


I also would set a SelfSwitch A on after using it, to the next page,
so it wont "re-generate" a new name again.

but there might be different ways to set things up nicely.
I kept getting errors until I removed the + 1 after lenght, now it seems to work without issues.
Hey! I know this thread is pretty dead but I'm having some trouble. The generator seems to work on most lines, but I keep getting this error message under a specific(?) random name. I've tried to tweak the name file to add and remove names but there appears to be nothing wrong with the list since it works fine otherwise. is anyone able
Screenshot 2025-08-12 090745.png
to help me out?
to help me out?

there is a line code error which read the length (see post #7)
but instead of checking length + 1, it should be length - 1 to fix
that error you get.

also make sure the names are seperated on each line.

I can make a simplified version that might work better than this
when I get the time.

but it depends how and where you want to use this though.

Original thread: https://forums.rpgmakerweb.com/threads/simple-name-generator-plugin-1-0-mv.111588/