helmet-battleBattle

This guide explains how to create a Battle NPC, how its interaction system works, how to define its Pokémon party, and how behaviours control battles and rewards.

All examples shown here are real and fully functional.


📁 Required Folder Structure

config/
└── CobbleBetterNPC/
    ├── NPC/
    │   └── battles/
    │       └── battle_001.json
    └── Dialogues/
        └── battles/
            └── battle_001.json

📌 These folders can be generated automatically with: /cbn create example battle

📌 Apply changes with: /cbn reload


🧍 Battle NPC File

config/
└── CobbleBetterNPC/
    └── NPC/
        └── battles/
            └── battle_001.json
 

This file defines the NPC as an entity:

  • What type of NPC it is

  • How many Pokémon it uses

  • Which Pokémon it has

  • What happens on win or loss

  • Which dialogue opens on interaction


📄 Full File


🧠 Field-by-Field Explanation

🔹 NPC Identity

Field
Description

id

Unique NPC identifier

type

battle indicates this NPC can start battles

names

NPC display name

resourceIdentifier

Base model used

presets

Optional presets (can be empty)


🎯 Battle Difficulty & Behavior

Field
Description

skill

NPC AI intelligence (0.0 – 1.0)

autoHealParty

Automatically heals party after each battle

isMovable

Prevents the NPC from walking


🧬 Pokémon Party Rules

Field
Description

minPokemon

Minimum Pokémon used

maxPokemon

Maximum Pokémon used

📌 If both values are equal, the NPC will always use that exact number.


🐉 Pokémon Party

The party list defines the NPC’s Pokémon team, using Cobblemon syntax.

Example:


🔁 Interaction (Dialogue Trigger)

Field
Purpose

with

Priority (lower = first)

permission

Required permission (empty = everyone)

dialogue

Dialogue that opens

📌 Battles never start automatically — they always start from dialogue.


🧠 Used Behaviours

Behaviour
Purpose

battler

Enables battling

battle_commands

Executes commands on win/loss

looks_at_players

NPC looks at players

core

Base logic (required)


⚙️ Battle Command Variables

Variable
Usage

winrewards

Command executed on win

loserewards

Command executed on loss

📌 Use @s to target the battling player.


💬 Battle NPC Dialogue

📄 config/CobbleBetterNPC/Dialogues/battles/battle_001.json

This file controls:

  • NPC speech

  • Player options

  • Battle start logic


📄 Full File


⚔️ How Does the Battle Start?

  1. Player interacts with NPC

  2. Dialogue opens

  3. Player selects “Let’s start the battle”

  4. The action runs:

  5. Pokémon battle begins

  6. When finished:

    • winrewards or loserewards is executed


Last updated