Skip to content
jk-5 edited this page Feb 13, 2014 · 1 revision

To make use of the stat system in nailed, you need to specify which stats are present and can be used. Each stat has a type. This type defines the behaviour of it. If you want to be able to modify the value of a stat in your gameloop or ingame with statmodifiers, you need to define the type as modifiable. More information below.

Stat config also relies on the principe of closures. For more information about closures, see mappack.cfg documentation

In the stats.cfg file you define a list of stats you want to have. For example:

gamerunning.type=gameloopRunning
gamedone.type=gameHasWinner

This example creates 2 stats. Their names are gamerunning and gamedone, and their types are specified. This also works with closures.

Some stats may require arguments. You can add those in the closure, or add them to the config

Allowed stat types

  • gameloopRunning - Will be true when the gameloop is running, false otherwise
  • gameloopStopped - Will be true when the gameloop is stopped by either a win or a game cancel
  • gameloopPaused - Will be true when the gameloop is paused, false otherwise (not yet implemented at the time of writing)
  • modifiable - Allows you to modify your stat in your gameloop or with statmodifiers
  • iswinner - Will be true when the team given as argument team is the winner of the game. False otherwise.
  • gameHasWinner - Will be true when the winner of the game is known. False otherwise.

Example stats.cfg

For an example, i will show you the stats.cfg file of the pvp game Nail.

gamerunning
{
    type=gameloopRunning
}

gamedone
{
    type=gameHasWinner
}

teamredwon
{
    type=iswinner
    team=teamred
}

teambluewon
{
    type=iswinner
    team=teamblue
}

startred
{
    type=modifiable
}

startblue
{
    type=modifiable
}

Clone this wiki locally