Skip to main content

Creating Custom Modes

Overview

This page covers creating a custom arena mode with some more advanced features. It largely picks up from the Arena Configuration page, so before continuing on with this section, it's recommended to familiarize yourself with the arena configurations. This is primarily a walk-through example. 

In this example, we will be creating a 2v2 PvP game with up to 5 players on each team called Red vs Blue. Each player will have 3 lives, and the last remaining team alive wins. This will be a 10 minute game.

Standard Options

The first step will be configuring the standard options for the arena.

name: RedvsBlue
aliases: [rvb]
mode: Arena
type: Match

This sets the arena name to RedvsBlue, the aliases for the command to /rvb, the mode to Arena, and the type to Match.

Team Options

team-options:
  named-teams: true
  team-size: 2-5
  team-amount: 2
  team-selection: random

This will set the team options to use named teams, with a team size of between 2 - 5 players from earlier. This means the game will begin starting when there are at least 2 players on each team, but max out at 5 players on each.

Modules

For this mode, we will be enabling two additional modules: Classes and Team Heads.

In order to enable these, the following options have been added:

modules:
  - classes
  - team-heads

Lives

The lives configuration has been updated to be enabled, and give each player three lives.

lives:
  enabled: true
  amount: 3

Victory Conditions

The following victory conditions have been enabled: teams-alive and time-limit. We want the game to end when there is one team alive, but if after 10 minutes there is no victor, the game should end in a draw.

victory-conditions:
  teams-alive:
    amount: 1
  time-limit:
    time-limit: 10m

Events

For this mode, we will be using very similar events from the arena.yml, however some changes have been made since players will have multiple lives in this mode.

In the on-death event, the teleport and delay actions have been removed, leaving it as the following:

events:
  on-death:
    - clear-inventory
    - repsawn

Since the player has multiple lives, we don't want them being teleported back to the waitroom on death. However, if the player has exhausted all their lives, we also don't want them being teleported into the game. The following events below are used:

events:
  on-life-deplete:
    - delay{ticks=2}
    - give-effects{effects=[speed 300 1]}
    - teleport{location=team_spawn}
    - equip-class{class=warrior}
  on-lives-exhaust:
    - delay{ticks=2}
    - teleport{location=waitroom}

As seen here, on-life-deplete is used when the lives are depleted. This is called upon death, but only when the player has lives remaining. We want to use this event here as it allows players to be teleported back to the game, only when they have lives to spare.

However, when the player runs out of lives, on-lives-exhaust is called. In this case, we want to teleport the player back to the waitroom.

More details about these events and others can be found on the Event Reference page.