Rewards
The QTRewardItem
class contains contains a QTItem
and an amount of the item that should be granted to the player.
Creating Rewards
Ensure your reward keys are unique. Reward keys can be used to check if a reward has already been granted.
A QTRewardItem
object needs a reference to a QTItem
and the quest it's being used for. The quest ID reference is not required if it's not being used for the context of a quest. The ItemObjectName
should be the name of the item scriptable object.
Adding Rewards
Rewards can be added to quests.
Removing Rewards
You can remove a reward by the reward itself, the item object name or its index in the reward list of the quest.
Getting Rewards
Rewards are a part of quests. To get a reward, you must have a reference to a quest. You can get a reward by the name of the QTItem
object.
You can get the full list of reward items with the quest.rewards
field.
Granting Rewards
If QT has been set up properly, rewards should be "granted" to the player automatically, however, the rewards still need to be manually added to the players inventory with whatever inventory system you're using.
The best way to handle this is by adding a reward received handler to the QT.onRewardReceived
event.
Expanded Example
The code below is just an example of how items could be added to your inventory. Actual code may vary.
Grant with QTRewardItem
With a QTRewardItem
, you can grant a reward with the method below. This will simply invoke the onRewardReceived
event.
Last updated