Skip to main content
Items in Mythic Framework are defined with properties that control their behavior, appearance, and usage. Understanding the item structure is essential for creating custom items and integrating with the inventory system.

Item Definition Structure

Items are defined in shared/items.lua files across resources:

Required Fields

string
required
Unique item identifierRules:
  • Lowercase, no spaces
  • Use underscores for multi-word items
  • Descriptive and consistent
Examples: "water", "weapon_pistol", "lockpick", "driver_license"
string
required
Display name shown to playersExamples: "Water Bottle", "Pistol", "Lockpick", "Driver's License"
number
required
Item weight in kilogramsGuidelines:
  • Small items: 0.1 - 0.5 kg
  • Medium items: 0.5 - 2 kg
  • Large items: 2 - 10 kg
  • Very heavy: 10+ kg

Optional Fields

Display Properties

string
Detailed item description shown in tooltipsExample:
string
default:"default.png"
Image filename in ui/assets/items/ directoryFormat: PNG, recommended 150x150pxExample: "water.png", "weapon_pistol.png"

Usage Properties

boolean
default:"false"
Whether the item can be used from inventoryExample:
boolean
default:"false"
Whether the item is removed from inventory when usedNote: This is a client interpretation flag. The actual removal must be implemented in the use code.Example:
number|boolean
default:"false"
Stack size limit. Use false for non-stackable items, or a number for the maximum stack size.Example:
boolean
default:"false"
Whether item is completely removed when durability reaches 0Example:
number
default:"0"
Time in seconds for the item to fully degrade. Set to 0 for no decay.Example:
boolean
default:"false"
Whether to close the inventory UI after using the itemExample:
boolean
default:"false"
Whether the item is metallic (affects metal detectors, etc.)Example:
string
Character state key that is added when item is used and removed when item is lostExample:

Item Types

The type field uses numeric codes to categorize items:

Rarity Levels

The rarity field also uses numeric codes:

Complete Item Examples

Consumable Item

Weapon Item

Note: Weapon-specific properties like ammo, serial numbers, and attachments are stored in item metadata, not in the item definition.

Tool Item

Document Item

Note: Character-specific data like name, DOB, photo are stored in item metadata.

Material Item

Phone Item (with Durability)

Note: Phone number, contacts, messages, battery, and apps are stored in item metadata.

Item Metadata

Metadata stores instance-specific data for unique or stackable items:

Common Metadata Fields

Accessing Metadata


Creating Custom Items

Step 1: Define the Item

Step 2: Register with Items Component

Step 3: Handle Item Usage

Step 4: Add Item Image

Place energy_drink.png (150x150px) in:

Item Categories and Organization

Group related items for easy management:

Best Practices

Use a consistent naming scheme:
Balance gameplay with realism:
Write helpful descriptions:
Balance economy:
Provide sensible defaults:

Item Validation

Validate items before adding to inventory:

Next Steps

Inventory - Exports

Inventory management methods

Inventory - Events

Inventory events

Items System

Using and creating items

Crafting System

Item crafting and recipes
Item Images: Use consistent image sizes (150x150px recommended) and transparent backgrounds (PNG) for best results in the inventory UI.