Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

[Intermediate] Creating A Universal Chatting NPC

Was this death by words tutorial useful to you guys?


  • Total voters
    9

Status Gear Entertainment

Praised Adventurer
Hello everyone, StatusGearEntertainment here to bring you a written tutorial on how to create NPCs that you can talk to and not have reoccurring chats topics all the time on an intermediate level. Simply because I don't want to scramble my own brain thinking of super complex ways to create AI. I'm mainly creating this thread so that in the event that I lose any data on my laptops or just not touch RMMV for awhile, I can read up on this to brush up on my logic skills.

1. Make room for variables. If you are starting out brand new, I recommend saving as much of the first set of variables for the variety. The more variables you reserve for this, the more "intelligent" your NPCs will seem. Plus you're going to want all your variables in one location to make things easier on you.

2. Let's try using about 10 variables. The first 10 will be labeled NPC Gossip 1, 2, 3, ... and so on.

3. Create a Common Event and we'll label it "NPC Gossip Randomizer". In this common event you will simply set your first variable to random between 0 - 10. Repeat with all your 10 variables.

4. This common event will be used in all your maps that have NPCs to talk to. Create a new event to call for your NPC Gossip Randomizer and erase event after. This is so every time you enter the map, you will have all your variables randomized each time.

5. Now create another event and label it your NPC. This NPC will be your universal NPC so let's get this right the first time without needing to go back and change it because then it will just be a hassle. For this NPC, page 1 will be activated under the condition that when your variable NPC Gossip 1 is = to 0. Display nothing in the graphics only if you want this NPC to possibly not show up to even talk to.

6. Page 2 simply add the variable to your variable condition so that NPC Gossip 1 is = to 1. This is now a new possibility you will encounter so display the graphics of your choosing. You can keep adding on more pages with increasing the variable condition but before you do that, you want to create the NPC topic logic, so you don't have to copy and paste the whole thing multiple times. Also note that every event maxes out at 20 pages under normal conditions.

7. Now to make sure you're topics are as fluent as possible. You will need to create a random order of topics to choose from. To do this without confusing yourself, create a conditional branch that checks a DIFFERENT gossip variable. For example, we are using NPC Gossip 1 for the overall NPC themselves, so we will use NPC Gossip 2 because it is a completely separate variable that won't effect other NPC Gossips as long as it remains within the event itself. Check for 2 and if it is = to 0, then use the standard topic conversation your NPC will use.

8. Create multiple conditional branches with it's own conversations inside so that your NPC now has at least 10 possible topics to choose from at a random order of the time that you come into the map, the NPC will also be different each time. To create the most fluent NPC possible, each page of that 1 NPC will have 10 different topics that are randomly picked.

This means that (10 conversations * 10 event pages * 10 NPCs = 1000 possibilities) I know this seems like it will take forever to do if you did it in a perfect world were each conversation is different, but this was an example of using 10 different types of NPCs. You can significantly bring this down to a smaller spectrum and still receive lots of possibilities. For example (3 conversations * 3 event pages * 3 NPCs = 27 possibilities) which is still a lot. Don't forget collaborations and teamwork can cut down the time it would even take to create all those conversations.

And yes, this was an intermediate level of NPC logic AI. Yes, this method alone isn't just for NPC AI, you can do the same for events in general. That means if you wish to decorate your maps but you don't want the same decorations each time, use this and you'll be amazed at how your world will interact with you. I'll be posting a demo of my test project Perception to show you guys what long, tedious work can do for you if you focus all your time into logic.

Very Respectfully,
StatusGearEntertainment
 

cav_dan

Towns Guard
I once used a similar approach to create random dungeons on a small game. In the end I used rocks in a maze to create around 20 sets of dungeon floors. Wasn't really all that that great, but was a lot of fun to think of the implementation. I even made a few random puzzles within some of the layouts.

Nice tutorial, will try to build on top of it.
 

cav_dan

Towns Guard
I'll try to find it, but it's in portuguese, so most users here won't be able to enjoy it that much (most of the fun was in the writing and dialogue).

UPDATE:
So, in all it's buggy gory glory: https://dl.dropboxusercontent.com/u/16104519/CronicasHacredSall_byJackmcmorrow.exe

It takes a while to get to the part where the dungeons are random (about 15 minutes). Also, you need to take a ticket and wait by the door in the waiting room... I think I got this idea from some Yahtzee game.

Well, I'm walking down memory lane now...
 
Last edited:
Top