Quest Tree
  • Quest Tree Documentation
  • đŸ•šī¸Quick Start
    • Installation
    • Start Editing
  • 🎓Tutorials
    • Videos
    • Example Scenes
  • 🧩Components
    • Core Defaults
      • Quest Tree Initializer
      • Quest Tree Sync
      • General Dialogue
      • Default Quest Provider
    • Default UI
      • Default Choice Button
      • Default Dialogue Window
      • Default Dialogue Window Triggerer
      • Default Input Handler
      • Default Item Slot
      • Default Memorable Message
      • Default Quest Foldout
      • Default Quest Foldout Item
      • Default Quest HUD
      • Default Quest HUD Item
      • Default Quest Message UI
      • Default Quest Window
      • NPC World Canvas Handler
    • World Triggers
      • World Dialogue Trigger
      • World Quest Completer
      • World Quest Failer
      • World Quest Receiver
      • World Requirement Trigger
  • âš™ī¸Systems
    • Quest Tree
      • Editor Window
      • Quest Types Editor
      • Settings
      • Character
      • Items
        • Item
    • Dialogue Tree
      • Editor Window
        • Nodes
          • Dialogue Node
          • Choices Node
          • Receive Node
          • Complete Node
          • Trigger Node
          • Boolean (If) Node
      • Settings
      • Quest Dialogue
      • General Dialogue
  • 📄Scripting
    • Quests
      • Getting Quests
        • Quest Find Settings
      • Working with Quests
        • Quest Types
        • Child Quests
        • Quest NPCs
        • Requirements
      • Managing Quest States
    • Dialogue
      • Getting Dialogue
      • Dialogue Graph
        • Working With the Graph
    • Initialization
    • Disconnect
    • Syncing
    • Events
    • Saving/Loading
    • Player Recognition
    • Choices
    • Items
      • Rewards
        • Managing Granted Rewards
    • Characters
    • Requirements Manager
    • Procedural Generation
  • đŸ› ī¸Support
    • Getting Help
  • 📚Changelogs
    • Latest Releases
  • ⭐Rate Me?
Powered by GitBook
On this page
  • Checking if a Reward Was Granted
  • Getting Rewards
  • Adding Rewards
  • Alternative Method
  • Removing Rewards
  1. Scripting
  2. Items
  3. Rewards

Managing Granted Rewards

PreviousRewardsNextCharacters

Last updated 5 months ago

When a reward is granted outside of quests, the reward key is stored into the database. This is because if certain dialogue is supposed to grant a reward (such as talking to a random NPC), we wouldn't want the player to get the same reward every time they talk to them. The game needs a way to remember if the reward has been granted already.

Received quest rewards are not saved in the database because in the case where quests are repeatable, we would want the player to receive the rewards again. Also, if a quest is not repeatable, the player would not be able to get the rewards anyway.

In dialogue, the reward key can be used to divert dialogue in a completely different path. See Boolean (If) Node.

Checking if a Reward Was Granted

if (QT.HasReward("MyRewardKey"))
{
    // Do something...
}

Getting Rewards

The database does not store which specific items were granted. It simply stores the reward key.

Adding Rewards

var reward = new QTRewardItem(quest.ID, "MyRewardKey", "MyItemObject", 1);
QT.AddReward(reward);

Alternative Method

Rewards are saved in the database as a RewardEntry. You can use this class to save rewards instead.

var reward = new RewardEntry("MyRewardKey");
QT.AddReward(reward);

Removing Rewards

QT.DeleteReward("MyRewardKey");
📄