# How to Create a Skeleton Ambush Travel Event

This guide shows you how to create a Simple Combat Travel Event that spawns 1-3 Skeleton Warriors.

## Method 1: Using Unity's Create Menu (Recommended)

### Step 1: Create the Event Asset
1. In the **Project window**, navigate to `Assets/Resources/TravelEvents/`
2. Right-click and select **Create → RPG → Travel Events → Combat Event**
3. Name it `SkeletonAmbush`

### Step 2: Configure the Event in Inspector
Open the `SkeletonAmbush` asset and configure these settings:

#### Basic Event Info
- **Event Name**: `Skeleton Ambush`
- **Event Description**: `Ancient skeletal warriors rise from the ground to attack your party!`
- **Event Type**: `Combat`
- **Rarity**: `Common`

#### Terrain Preferences (where skeletons are more likely)
- **Plains Chance**: `0.3` (30%)
- **Forest Chance**: `0.8` (80% - very common in forests)
- **Mountain Chance**: `0.6` (60%)
- **Road Chance**: `0.2` (20% - safer on roads)
- **River Chance**: `0.4` (40%)
- **Lake Chance**: `0.3` (30%)
- **Ocean Chance**: `0.1` (10%)

#### Feature Preferences
- **Town Chance**: `0.05` (5% - very rare in towns)
- **Village Chance**: `0.15` (15%)
- **Bridge Chance**: `0.4` (40%)
- **Tunnel Chance**: `0.7` (70% - common in tunnels/caves)
- **Ferry Chance**: `0.2` (20%)

#### Timing
- **Can Occur Multiple Times**: ✅ **Checked**
- **Cooldown Days**: `0.5` (half a day before can happen again)

#### Combat Event Settings
- **Min Enemies**: `1`
- **Max Enemies**: `3`
- **Possible Enemy Types**: 
  - Add `Skeleton Warrior`
  - Add `Skeleton` (if you have both types)

#### Combat Event Descriptions
Add these dramatic descriptions (the system will pick one randomly):
- `Bones clatter as skeletal warriors emerge from the earth!`
- `Ancient skeletons wielding rusty weapons block your path!`
- `The ground splits open as undead skeletons rise to attack!`
- `Skeletal archers take aim from the shadows ahead!`

#### Difficulty
- **Difficulty**: `Easy` or `Normal` (depending on your game balance)

### Step 3: Test the Event
1. **Save** the asset
2. In the **TravelEventSystem** component, add your new event to the **Available Events** list
3. Use the **Debug** option `Trigger Event Check` to test it

## Method 2: Using the Travel Event System (In-Game)

### Auto-Loading from Resources
If you put the event in `Assets/Resources/TravelEvents/`, the system will automatically load it when no events are assigned to the TravelEventSystem.

### Manual Assignment
1. Find the **TravelEventSystem** component in your scene
2. In the **Available Events** list, click the **+** button
3. Drag your `SkeletonAmbush` asset into the slot

## Integration with Your Enemy System

### Using Your Generated Enemy Names
Since you have the enemy character creation system, use these enemy names in the **Possible Enemy Types**:
- `Skeleton Warrior` (matches your SkeletonWarrior.asset)
- `Skeleton` (if you create a basic skeleton variant)

### Battle Integration
When the event triggers, it will:
1. **Stop Travel** (if configured to do so)
2. **Create Battle Data** with the specified enemy count and type
3. **Call HandleBattleEvent** in TravelEventSystem
4. **Set up BattleSetupData** for your battle system

### Example Battle Setup Code
In `TravelEventSystem.cs`, the `HandleBattleEvent` method will populate your battle system:

```csharp
private void HandleBattleEvent(BattleEventData battleData, TravelEventContext context)
{
    if (battleData == null) return;

    Debug.Log($"⚔️ Setting up battle: {battleData.enemyCount} {battleData.enemyType}(s)");

    // This integrates with your battle system
    BattleSetupData.enemySelections.Clear();
    for (int i = 0; i < battleData.enemyCount; i++)
    {
        BattleSetupData.enemySelections.Add(new CharacterSelection
        {
            characterName = $"{battleData.enemyType}_{i+1}",
            weaponType = "Bow" // Skeleton Warriors use bows
        });
    }
    
    // Start the battle scene
    // SceneManager.LoadScene("BattleScene");
}
```

## Testing Your Event

### Debug Testing
1. Enable **Show Debug Logs** in TravelEventSystem
2. Set **Force Next Event** to true
3. Click **Trigger Event Check** in the Inspector
4. Check the Console for event messages

### Travel Testing
1. Start traveling on the map
2. The event will trigger based on terrain probabilities
3. Higher chance in forests (80%), lower on roads (20%)

## Customization Tips

### Adjust Spawning Numbers
- **Easy encounters**: `minEnemies = 1, maxEnemies = 2`
- **Normal encounters**: `minEnemies = 1, maxEnemies = 3` 
- **Hard encounters**: `minEnemies = 2, maxEnemies = 4`

### Terrain-Specific Variants
Create different skeleton events for different terrains:
- **Forest Skeleton Ambush**: High forest chance, includes Forest Skeleton types
- **Mountain Skeleton Raiders**: High mountain chance, tougher skeleton variants
- **Road Skeleton Bandits**: Moderate road chance, skeleton brigands

### Loot and Rewards
The system can also provide rewards after defeating skeletons:
- **Gold Reward**: Based on the enemies defeated
- **Experience**: From your enemy character data
- **Items**: From the DropTable in your EnemyCharacterData

Your Skeleton Ambush event is now ready to terrorize travelers! 💀⚔️
