Lance Harrington - Milestone 2 Part 2: Questing And Dialog


          Lance here with another dev-log update, this time talking about the questing system. Along with the questing system I had to make an NPC state machine that will give us the quests, made some improvements to the enemy, and created a simple dialog system. 

          The NPCStateMachine is small at the moment with only two states, but it’s all we need to get things going. The First state is the idle state, which will be the default state for the NPC. The second state is a dialog state that cycles through some dialog and gives a quest at the end, assuming they have one to give. Essentially, when the player interacts with the NPC, the player goes into an interacting state while the NPC goes into a dialog state. When the Dialog is done, the player goes back to their default state.

          For the quests, I went with a scriptable object approach, so we can make as many quests as we can think up. The following is what it looks like in the inspector:


          Each quest is made up of quest goals that you add to a list in the inspector. There are currently three types of goals you can make, kill, collect, and escort, but the only one that is programmed at the moment is the kill. For each type of goal there is a corresponding category for setting up the goal. For kill quests you will select from a list of enemy Enums that will be your targets. The same goes for item quests. For escort quests you will simply drag in a transform for the final destination. Finally, you will be able to set quest rewards, but so far, we don’t have an inventory or stat system implemented, so this will have to be touched on later.

          Along with the quest scriptable objects, there are currently 4 other scripts that go along with the system. The first is the QuestingInventory, which handles all the quests the player is currently on. Next is the QuestHolder Script that will go on an NPC, and you can give them quests to give the player. The last two scripts are QuestKill and QuestItem, which go on the corresponding enemy and items to allow us to send a signal if an enemy dies or an item is looted. In the future I will be adding another script for escort and delivery quests.

          With all the scripts in functioning order, I just needed to make it so I can actually complete the quest. I updated the enemy to be able to die. I used the same health script as the player because they were made modularly. Among other things I created some basic animations for the enemy, updated its movement, and made a death effect.


Another thing I worked on to make this system is the dialog system. Like the questing system I used a scriptable object to store dialog:

There are currently three options for dialog that are prioritized in this order: 

1. Player has a quest to turn in

2. NPC has a quest to give

3. Default dialog

The NPC decides what dialog to use in its dialog state. Once chosen, the dialog is thrown into a Queue and displayed by element. Referring to the picture above, each element in the lists is a panel of text that will be displayed in order. 

With all that done, I can finally complete a quests:

  

This was a difficult milestone to complete and I am looking forward to expanding upon these systems that I have created so far. Thank you for reading and feedback would be helpful!!!

Get Iron Echos: Zenith's Uprising

Leave a comment

Log in with itch.io to leave a comment.