Reorganizing an NPC_Dialogue/Quest System

Hello! So… i have a working quest system enabled in a project i’m working on. But there are limitations to it that i’d like to address and maybe get some feedback on how to change it or add to it to make it better.

So… the base mechanics of it: All npc’s data except shop npc’s (For now), are found in a dictionary called “Major_NPC_Dialogue” in a local module called “NPC_Controller”. Within that dictionary are several other dictionaries, each dictionary being labeled in accordance with each npc.

Within each npc dictionary are 4 dictionaries currently: “Active”, “Inactive”, “Passive_Sounds”, and “Animations”. Keep in mind, that this project is going to be voice acted, so within the passive sound dictionary are a bunch of sounds that play depending on whether or not the npc is active or inancitve, Active meaning they have important things to say, or Inactive meaning they are just passive informational dialogue.

Before I get to whats in the active and inactive dictionaries, its important to note a folder inside of the player called “Player_NPC_info” which is rendered when the player first joins the game, and contains all sorts of saved data values within folders of each npc’s name, there are things like “Meeeting_Num”(The amount of times you’ve met with the npc while they were active), Status (which is what saves active or inactive), and the NPC_Type (tells what kind of npc it is, shop, hostile, defensive, or major, etc.)

Now to whats in the active and inactive dictionaries in the NPC_Controller: In the active dictionary is a list of dictionaries that are numbered from 1 to however many dialogue encounters the npc has. These are like quest checkpoints or starters, or important story driving dialogue. Each number represents the “Meeting_Num” as mentioned in the previous paragraph. So… if an npc is an objective to talk to… or they have a quest to give, their status will be set to active, and when the player talks to the npc, it will pick whatever meetingn_num is in the players “Player_NPC_info” folder in accordance with that npc, and run that chain of dialogue.

Within that numbered dictionary is a list of more numbered dictionaries, that are numbered for order, not for any other values but from first to last, each contain the dialogue as well as many values of whether or not the npc plays an animation when speaking that specific line of dialogue, or the sound file for that paragraph (Like i said its voice acted), or if reading a certain line will give you a quest, or the npc walks somewhere, etc… This part works really well in my opinion. It also supports dialogue choices… so it works very much like a tree.

When the player is finished with an active dialogue… it automatically reverts back to an inactive status, and adds 1 to the meeting_num and saves this. Inactive dialogue is repeated, so if you are on meeting_num 6, and you return later to that same npc while its inactive and still on 6, they will repeat the same dialogue… its usually just informational.

Now… this system works and its beautiful in my opinion… its the first quest an npc system I’ve worked on. But I’ve been thinking of the future of this system… and thinking about… what if npc dialogues cross… what if you have 2 quests to find the same npc. What if one npc is on meeting number 4 and you are on a much later part of the main story, and you need to go find that npc, but… the dialogue for that quest is on meeting number 7? How do you work around this? This part doesn’t seem super clean to me. Does anyone know how other larger more professional games run this sorta thing? There’s lots of room for it to mess up and confusion in that area, as I’ll have to treat it like a puzzle so that no matter where you are in the main story, all the meeting_nums will need to line up where they are suppose to… or avoid talking to other npc’s all together that are involved in separate quest lines… There must be a better way that wont involve me ripping the whole system apart again. I think so far its a pretty great system but this is one of the things that needs to change. If anyone has any thoughts or comments, please let me know! :slight_smile:

Thanks!
Manelin :heart:

5 Likes

If a dialogue is necessary for a quest, then it is triggered by that quest not by the meeting number surely? These are two separate variables: how many times you’ve interacted with that NPC, and whether or not you’re currently undertaking the relevant quest. In this case, when the player interacts with the NPC it would increment the counter and play the “meeting count dialogue” as normal, and they could then be presented with the option to inquire about the quest.

This seems like a problem solved using dialogue choices that you seem to have some sort of system for judging from the dictionaries.

If I’m wrong, let me know why and I’ll keep trying to help!

2 Likes

You are not wrong at all. So… let me see if I understand what you are trying to communicate.

You are saying, create a seperate dictionary with a list of the specific quest dialogues… and have a trigger through dialogue choices to trigger that quest? Or should it be automatic? I’m a little confused on that part.

Or… if a specific quest is activated, then play the quest dialogue when you speak to that npc?

Try OOP! It could seriously improve your game’s workflow. OOP is great for organization.

2 Likes

Uhhhh… what? I’m so confused.

I don’t have enough knowledge of your code base to tell you how to implement it, but the crux of my suggestion was that if two separate events unlock dialogue for the same NPC, you should allow the player to select which option they want to explore first rather than trying to prioritise one over the other

They kind of have with their tables and inheritance