Skip to content

Step 4: Loot System Guide

Can TATAR edited this page Feb 23, 2026 · 3 revisions

URF Loot System Guide

🎯 Overview

Flexible loot drop system with guaranteed and random drops.


📦 System Components

1. URFLootDropDataAsset

Data asset that defines loot drops with chances.

2. Enemy Loot Configuration

  • Guaranteed Pickup - Always drops (XP pickup)
  • Random Loot - Chance-based drops (multiple tables)

🎲 Loot Drop Data Asset

Creating a Loot Table

  1. Right-click in Content Browser
  2. URF → Loot Drop Data
  3. Name it (e.g., DA_CommonEnemyLoot)

Configuration

// Loot Entry Structure
struct FURFLootDropEntry
{
    TSubclassOf<AURFPickupActor> PickupClass;  // What to drop
    float DropChance;                           // 0.0 - 1.0 (0% - 100%)
    int32 MinXPAmount;                          // Minimum XP
    int32 MaxXPAmount;                          // Maximum XP
    bool bUseRandomXPAmount;                    // Random between min/max
};

Drop Modes

Allow Multiple Drops = FALSE (Default)

  • Weighted random selection with "no drop" chance
  • Only ONE item drops per roll (or nothing)
  • Drop chance is absolute (0.1 = 10% chance to drop)
  • If total drop chances < 1.0, there's a chance for no drop
  • Example: 0.1 Gold = 10% gold, 90% nothing

Allow Multiple Drops = TRUE

  • Independent rolls for each entry
  • Multiple items can drop
  • Each entry has independent chance
  • Example: 0.5 Gold (50%) + 0.3 Health (30%) = Both can drop

🎮 Enemy Configuration

XP Reward Methods

enum EURFXPGainMethod
{
    DirectOnKill,    // Instant XP (no pickup)
    PickupOnly,      // Must collect pickup
    Hybrid           // Partial instant + pickup
};

Guaranteed Pickup

When: PickupOnly or Hybrid mode What: Always drops (usually XP pickup) XP Amount: Based on enemy's XPReward and HybridDirectXPPercentage

// Example: Hybrid mode with 50% direct
XPReward = 100
HybridDirectXPPercentage = 0.5

Result:
- 50 XP instant (DirectOnKill)
- 50 XP pickup (GuaranteedPickupClass)

Random Loot

Independent of XP method Can have multiple loot tables Rolls on enemy death

// Enemy properties
bool bEnableRandomLoot = true;
TArray<UURFLootDropDataAsset*> RandomLootTables;

📋 Example Configurations

Example 1: Basic Enemy (Direct XP Only)

XPGainMethod: DirectOnKill
XPReward: 10
GuaranteedPickupClass: None
bEnableRandomLoot: false

Result: 10 XP instant, no pickups


Example 2: Pickup-Based Enemy

XPGainMethod: PickupOnly
XPReward: 20
GuaranteedPickupClass: BP_XPPickup
bEnableRandomLoot: false

Result: 1 XP pickup (20 XP)


Example 3: Hybrid with Random Loot

XPGainMethod: Hybrid
XPReward: 50
HybridDirectXPPercentage: 0.3
GuaranteedPickupClass: BP_XPPickup
bEnableRandomLoot: true
RandomLootTables: [DA_CommonLoot]

Result:

  • 15 XP instant (30%)
  • 1 XP pickup (35 XP)
  • Random loot from DA_CommonLoot

Example 4: Boss with Multiple Loot Tables

XPGainMethod: PickupOnly
XPReward: 500
GuaranteedPickupClass: BP_XPPickup_Large
bEnableRandomLoot: true
RandomLootTables: [DA_BossLoot, DA_RareLoot, DA_PowerupLoot]

Result:

  • 1 large XP pickup (500 XP)
  • Rolls DA_BossLoot (guaranteed drops)
  • Rolls DA_RareLoot (rare items)
  • Rolls DA_PowerupLoot (powerups)

🎨 Loot Table Examples

Common Enemy Loot

Name: DA_CommonEnemyLoot
Allow Multiple Drops: false (pick one or nothing)

Entries:
1. Gold Coin
   - PickupClass: BP_GoldPickup
   - DropChance: 0.6 (60% gold)
   - MinXP: 5
   - MaxXP: 10

2. Health Potion
   - PickupClass: BP_HealthPickup
   - DropChance: 0.3 (30% health)
   - MinXP: 15
   - MaxXP: 25

Total: 0.9 (90% something drops, 10% nothing)

Result: 60% gold, 30% health, 10% nothing


Boss Guaranteed Loot

Name: DA_BossGuaranteedLoot
Allow Multiple Drops: true (all can drop)

Entries:
1. Large Gold
   - PickupClass: BP_GoldPickup_Large
   - DropChance: 1.0 (100%)
   - MinXP: 100
   - MaxXP: 200

2. Rare Item
   - PickupClass: BP_RareItem
   - DropChance: 1.0 (100%)
   - MinXP: 50
   - MaxXP: 50

3. Bonus Chest
   - PickupClass: BP_Chest
   - DropChance: 0.5 (50%)
   - MinXP: 0
   - MaxXP: 0

Result: Gold + Rare Item always, Chest 50% chance


Powerup Loot

Name: DA_PowerupLoot
Allow Multiple Drops: true (independent rolls)

Entries:
1. Speed Boost
   - PickupClass: BP_SpeedBoost
   - DropChance: 0.2 (20%)

2. Damage Boost
   - PickupClass: BP_DamageBoost
   - DropChance: 0.2 (20%)

3. Shield
   - PickupClass: BP_Shield
   - DropChance: 0.15 (15%)

Result: Each has independent chance to drop


🔧 Blueprint Usage

Get Total Drop Chance (Debug)

float TotalChance = LootTable->GetTotalDropChance();
// Useful for balancing

Manual Loot Roll

TArray<FURFLootDropEntry> Drops = LootTable->RollForLoot();
for (FURFLootDropEntry& Entry : Drops)
{
    // Spawn Entry.PickupClass
}

💡 Best Practices

1. Guaranteed Pickup

  • Use for XP pickups
  • Set in GuaranteedPickupClass
  • Works with PickupOnly and Hybrid modes

2. Random Loot

  • Use for variety (gold, health, powerups)
  • Can have multiple tables per enemy
  • Independent of XP method

3. Drop Chances

  • Common items: 0.5 - 0.8 (50-80%)
  • Uncommon items: 0.2 - 0.4 (20-40%)
  • Rare items: 0.05 - 0.15 (5-15%)
  • Very rare items: 0.01 - 0.05 (1-5%)

4. Multiple Tables

  • Separate concerns (XP, gold, powerups)
  • Easier to balance
  • Reusable across enemies

5. Allow Multiple Drops

  • FALSE: Pick one (or nothing if total < 1.0)
    • 0.1 = 10% drop, 90% nothing
    • 0.5 + 0.3 = 50% first, 30% second, 20% nothing
  • TRUE: Independent rolls (can drop multiple)
    • 0.1 = 10% chance (independent)
    • Each entry rolls separately

🎯 Common Patterns

Pattern 1: Simple Enemy

DirectOnKill + No Random Loot
= Instant XP only

Pattern 2: Pickup Enemy

PickupOnly + Guaranteed Pickup
= Must collect XP

Pattern 3: Loot Enemy

DirectOnKill + Random Loot (gold/health)
= Instant XP + chance for bonus

Pattern 4: Boss

Hybrid + Guaranteed Pickup + Multiple Random Tables
= Partial instant XP + guaranteed pickup + multiple loot rolls

🐛 Debugging

Console Commands

URF.PickupStats  - Show pickup pool stats
URF.PickupDebug 1 - Show pickup debug shapes

Logging

bEnableDebugLogging = true  // On enemy

Check Loot Table

float Total = LootTable->GetTotalDropChance();
UE_LOG(LogTemp, Warning, TEXT("Total drop chance: %.2f"), Total);

✅ Summary

Guaranteed Pickup:

  • Always drops
  • Based on XPReward
  • Set in GuaranteedPickupClass

Random Loot:

  • Chance-based
  • Multiple tables supported
  • Independent of XP method

Flexible:

  • Mix and match
  • Per-enemy configuration
  • Data-driven (data assets)

Clone this wiki locally