setshop
Jump to navigation
Jump to search
The setshop
script command is used to set the inventory to act as a shop for an entity. Shops have different interaction compared to other inventories when opened in the HUD:
- Shop inventories are automatically sorted when opened with matching items being combined into stacks if possible.
- The player cannot take whole stacks of items from shop inventories, only individual items. There is no button to take all items.
- If a shop category is set, the player can only drop items with a matching group into the shop inventory. The shop can still contain items of other categories which the player will be able to buy.
- Dragging an item out of a shop inventory is considered buying it and deducts gold from the player's purse according to this formula:
floor(floor(price · multiplier · (durability / max_durability)) · (1 - full_intuition / 200))
If the player does not have enough gold in the purse then the item cannot be dragged. - Dropping items into a shop inventory is considered selling them and adds gold to the player's purse according to this formula:
floor(floor(price · multiplier · (durability / max_durability)) / 3 · count · (1 - full_intuition / 200))
- The player cannot directly use or combine items in shop inventories but must first buy them by dragging the items somewhere else.
The entity inventory may be set to act as shop before calling inventory create
and is not reset with inventory destroy
.
Usage
setshop <enable>
Context: Any Entity
Parameters:
Parameter | Type | Description |
---|---|---|
enable |
bool |
Should this entity's inventory act as a shop |