Skip to content

Minigame Client

A module to run interactive minigames in your scripts.

JO Functions

jo.minigame.cancel()

Cancels the currently running minigame.

Syntax

lua
jo.minigame.cancel()

Return Value

Type : boolean

Example

lua
CreateThread(function()
  -- Cancel the running minigame after 5 seconds
  Wait(5000)
  local canceled = jo.minigame.cancel()
  print(canceled)
end)

-- Start a minigame that can be canceled from another thread
local result = jo.minigame.lockpick()
print(result)

jo.minigame.lockpick()

Starts the lockpick minigame.

Syntax

lua
jo.minigame.lockpick(config)

Parameters

config : table Optional

The lockpick configuration

config.pins : integer - Number of lockpicks available before failure; default: 1 Optional

config.pinHealth : integer - Health of each lockpick; default: 100 Optional

config.pinDamage : integer - Damage applied when forcing the lock at a wrong angle; default: 20 Optional

config.pinDamageInterval : integer - Minimum delay in milliseconds between two damage ticks; default: 150 Optional

config.solvePadding : number - Angle tolerance in degrees around the correct position; default: 4 Optional

config.maxDistFromSolve : number - Maximum angle distance used to calculate cylinder allowance; default: 45 Optional

config.cylRotSpeed : number - Cylinder rotation speed per tick while pushing; default: 3 Optional

config.onPinBroken : function - Called each time a lockpick pin breaks Optional

config.animPostFx : string|false - AnimPostFX effect to play while the minigame is open; default: "PauseMenuIn"; use false to disable Optional

Return Value

Type : "success"|"failed"|"canceled"|"busy"

Example

lua
-- Start a lockpick minigame with custom difficulty settings
local result = jo.minigame.lockpick({
  pins = 3,
  pinHealth = 100,
  pinDamage = 25,
  solvePadding = 5,
  -- Called each time one lockpick breaks
  onPinBroken = function()
    print("A lockpick broke")
  end
})

-- Handle the final minigame status
if result == "success" then
  print("Lock opened")
elseif result == "failed" then
  print("Lockpick failed")
elseif result == "canceled" then
  print("Lockpick canceled")
end

jo.minigame.qte()

Starts the QTE minigame.

Syntax

lua
jo.minigame.qte(config)

Parameters

config : table Optional

The QTE configuration

config.roundCount : integer - Number of QTE rounds to complete; default: 4 Optional

config.allowedKeys : string[] - Allowed keys; default: A-Z Optional

config.rotationCount : integer - Number of full indicator rotations allowed per round; default: 1 Optional

config.targetStartAngle : table - Target segment start angle range in degrees Optional

config.targetStartAngle.min : number - Minimum target start angle; default: 100 Optional

config.targetStartAngle.max : number - Maximum target start angle; default: 300 Optional

config.targetArcSize : table - Target segment size angle range in degrees Optional

config.targetArcSize.min : number - Minimum target size; default: 50 Optional

config.targetArcSize.max : number - Maximum target size; default: 60 Optional

config.rotationDuration : table - Full rotation duration range in milliseconds Optional

config.rotationDuration.min : integer - Minimum duration; default: 2000 Optional

config.rotationDuration.max : integer - Maximum duration; default: 3000 Optional

config.introDelay : integer - Delay in milliseconds before the indicator starts after the intro animation; default: 200 Optional

config.successDelay : integer - Delay in milliseconds before continuing after a successful round; default: 450 Optional

config.failureDelay : integer - Delay in milliseconds before closing after a failed round; default: 550 Optional

config.roundDelay : integer - Delay in milliseconds between a successful round and the next intro; default: 100 Optional

config.animPostFx : string|false - AnimPostFX effect to play while the minigame is open; default: "PauseMenuIn"; use false to disable Optional

Return Value

Type : "success"|"failed"|"canceled"|"busy"

Example

lua
-- Start a QTE minigame with custom rounds, keys, and timing
local result = jo.minigame.qte({
  roundCount = 5,
  allowedKeys = { "A", "S", "D", "F" },
  rotationDuration = {
    min = 1500,
    max = 2500
  }
})

-- Handle success, failure, cancel, or busy statuses
if result == "success" then
  print("QTE completed")
else
  print("QTE result: " .. result)
end

Last updated: