Quest system + advanced NPC dialogue + camera work

Quest system + advanced NPC dialogue + camera work

Early dialogue system in Arpago was serviceable – I could set a group of sentences an NPC could say, and each one could have assossciated with 1 to 4 answers, which could trigger the next sentence said by NPC. As I started working on quest system, it was clear that current solution wouldn’t be enough. I needed to build some triggers and condition checks around it, as well as extend the number of possible answers.

Technical stuff. There are 2 main elements – script QuestManager attached to every player, and script AI_NPC attached to every NPC.

QuestManager (QM) has a preset array of quests. Quest is an object with variables like Unique ID (UID), active bool, name, description, list of possible quest states (each with its ID, name, and description), completion bool.

AI_NPC has 2 main arrays of objects: SAY and ASK. SAY is list of stuff that NPC can say, and ASK is list of stuff you can ask the NPC. SAY has text, list of associated ASK ids, ability to set quest status, ability to remove an item from player’s inventory, and drop an item on the ground. ASK has text, quest status requirement that is needed for the option to be shown or hidden, item requirement, and a pointer to SAY id that it triggers.

Conversation starts – SAY[0] is shown that has a list of ASK elements. Each ASK elements is verified if it should be shown, and then a list is displayed to the player. Player chooses an option, it triggers ex. SAY[5], runs whatever SAY[5] has defined (like set quest of UID 3000 to status 1 + drop a sword to the ground), and displays attached ASK options again. There’s always one ASK option that has “BYE” trigger, which causes conversation to end. An example graph.

Additionally, I implemented some in-game camera improvements like zoom with scroll/analog and a static conversation camera which activates when you talk to NPCs. Here’s a video of it all: