# Shop System

## Overview

View Video Below at 0:38s for Shop Promo.

{% embed url="<https://streamable.com/ehlgbr>" %}

The Shop System is a Simple Buy/Sell shop functionality that gives the developer freedom to add multiple unique shops, each with their own items, stock levels and prices.

## Setup

To setup a shop is super easy:<br>

1. Drag in the ShopCanvas prefab to your scene.
2. Follow these Shop Specific Instructions here: [Updating from v1.1.1 to v1.2 Instructions](/animal-controller/updating-from-v1.1.1-to-v1.2-instructions.md#shop-specific-instructions)
3. Add one of the Shop Prefabs into your scene.&#x20;
4. Setup the shop with items, stock amounts and prices:

<figure><img src="/files/5YfIbNuVVX301Xdt4fsZ" alt=""><figcaption></figcaption></figure>

That's it! You should now be able to use your shop as long as you've followed all the previous tutorials about setting up interactions -> [Interactable](/animal-controller/global-components/interactable.md) -> [Interactor](/animal-controller/global-components/interactor.md)

## Using/Not Using Dialogue

By default the Shop will use some dialogue to open the menu to show the buttons where you can choose to buy, or to sell:

<figure><img src="/files/WkO9IiRscsihX2ZGZ8Dp" alt=""><figcaption></figcaption></figure>

If you do not wish to use this dialogue and want to use your own, this is how it works and how to amend it:\
\
When opening the shop by interacting with the zone, it calls: Shop.OpenShopUI via the OnZoneActive event:<br>

<figure><img src="/files/OVZNlFvT09Qyz7MIgTwS" alt=""><figcaption></figcaption></figure>

This in turn will Invoke the OpenShop event on the shop itself:<br>

<figure><img src="/files/7laiV0y1mWYE0f3fho8R" alt=""><figcaption></figcaption></figure>

Now at this stage, IF you want to continue using the dialogue, you can as this links directly to an event listener on the Dialogue Canvas:<br>

<figure><img src="/files/yWiwYQlQ1PXT1Bh4CWvr" alt=""><figcaption></figcaption></figure>

This then directly links to code within the UIManager and calls the ChangeUIState method which then opens the Dialogue etc.\
\
If you want to skip this, then what you need to do is the following:\
From Invoking the OpenShop Event previously, have an event listener that listens to this (similar to the above with the dialogue) and then call either:\
\
ShopBuyUIOpen - For opening the Shop UI

ShopBuyUIClosed - For Closing the Shop UI

InventorySellingUIOpen - For Opening the Inventory with selling mode turned on

InventorySellingUIClosed - For Closing the Inventory with selling mode turned on\
\
An example of this would be:<br>

<figure><img src="/files/divssUzaqsJesEDVRySz" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://malbersanimations.gitbook.io/animal-controller/shop-system.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
