Skip to content

Formatting for the Quests Database

Tanvirk2013 edited this page May 24, 2020 · 1 revision

Disclaimer: This is being written as of 4:48am 😬. If something doesn't seem right, don't LMK.

Links

What is JSON? [Video] Watch from 0:00 to 2:11

Unity Documentation - JsonUtility

Online JSON Viewer use this for validating and reading JSON.

More links below

Data Structure for a Quest

Each quest object is structured as the following:-

  • ID of the quest (This may or may not be removed, it hasn't been implemented so you can leave the whole line blank or give it a value of 0) [int]
  • Title of the quest [string]
  • Description of the quest [string]
  • The name of the NPC giving the quest [string]
  • Quest status (0 = Not Given, 1 = Given, 2 = Complete) [enum]
  • Objectives [Separate Struct]

Refer to the QuestEntry structure under Khan-Branch in Assets/Scripts/Quests/QuestsDatabase.cs

Data Structure for Objectives

A quest can have more than one objective.The data structure for objectives has 5 entries, however, not all entries are needed depending on the type of objective.

IMPORTANT: ALL ENTRIES APART FROM THE FIRST VARIABLE ARE STRING DATA-TYPES

Refer to the ObjectivesEntry structure under Khan-Branch in Assets/Scripts/Quests/QuestsDatabase.cs

Data Structure for a Gather-Type Objective

  • Is the objective complete (Set this value as false unless debugging.) [bool]
  • Objective description (This should be left blank for an automatic description) [string]
  • Name of the item to gather [string]
  • Required amount [string]
  • Current amount (Leave this as 0, it will run a check as long as the objective isn't complete) [string]

Data Structure for an Activate-Type Objective

  • Objective description (DO NOT LEAVE THIS BLANK) [string]
  • Name of item or NPC to interact with [string]

Data Structure for a Search-Type Objective

  • Objective description (DO NOT LEAVE THIS BLANK) [string]
  • Name of place to find [string]

Data Structure for an Escort-Type Objective

Do not create objectives of this type till AI is implemented and tested.

Data Structure for a Deliver-Type Objective

Do not create objectives of this type till AI is implemented and tested.

Example Database

Use an online json viewing tool to beautify this

{"QuestEntry":[{"ID":0,"Title":"Gather Test","Description":"Test Saving","Giver":"NPC_NAME","Status":2,"ObjectivesEntry":[{"Complete":true,"Type":"GATHER","Description":"Gather [Test]  4/4","FirstEntry":"Test","SecondEntry":"4","ThirdEntry":"4"}]},{"ID":0,"Title":"Activate Test","Description":"DESCRIPTION","Giver":"NPC_NAME","Status":2,"ObjectivesEntry":[{"Complete":true,"Type":"ACTIVATE","Description":"Interact with the ARROW on the ground","FirstEntry":"Arrow","SecondEntry":"","ThirdEntry":""}]},{"ID":0,"Title":"Escort Test","Description":"Test Saving","Giver":"NPC_NAME","Status":0,"ObjectivesEntry":[{"Complete":false,"Type":"ESCORT","Description":"Escort [Test] to [4]","FirstEntry":"Test","SecondEntry":"4","ThirdEntry":""}]},{"ID":0,"Title":"Search Test","Description":"Test Saving","Giver":"NPC_NAME","Status":2,"ObjectivesEntry":[{"Complete":true,"Type":"SEARCH","Description":"Walk to the entrance of the cave","FirstEntry":"Cave","SecondEntry":"","ThirdEntry":""}]},{"ID":0,"Title":"Deliver Test","Description":"Test Saving","Giver":"NPC_NAME","Status":1,"ObjectivesEntry":[{"Complete":false,"Type":"DELIVER","Description":"Take [Test] to [4]","FirstEntry":"Test","SecondEntry":"4","ThirdEntry":""}]}]}