12 Arena Signs
garbagemule edited this page 2020-11-08 14:51:23 +01:00

On this page:

Since v0.101, MobArena has native join, leave, and info signs. The signs use the templates stored in the signs.yml file in the MobArena plugin folder to display live information about specific arenas, and they recognize some of the different states that an arena can be in.

Placing Arena Signs

To set up an arena sign, place a sign and use the following format on it:

[MA]          <-- Needed by MobArena
<arena>       <-- Name of arena to show information about
<type>        <-- Sign type (join, leave, or info)
<template>    <-- Name of a template defined in signs.yml

Once placed, the sign will begin to render the given template, and react to players interacting with it based on its type.

Example

For an arena named jungle, here's how to set up a join sign that uses a template called welcome:

Because of its type, it will cause players to join the jungle arena when they click on it. What the sign displays depends on how the welcome template is defined.

Sign Types

The third line on an arena sign is the sign type. MobArena supports the following three sign types:

  • join signs cause players to join the arena when clicked.
  • leave signs cause players to leave the arena when clicked.
  • info signs are plain signs with no interaction functionality.

Note that all sign types can show the same information. What a sign does when interacted with is defined by its type. What a sign displays is defined by its template.

Sign Templates

The fourth line on an arena sign is the sign template. Templates define what the arena signs display. Sign templates are defined in signs.yml in this format:

some-template:
- 'First line'
- 'Second line'
- 'Third line'
- 'Fourth line'

The template name (some-template in this case) is what is used on the fourth line when placing an arena sign.

Note that while the predefined templates in signs.yml can be changed, it is recommended to just leave them as they are and define new ones if that fit your needs.

Sign templates can resolve a variety of different variables, and they can display different information in different states. The following sections explain these two concepts and how to apply them.

Example

A plain template called click-me with just a fixed text, useful for join signs (see Sign Types):

click-me:
- ''
- 'Click me to'
- 'join the arena!'

Note how there is an empty line (two single quotes ') to align the sign contents vertically. To use the template for a join sign for an arena called jungle:

This sign will always show the same two lines on the sign in-game:

To spice things up, look into variables and states.

Template Variables

Sign templates support two types of variables:

  • Normal variables, which are simple keys that will map to simple values.
  • Indexed variables, which are used to resolve list entries.

Normal variables will cover most use cases, but indexed variables offer some additional insight and can bring a different kind of life to the arena signs.

Note that some variables only work or make sense in one or two states, and that they might resolve to nonsense values for states they don't support. It should be obvious which states each variable is valid for, but if not, just try them out and see how they work.

Normal Variables

Standard, run-of-the-mill variables that resolve things like player counts and arena names. Sign templates can resolve the following normal variables:

  • <arena-name> - name of the arena
  • <min-players> - min number of players
  • <max-players> - max number of players
  • <initial-players> - number of players when the session started
  • <live-players> - number of currently live players
  • <dead-players> - number of players who died
  • <current-wave> - current wave number
  • <final-wave> - final wave number
  • <lobby-players> - number of players in the lobby
  • <ready-players> - number of players flagged as ready in the lobby

Indexed Variables

Dynamic variables that reference a specific index in a given list. The variable names all end with -n, where n must be replaced with a positive number denoting a position in the list.

Sign templates can resolve the following indexed variables:

  • <arena-n> - the n'th live arena player
  • <lobby-n> - the n'th player in the lobby
  • <ready-n> - the n'th player flagged as ready in the lobby
  • <notready-n> - the n'th player not flagged as ready in the lobby

That is, if an arena is currently in its lobby phase, <ready-3> will show the name of the third player in the list of players that have been flagged as ready (sorted by name) if at least three players are flagged as ready, otherwise it will be empty. This can be used to show lists of players similar to the player list columns on Leaderboards.

Example

A template called progress that uses two variables to show the wave progression for an arena that has a final wave configured:

progress:
- 'Progress'
- 'Wave: <current-wave>/<final-wave>'

To use the template for an info sign for an arena called jungle:

During an arena session, the sign might look something like this:

Template States

It is possible to show different information on the signs depending on the state of an arena. This can be useful for showing session-specific details while the arena is running, but something else entirely when the arena isn't running.

All templates exist in four different states:

  • idle is when the arena is not running and no players are in the lobby.
  • joining is when the arena is not running, but there is at least one player in the lobby.
  • ready is when all players in the lobby of an arena are flagged as ready.
  • running is when an arena session is currently in progress.

To make a template show different information based on the state, create a new template with the same name as the base template, and append the state suffix, e.g. -idle.

Example

A template called survivors that uses variables to show the number of live players, unless the arena is idle, in which case it just shows a dash (-):

survivors:
- 'Survivors'
- '<live-players>/<initial-players>'
survivors-idle:
- 'Survivors'
- '-'

To use the template for an info sign for an arena called jungle:

During an arena session, the sign might look like this:

When the arena isn't running and no players are in the lobby, it will look like this: