-
Notifications
You must be signed in to change notification settings - Fork 0
Step 4: Loot System Guide
Can TATAR edited this page Feb 23, 2026
·
3 revisions
Flexible loot drop system with guaranteed and random drops.
Data asset that defines loot drops with chances.
- Guaranteed Pickup - Always drops (XP pickup)
- Random Loot - Chance-based drops (multiple tables)
- Right-click in Content Browser
- URF → Loot Drop Data
-
Name it (e.g.,
DA_CommonEnemyLoot)
// 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
};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
enum EURFXPGainMethod
{
DirectOnKill, // Instant XP (no pickup)
PickupOnly, // Must collect pickup
Hybrid // Partial instant + 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)Independent of XP method Can have multiple loot tables Rolls on enemy death
// Enemy properties
bool bEnableRandomLoot = true;
TArray<UURFLootDropDataAsset*> RandomLootTables;XPGainMethod: DirectOnKill
XPReward: 10
GuaranteedPickupClass: None
bEnableRandomLoot: false
Result: 10 XP instant, no pickups
XPGainMethod: PickupOnly
XPReward: 20
GuaranteedPickupClass: BP_XPPickup
bEnableRandomLoot: false
Result: 1 XP pickup (20 XP)
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
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)
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
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
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
float TotalChance = LootTable->GetTotalDropChance();
// Useful for balancingTArray<FURFLootDropEntry> Drops = LootTable->RollForLoot();
for (FURFLootDropEntry& Entry : Drops)
{
// Spawn Entry.PickupClass
}- Use for XP pickups
- Set in GuaranteedPickupClass
- Works with PickupOnly and Hybrid modes
- Use for variety (gold, health, powerups)
- Can have multiple tables per enemy
- Independent of XP method
- 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%)
- Separate concerns (XP, gold, powerups)
- Easier to balance
- Reusable across enemies
-
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
DirectOnKill + No Random Loot
= Instant XP only
PickupOnly + Guaranteed Pickup
= Must collect XP
DirectOnKill + Random Loot (gold/health)
= Instant XP + chance for bonus
Hybrid + Guaranteed Pickup + Multiple Random Tables
= Partial instant XP + guaranteed pickup + multiple loot rolls
URF.PickupStats - Show pickup pool stats
URF.PickupDebug 1 - Show pickup debug shapes
bEnableDebugLogging = true // On enemyfloat Total = LootTable->GetTotalDropChance();
UE_LOG(LogTemp, Warning, TEXT("Total drop chance: %.2f"), Total);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)