Cooldowns & Limits

Cooldowns & Limits

View as Markdown ·

On this page

circle-info

The limits are saved in the NPC's own file in the npcs folder. The use counts are kept in database.db, so they survive restarts. When the NPCs are stored in MySQL or MariaDB, the counts and the global cooldown are kept in that database instead and shared by every server, see Networks.

Open them from the NPC's Click Actions screen, or change them with /pnpc edit <id> set. They apply to clicks, not to proximity actions.

#Global Cooldown

How many seconds nobody can use the NPC after one player did. It starts on the click, so other players are kept out while a [DELAY] chain runs. 0 turns it off. The per-player click cooldown still applies on top.

#Uses Per Player

How many times each player can use the NPC. 0 means no limit.

#Uses For Everyone

How many times the NPC can be used by all players together, such as a reward only the first 10 players get. 0 means no limit.

#Reset Uses

When the use counts start over: never, every day or every week (ISO weeks, starting Monday), by the server's clock.

#Reset Use Counts Now

Sets every count of the NPC back to zero, after a confirmation. Removing the NPC does the same. /pnpc edit <id> resetuses does it from the console.

#What Counts as a Use

A click counts once all its actions have run. A click stopped by a [PERMISSION], [CONDITION] or cost does not count, so a player who cannot pay keeps their uses. Clicks taken over by another plugin, such as a BetonQuest conversation, do not count either.

#Networks

With the storage type in config.yml set to mysql or mariadb, every server using that database shares one set of counts, in the <table-prefix>_uses table:

  • Uses For Everyone counts the whole network. A limit of 10 allows 10 uses in total, never 10 per server, even when players on two servers click at the same moment.
  • Uses Per Player follow the player from server to server.
  • The global cooldown holds on every server. The servers' clocks should be in sync (NTP), because each server stamps the time it was used.
  • Reset Use Counts Now, removing the NPC and renaming it apply to every server.

The first time a server starts with MySQL storage, it adds the counts from its own database.db to the shared table once, so uses made before the switch still count. Restarting does not add them again. With yaml or sqlite storage, each server keeps its own counts.

If the database cannot be reached, NPCs with use limits or a global cooldown tell players they are still loading until it is back.

#Costs

[ITEM_COST] and [EXP_COST] take items or experience as part of the click actions and stop the rest of the list when the player cannot pay. See Action Types.

#Commands

Command Does
/pnpc edit <id> set global-cooldown <ms> Sets the global cooldown.
/pnpc edit <id> set max-uses-per-player <n> Sets the uses per player.
/pnpc edit <id> set max-uses <n> Sets the uses for everyone.
/pnpc edit <id> set uses-reset <never|daily|weekly> Sets when the counts reset.
/pnpc edit <id> resetuses Resets the counts now.

The messages players get are in the limits and costs sections of the translations.

My Cart
Spider

Your cart is empty

Looks like the spiders padded through here. Pick a plugin and it will show up here. Continue shopping