Randomly Generated NPCs?

Just a question I was wondering, is there anyway to have it so a random npc generates differently for each player?


For example, let's say one player randomly get a female npc with brown hair and green eyes to ask to join their party near the beginning of the game.


For another player, instead they find a male npc with black hair and blue eyes who wants to join their party.


I don't know if this is at all possible, but it would benefit me if I learned how to do something like this. 🙂
The character generator is in the editor, not in the game engine - the game engine can only use premade characters by default.


However, you can use the character generator to make several dozen different sprites/faces, and then use event commands to randomly select one of those faces/sprites to use.


It will require a rather long event with a lot of conditional branches after getting a random number, but there is no problem in doing that other than the worktime.
If they join the party, they wouldn't be an NPC, though, anymore. 


Regardless it's really easy to do. You just list all of the potential NPC's in the actor database, however many you want the pool of NPC's to be that the game draws upon. In my game, I have 64, so I did 64 actors.


Next, each NPC has their own switch. I did 64 switches to correspond with my 64 NPC's. At the start of the game, youd want to split up The NPC's with how many you wanted to appear. Say you had 64 NPC's, and you only wanted 4 random NPCs to appear in the game. You would generate a random variable between one and 4 assigning each switch to it's seperate conditional branch, like so.


npcc.PNG


You would just put this switch at the beginning of the game, and automatically have it flip on when the game starts. Just set this event page as autorun, and at the end of the event, activate self switch a so the event will stop processing, and you can continue your game as normal. Make a second event page with self switch a, that has nothing on it, and is triggered by the action button so it won't interfere with the game anymore.


Now for the NPC's to appear on the map, you will have to make 64 separate events corresponding with each NPC, only appearing under the condition that their switch was turned on.


Here's mine 


npccc.PNG


And you just put what you want the NPC to say or do when you interact with them, like you would any other event or NPC. Ignore what I put in the actual event page, you don't have to do that. You just need to have the NPC triggered with it's switch.

Original thread: https://forums.rpgmakerweb.com/threads/randomly-generated-npcs.72302/