Rewarding Items

Once you have created and published an item, you can reward it to other users which adds the item to their backpack!

Using Visual Scripting

Using Visual Scripting, you have two nodes you can use:

  • Add Backpack Item: This adds an item to a user’s backpack, given an ItemID, and returns the result.
  • Get Backpack Item: This can be used to check if a user has an item in their backpack, as well as how many copies of the item they have (amount)

All you need to do is pass the Item ID (which you can copy from Spatial Studio) into the Add Backpack Item node

Pass the Item ID into the Add Backpack Item node

Warning

For these nodes to work, the execution trigger node needs to be a coroutine, or else you will get an error

Pass the Item ID into the Add Backpack Item node

When the item is added, the user is notified with a toast message.

Using Quest Rewards

To award an item to a user for completing a quest, simply add a reward to the Spatial Quest component, select reward type Item and enter the ItemID for the item you want to reward.

Image showing using Spatial Quest Component

Rewarding World Currency

See World Currency for details about world currency if this is a new concept.

World currencies are just items of type “Currency”. They can be rewarded using all the usual item nodes mentioned above, but for convenience, we have also provided the following nodes:

  • Award World Currency — Award the local user with world currency amount
  • Get World Currency Balance — Get the local user’s world currency balance
  • On World Currency Balance Changed — Notifies you when the world currency balance for the local user changes, which can change when the user was awarded new currency, or if they spend currency in the shop.

Get Item Info

These scripting nodes can be used to query the backpack

  • Get Backpack Item — Check if the local user owns an item in their backpack. The node returns isOwned and the amount of that item that the user owns.
  • On Backpack Item Owned Changed — This node will notify you when the user owns or no longer owns an item
  • On Backpack Item Used — This node will notify you when the user has used an item in the backpack. “Using” an item means different things for different item types. It is the action that is performed when the user clicks the backpack item button (Use, Wear, Equip, Unequip, etc…)
  • On Backpack Any Item Used — Similar to the node above, but this node will notify you if any item in the backpack is used.