Studios
Minigamesmini-2.jpg

XP and Perks

FreeMinigamesStandalone
PAGE 07 OF 08  ·  COMMANDS & EXPORTS → XP AND PERKS → THEME CONFIGURATIONdocs.glitchstudios.dev
Browse docs

XP is optional. Nothing happens until a resource named in config.XP.Resources is running, so a server without an XP resource can leave the settings as they are.

Award modes#

There are three ways to award XP. The safest comes first.

Mode Settings How it works
Server only ClientReported = false Your server script checks the result and calls AwardXP(source, game, true). The amount comes from config.XP.Games.
Server-opened sessions RequireServerSession = true Your server calls OpenXPSession when the player reaches a real hack. The client reports the result, but only a game the server opened can count.
Client reported (default) ClientReported = true When a listed game starts, the client gets a one-time token from the server and sends the result back with it. The server checks the token, the game name, the minimum play time and a 10 minute maximum.

In client-reported mode the result itself comes from the client, so a modified client can claim wins up to the cooldown and hourly cap. That is fine when hacking XP only unlocks hacking perks. If XP buys anything more on your server, use one of the first two modes. The server prints a reminder at start while this mode is on.

The cooldown and hourly cap apply to every mode together. They are counted per character, so relogging resets neither, and they are only used up when the XP resource accepted the award. The hourly cap is a rolling 60 minutes.

Perks#

Perk values are read from the XP resource when a game starts. A game that starts within half a second of the last lookup reuses that player's last perks.

config.XP.Perks key Default effect key Effect
Time hacking_time Seconds added to the game's timer
Mistakes hacking_mistakes Extra allowed mistakes, attempts or lives
Retry hacking_retry Automatic retries after a lost game, unless the player quit or died
Keylogger hacking_keylogger A game won in the last 10 minutes runs with 1.5x its time
Skip hacking_skip Zero day: once a day the player can skip a hack. It is offered for ZeroDaySeconds before the game starts. Declining hides it for 10 minutes. A skip gives no XP.

Zero day is never offered for games started by a resource in ZeroDayNever, or for a call that passes { noSkip = true }. The shipped list names the Glitch Studios heists. Replace it with your own heist resources or set it to {}.

Using another XP resource#

Any resource with these server exports works. Add its name to config.XP.Resources:

Export Returns
AddPlayerXP(src, category, amount) The XP added. 0 or false counts as not given; returning nothing counts as given.
GetEffect(src, key) A number
CanUseDaily(src, key) true or false
UseDaily(src, key) true or false