> For the complete documentation index, see [llms.txt](https://realisticnode.gitbook.io/rnsetups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://realisticnode.gitbook.io/rnsetups/rnkoth/guides/modes.md).

# Game modes and rules of the fight

Capture and score modes, leaving the area, contested areas, overtime, the end of the event and roaming KOTHs.

Every option on this page is in the KOTH file (`koths/<name>.yml`) and in `/koth editor <name>`.

## Who is holding the KOTH

Every half second the plugin looks at who stands inside the area and **counts** (see [who counts](/rnsetups/rnkoth/guides/rules.md#who-counts)). Players are grouped in **sides**: each player alone, or each team (see [Teams](/rnsetups/rnkoth/guides/teams.md)).

| Inside the area              | State         | What happens                                        |
| ---------------------------- | ------------- | --------------------------------------------------- |
| Nobody who counts            | **Free**      | Nobody gains. Progress follows the `on-leave` rule. |
| Players of one side          | **Capturing** | That side gains. It is the **holder**.              |
| Players of two or more sides | **Contested** | Depends on `contested` (below).                     |

## Capture mode

```yaml
mode: capture
capture:
  time: 120
```

The first side that holds the KOTH **alone** for `capture.time` seconds wins. The boss bar, the action bar and the hologram show the progress as a bar and a percent.

<figure><img src="https://348500357-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSlVHklG0EMAOmvfqcizu%2Fuploads%2FGZdazNJx8HSNRik2Q1EN%2Frnkoth-en-holding.png?alt=media" alt="Capturing: green border, progress in the boss bar and the action bar"><figcaption><p>Capturing: green border, progress in the boss bar and the action bar</p></figcaption></figure>

### When you leave or die: `capture.on-leave`

| Value             | What happens to your progress                                                                                                                               |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `reset` (default) | It goes back to 0 as soon as your side is not inside any more.                                                                                              |
| `pause`           | It stays. When you come back you continue. Anyone else who takes the KOTH must first bring your progress down to 0 before their own bar grows (tug of war). |
| `drain`           | It goes down slowly while nobody is inside, at `capture.drain-speed`. Like `pause`, anyone else must first bring it down to 0.                              |

`capture.drain-speed` (default `1.0`) is how many seconds of progress are lost per second with `drain` while the area is empty. `2.0` drains twice as fast, `0.5` half as fast. When another side is pushing your progress down, it goes down at least 1 second per second (or faster with a higher `drain-speed`).

While another side brings your progress down, their action bar shows `Bringing down Steve's progress 45%...`.

{% hint style="info" %}
With `reset`, jumping or stepping on the edge would lose the progress. That is why every area is at least 3 blocks high. If players lose progress near the edges, make the area a bit bigger or use `pause`.
{% endhint %}

## Score mode

```yaml
mode: score
score:
  target: 300
```

The holder gets **1 point per second**. The first side to reach `score.target` points wins. When the time runs out, the side with the most points wins.

Points are never lost: leaving the area only stops you from earning more. `on-leave` and `drain-speed` are not used in score mode.

## Contested areas: `contested`

A side is a team, or a single player when players are on their own (`teams: solo`, or `teams.mode: solo` in `config.yml`).

| Value                | When players of different sides are inside                                                                                            |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `freeze`             | Nobody gains until only one side is left. Every bar stays where it is.                                                                |
| `majority`           | The side with **more players** inside keeps gaining. With the same number of players, nobody gains.                                   |
| `holder` (new KOTHs) | **The king defends it.** The side that was already gaining keeps gaining as if it were alone. The others must kill it or push it out. |
| `everyone`           | **Free for all.** Every side inside gains its own progress at the same time, as if it were alone. It is never contested.              |

{% hint style="warning" %}
With solo teams every side has one player, so `majority` is always a tie and nobody ever gains. Use `holder` or `everyone`. The console warns once when a KOTH uses `majority` with solo teams.
{% endhint %}

New KOTHs use `holder`. A KOTH file without a `contested` line uses `freeze`, so older files keep working as before.

With `freeze` and `majority`, while contested the boss bar and the border particles turn red, and the boss bar and action bar say `CONTESTED` (`majority` only when nobody gains). The chat says `is contested!` once.

<figure><img src="https://348500357-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSlVHklG0EMAOmvfqcizu%2Fuploads%2FG3wwa21JxV9beJRByXWa%2Frnkoth-en-contested.png?alt=media" alt="Contested: red particles, red boss bar and a chat message"><figcaption><p>Contested: red particles, red boss bar and a chat message</p></figcaption></figure>

### `holder`

* If nobody was gaining and several sides walk in at the same moment, the side that has been inside the longest becomes the holder. On a tie, the side with the most progress wins it.
* When the holder leaves or dies, the next side becomes the holder: the one inside the longest, or, if that is a tie, the one with the most progress. The chat says `X is taking <KOTH> from Y`.
* Capture mode: `on-leave` applies to the side that left, as usual. With `pause` or `drain`, a new holder first brings down the progress the old one left (the tug of war).
* Score mode: only the holder scores.
* The chat says `X is capturing` when someone becomes the holder. It never says `is contested!`.
* The boss bar, hologram and locator show how many players of other sides are inside, for example `Castle » Alex 45% (defending against 2)` (`bossbar.defending`, `bossbar.defending-score`, `hologram.defending`, `hud.locator-defending`, placeholder `{others}`). The boss bar keeps its colour, and the border particles keep the holder colours (green for the holder's side, orange for the others).

### `everyone`

* Capture mode: the first side to fill its bar wins. The boss bar and sidebar show the leader (the side with the most progress), and each player's action bar shows their own progress.
* Score mode: every side inside scores 1 point per second.
* `on-leave` applies to each side that leaves, as usual. Nobody has to bring down anyone else's progress.
* The chat says `X is capturing` for each side when it starts, and `X lost control` when it leaves. A quick step out and back in says nothing. It never says `is contested!`.

## Duration and overtime

```yaml
duration: 900
overtime: 60
```

* `duration`: the longest the event can last, in seconds (default `900`, 15 minutes). `0` = no time limit: the event stays open until someone conquers it (or an admin stops it with `/koth stop`), and the boss bar and placeholders show `No limit`.
* `overtime`: when the time runs out while the fight is still going on, the event gets up to this many extra seconds (`0` = off). The chat announces `OVERTIME!` and the boss bar counts down the overtime.

Overtime starts when, at the end of the time:

* the KOTH is **contested** (with `holder`: other sides are inside with the holder), or
* someone is **bringing down** another side's progress (`pause` or `drain`), or
* in capture mode, the holder has **some progress**.

The event **ends as soon as the fight is over**, or when the overtime runs out. If the holder fills the bar during overtime, they win.

{% hint style="info" %}
In score mode, overtime only starts when the KOTH is contested.
{% endhint %}

## When the time runs out

{% hint style="info" %}
This does not apply with `duration: 0` (no time limit): the time never runs out, so there is no overtime and `best-wins-when-time-ends` does nothing. The event only ends when someone captures it (capture) or reaches the target (score), or when an admin stops it.
{% endhint %}

| Mode                                                        | Who wins                                 |
| ----------------------------------------------------------- | ---------------------------------------- |
| Capture, `capture.best-wins-when-time-ends: true` (default) | The side with the most progress.         |
| Capture, `capture.best-wins-when-time-ends: false`          | Nobody. The event ends without a winner. |
| Score                                                       | The side with the most points.           |

If nobody has any progress or points, the event ends without a winner. 2nd and 3rd place are the next sides by progress or points (see [Rewards](/rnsetups/rnkoth/guides/rewards.md)). When two sides have exactly the same progress or points, the one whose name comes first alphabetically gets the better place.

The end message in chat depends on the mode (texts in `results` of the language file):

| End                         | Message                                                                                            |
| --------------------------- | -------------------------------------------------------------------------------------------------- |
| Capture, the bar was filled | `results.captured`: the new king, no podium (only one side can win)                                |
| Capture, the time ran out   | `results.time-up`: who wins with the most progress, no podium                                      |
| Score                       | `results.won`: the winner and a podium with one line per place that has someone (`results.podium`) |
| Nobody won                  | `results.nobody-won`                                                                               |

<figure><img src="https://348500357-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSlVHklG0EMAOmvfqcizu%2Fuploads%2FdS8FplKNSvwp6Bsj5gEA%2Frnkoth-en-chat-end.png?alt=media" alt="The end in chat: the conquered announcement, the podium and the summary"><figcaption><p>The end in chat: the start and capture messages and the end summary</p></figcaption></figure>

## Roaming KOTHs (several areas)

Give a KOTH two or more areas (`/koth setzone <name> add`, or **Add another area** in the editor) and it moves between them.

```yaml
roaming:
  move-every: 120
  order: next
```

| Option               | Values                                                                                                                                  |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `roaming.move-every` | Seconds between moves **during** an event. `0` = it does not move during the event; instead **each new event starts in the next area**. |
| `roaming.order`      | `next` = in the order of the list. `random` = any other area.                                                                           |

When the KOTH moves:

* The chat announces `The KOTH moved!` with the new location, and the `moved` sound plays.
* In capture mode, **every capture bar starts again** from 0. In score mode, points are kept.
* The holder must step into the new area to continue.

The hologram, particles, locator and boss bar follow the area where the KOTH is now. `{move_in}` in the texts shows the time until the next move.

{% hint style="info" %}
With `order: random`, the event starts in a random area, and during the event it never moves to the same area twice in a row. With `order: next`, each event starts in the area after the one where the last event started; this is saved in `data/running.yml`, so it goes on after a restart.

The area of the next event is chosen before it starts, and the warnings, the countdown, the "not enough players" message, the hologram and `/koth tp` already use it. With `order: random` it is picked once and kept until that event starts.
{% endhint %}

## Example setups

**Classic KOTH**: hold it 2 minutes alone, leaving resets it.

```yaml
mode: capture
capture:
  time: 120
  on-leave: reset
contested: freeze
```

**Tug of war**: progress is kept, so every visit matters.

```yaml
mode: capture
capture:
  time: 180
  on-leave: pause
contested: freeze
overtime: 120
```

**Big team fights**: points, and the bigger team inside keeps gaining.

```yaml
mode: score
score:
  target: 600
duration: 1200
contested: majority
```

**Everyone on their own**: no teams, the first one inside defends it.

```yaml
teams: solo
contested: holder
```

**Free for all race**: everyone inside fills their own bar, the fastest wins.

```yaml
teams: solo
contested: everyone
capture:
  time: 90
  on-leave: drain
```

**Moving hill**: three areas, it moves every 2 minutes.

```yaml
zones:
  - 'box world 100 64 100 110 66 110'
  - 'box world 200 70 -50 208 72 -42'
  - 'circle world -80 65 30 6 4'
roaming:
  move-every: 120
  order: next
```
