ITEM_CREATION_GUIDE.md 3.0 KB

Item Creation Guide

This guide explains how to create Weapons and Armor assets using the Unity Editor.

Quick Start

Creating a Weapon

  1. In the Project window, navigate to (or create) Assets/Resources/Items/Weapons/
  2. Right-click in the folder → Create > Weapon
  3. Name your weapon (e.g., IronSword.asset)
  4. Select the created asset and edit in the Inspector:
    • Item Name: Display name (e.g., "Iron Sword")
    • Description: Flavor text
    • Icon: Drag a sprite for UI display
    • Rarity: 1=Common, 2=Uncommon, 3=Rare, 4=Epic, 5=Legendary
    • Attack Bonus: Base attack increase (e.g., 5.0)
    • Magic Bonus: Spell power boost (e.g., 0.0)
    • Defense Bonus: Parry/block bonus (e.g., 1.0)
    • Speed Bonus: Movement modifier (e.g., 0.0)

Creating Armor

  1. In the Project window, navigate to Assets/Resources/Items/Armor/
  2. Right-click → Create > Armor
  3. Name your armor (e.g., LeatherArmor.asset)
  4. Edit in the Inspector:
    • Item Name: Display name
    • Description: Flavor text
    • Icon: Sprite for UI
    • Rarity: Quality tier
    • Defense Bonus: Protection increase (e.g., 5.0)
    • Health Bonus: Extra durability (e.g., 0.0)
    • Speed Penalty: Movement reduction for heavy armor (e.g., 2.0)
    • Magic Resistance: Spell damage reduction (e.g., 0.0)

Loading Items at Runtime

Once created in Resources/Items/, load them programmatically:

// Load all weapons
Weapon[] weapons = Resources.LoadAll<Weapon>("Items/Weapons/");

// Load all armor
Armor[] armors = Resources.LoadAll<Armor>("Items/Armor/");

// Load a specific item
Weapon sword = Resources.Load<Weapon>("Items/Weapons/IronSword");

Example Presets

Common Weapon Presets

Iron Sword (Common)

  • Attack Bonus: 5.0
  • Defense Bonus: 1.0

Steel Greatsword (Uncommon)

  • Attack Bonus: 8.0
  • Speed Bonus: -0.5

Mage Staff (Rare)

  • Attack Bonus: 2.0
  • Magic Bonus: 6.0

Common Armor Presets

Leather Armor (Common)

  • Defense Bonus: 3.0
  • Speed Penalty: 0.0

Steel Plate (Uncommon)

  • Defense Bonus: 8.0
  • Speed Penalty: 1.0
  • Health Bonus: 2.0

Mithril Robes (Rare)

  • Defense Bonus: 4.0
  • Magic Resistance: 3.0

Behind the Scenes

The ItemCreationMenu editor script (in Combat/Editor/) provides the Create > Weapon and Create > Armor menu items. When you use the menu:

  1. A save dialog appears
  2. The asset is created as a ScriptableObject
  3. It's automatically saved to the Resources folder
  4. The asset is pinged in the Project window for easy access

Resources folder structure:

Assets/
└── Resources/
    └── Items/
        ├── Weapons/    (auto-created)
        │   ├── IronSword.asset
        │   └── ...
        └── Armor/      (auto-created)
            ├── LeatherArmor.asset
            └── ...

Integration with Agents

See COPY_PASTE_EXAMPLES.cs Example 3 for how to equip agents with weapons and armor at spawn time.