Skip to content

Step 6: Fallback Card Guide

Can TATAR edited this page Feb 23, 2026 · 1 revision

Fallback Cards System Guide

Overview

The Fallback Cards system provides alternative card options when the weapon pool is empty or all weapons are at max level. This ensures players always have meaningful choices during level-ups.

Features

  • Health Restore: Heal the player (flat amount or percentage)
  • Currency Bonus: Grant currency to the player
  • XP Bonus: Grant additional experience points
  • Stat Boost: Modify player stats (MaxHealth, MoveSpeed, etc.)
  • Custom: Extensible for Blueprint implementations

Quick Start

1. Create a Fallback Card Data Asset

  1. Right-click in Content Browser
  2. Navigate to: Miscellaneous → Data Asset
  3. Select: URFFallbackCardDataAsset
  4. Name it: DA_FallbackHealthRestore

2. Configure the Card

Open the data asset and configure:

Card Info:
├─ Card Name: "Health Restore"
├─ Card Description: "Restore 30 health"
└─ Card Icon: [Select texture]

Card Type:
└─ Fallback Type: Health Restore

Health Settings:
├─ Health Amount: 30.0
├─ Use Percentage: false
└─ Health Percentage: 0.3 (if using percentage)

3. Add to Level Up System

  1. Select your Player Blueprint
  2. Find URFLevelUpSystem component
  3. In Fallback Cards category:
    • Add element to Fallback Cards Pool
    • Select your DA_FallbackHealthRestore
    • Enable Use Fallback Cards (enabled by default)

4. Test

  1. Play the game
  2. Level up when weapon pool is empty
  3. Fallback cards will appear as options

Card Types

Health Restore

Restores player health.

Properties:

  • Health Amount: Flat health to restore (e.g., 30.0)
  • Use Percentage: Use percentage instead of flat amount
  • Health Percentage: Percentage of max health (0.0 - 1.0)

Example:

Flat: Health Amount = 30.0 → Restores 30 HP
Percentage: Health Percentage = 0.3 → Restores 30% of max HP

Currency Bonus

Grants currency to the player.

Properties:

  • Currency Amount: Amount of currency to grant (e.g., 100)
  • Currency Type: Type of currency (e.g., "Gold", "Gems")

Example:

Currency Amount = 100
Currency Type = "Gold"
→ Grants 100 Gold

XP Bonus

Grants additional experience points.

Properties:

  • XP Amount: Amount of XP to grant (e.g., 50)

Example:

XP Amount = 50
→ Grants 50 XP (may trigger another level up!)

Stat Boost

Modifies player stats permanently.

Properties:

  • Stat Modifiers: Map of stat names to values

Example:

Stat Modifiers:
├─ "MaxHealth" → 10.0
├─ "MoveSpeed" → 5.0
└─ "Damage" → 2.0

Custom

For Blueprint-based custom implementations.

Note: Implement custom logic in Blueprint by listening to OnCardSelected event and checking for FallbackCard type.

How It Works

Card Generation Logic

When a level up occurs:

  1. Generate weapon cards (new weapons + upgrades)
  2. Check if enough cards (need CardsPerLevelUp cards)
  3. If not enough:
    • Calculate needed cards: NeededCards = CardsPerLevelUp - CurrentCards
    • Randomly select from FallbackCardsPool
    • Add fallback cards to fill the gap

Scenarios

Scenario 1: Weapon Pool Empty, Upgrades Available

Available Weapons: 0
Upgradeable Slots: 2
Fallback Cards: 3
Cards Per Level Up: 3

Result: 2 Upgrade Cards + 1 Fallback Card = 3 Cards ✅

Scenario 2: Weapon Pool Empty, No Upgrades

Available Weapons: 0
Upgradeable Slots: 0
Fallback Cards: 3
Cards Per Level Up: 3

Result: 3 Fallback Cards ✅

Scenario 3: Weapon Pool Available

Available Weapons: 5
Upgradeable Slots: 3
Fallback Cards: 3
Cards Per Level Up: 3

Result: 3 Random (Weapon/Upgrade) Cards
Fallback cards not used ✅

Configuration

Level Up System Settings

// Fallback Cards Settings
UPROPERTY(EditAnywhere, Category = "URF|Fallback Cards")
TArray<URFFallbackCardDataAsset*> FallbackCardsPool;

UPROPERTY(EditAnywhere, Category = "URF|Fallback Cards")
bool bUseFallbackCards = true;

Properties:

  • Fallback Cards Pool: Array of fallback card data assets
  • Use Fallback Cards: Enable/disable fallback cards system

Blueprint Integration

Displaying Fallback Cards in UI

Fallback cards use the same FURFCardOption structure:

struct FURFCardOption
{
    EURFCardType CardType;              // Will be "FallbackCard"
    UURFWeaponDataAsset* WeaponData;    // Null for fallback cards
    URFFallbackCardDataAsset* FallbackData;  // Contains card info
    int32 WeaponSlotIndex;              // -1 for fallback cards
};

UI Display Logic

For each card in CardOptions:
    If CardType == FallbackCard:
        Display FallbackData->CardName
        Display FallbackData->CardDescription
        Display FallbackData->CardIcon
    Else:
        Display WeaponData->WeaponName
        Display WeaponData->Description
        Display WeaponData->Icon

Example Blueprint

Event OnLevelUpCardSelection(CardOptions)
├─ For Each (CardOptions)
│   ├─ Switch on CardType
│   │   ├─ Case NewWeapon:
│   │   │   └─ Create Weapon Card Widget
│   │   ├─ Case UpgradeWeapon:
│   │   │   └─ Create Upgrade Card Widget
│   │   └─ Case FallbackCard:
│   │       └─ Create Fallback Card Widget
│   │           ├─ Set Text: FallbackData->CardName
│   │           ├─ Set Description: FallbackData->CardDescription
│   │           └─ Set Icon: FallbackData->CardIcon

Example Fallback Cards

Health Restore Card

Name: "Healing Touch"
Description: "Restore 30% of your maximum health"
Type: Health Restore
Use Percentage: true
Health Percentage: 0.3

Currency Card

Name: "Treasure Chest"
Description: "Gain 100 gold coins"
Type: Currency Bonus
Currency Amount: 100
Currency Type: "Gold"

XP Card

Name: "Knowledge Boost"
Description: "Gain 50 experience points"
Type: XP Bonus
XP Amount: 50

Stat Boost Card

Name: "Permanent Power"
Description: "Increase max health by 10 and move speed by 5"
Type: Stat Boost
Stat Modifiers:
  - MaxHealth: 10.0
  - MoveSpeed: 5.0

Best Practices

  1. Create diverse fallback cards: Mix health, currency, XP, and stat boosts
  2. Balance values: Ensure fallback cards are as valuable as weapon upgrades
  3. Use clear names: Make it obvious what each card does
  4. Add icons: Visual feedback improves player experience
  5. Test edge cases: Test with empty weapon pool and max level weapons

Troubleshooting

Fallback cards not appearing

Check:

  • Use Fallback Cards is enabled
  • Fallback Cards Pool is not empty
  • Weapon pool is actually empty or all weapons are max level

Fallback card has no effect

Check:

  • Required component exists on player (HealthComponent, CurrencyComponent, etc.)
  • Enable Debug Logging in Level Up System to see logs
  • Check console for warnings

Wrong card info displayed

Check:

  • UI is checking CardType and using correct data source
  • For fallback cards, use FallbackData not WeaponData

Technical Details

Files Modified

New Files:
├─ URFFallbackCardDataAsset.h
└─ URFFallbackCardDataAsset.cpp

Modified Files:
├─ URFLevelUpSystem.h
└─ URFLevelUpSystem.cpp

Dependencies

Fallback cards require these components:

  • URFHealthComponent (for Health Restore)
  • URFCurrencyComponent (for Currency Bonus)
  • URFExperienceComponent (for XP Bonus)
  • URFPlayerStatsComponent (for Stat Boost)

If a component is missing, the card effect will be skipped with a warning log.

Advanced Usage

Custom Fallback Cards

Create custom fallback card types in Blueprint:

  1. Set Fallback Type to Custom
  2. Listen to OnCardSelected event
  3. Check if CardType == FallbackCard
  4. Implement custom logic based on FallbackData

Dynamic Fallback Pool

Modify the fallback pool at runtime:

// Add fallback card
LevelUpSystem->FallbackCardsPool.Add(NewFallbackCard);

// Remove fallback card
LevelUpSystem->FallbackCardsPool.Remove(OldFallbackCard);

// Clear pool
LevelUpSystem->FallbackCardsPool.Empty();

Clone this wiki locally