RedM documentation

Murphy's Doctor

Configuration

Addiction


This page covers shared/config_addiction.lua: dependence on alcohol, tobacco, opiates or any substance you define, and the withdrawal that follows when a dependent player goes without.

How it works

  • Every use of an addictive consumable raises the player's dependence level for that substance by gain (0 to 100). Levels are saved in the murphy_doctor_addictions table, created automatically.
  • The level goes down by decayPerHour for every hour without use, online and offline.
  • At or above dependentAt the player is dependent. If a dependent player goes withdrawalAfterMinutes without the substance, withdrawal starts:
    • the stamina core drains every minute,
    • the camera shakes (shaky hands),
    • a craving reminder is sent every ReminderMinutes.
  • Using the substance again ends the withdrawal at once ("the craving fades").
  • A doctor can treat it: when a signed treatment includes a medication listed in the substance's treatedBy, the level drops by the given amount and the withdrawal clock restarts.
  • In the treatment screen, a patient in withdrawal shows the symptom "Withdrawal (substance)" on the head.

Withdrawal survives reconnects: the state is pushed again when the character loads.

How an item is matched to a substance

For each consumed item, the script first looks for the item name in the items list of every substance, then for the item's category in the categories lists. The first match wins. An item that matches nothing is not addictive.

With the shipped settings, laudanum, cigaretteopium and pipeopium count as opiates (even though cigaretteopium is in the drug category), every alcohol item counts as alcohol and every tobacco item as tobacco.

Settings

Key Default Description
Config.Addiction.Enabled true Master switch. When false, no level is tracked and no withdrawal occurs.
Config.Addiction.CheckIntervalSeconds 60 Seconds between two server checks of every online player (dependence and withdrawal state).

Substances

Config.Addiction.Substances is keyed by substance id. Each entry:

Field Type Description
items list of strings Item names that count as this substance. Checked first.
categories list of strings Consumable categories that count as this substance.
gain number Level gained per use (the level is capped at 100).
dependentAt number Level at or above which the player is dependent.
decayPerHour number Level lost per hour without use, online or offline.
withdrawalAfterMinutes number Minutes without use after which a dependent player enters withdrawal.
treatedBy table { [medicationItem] = levelRemoved }. A signed treatment with that medication lowers the level.

Shipped substances:

Substance Matches gain dependentAt decayPerHour withdrawalAfterMinutes treatedBy
alcohol category alcohol 4 50 1.5 180 laudanum = 35
tobacco category tobacco 3 50 2 120 none
opiates items laudanum, cigaretteopium, pipeopium 12 40 1 90 codeine = 30

At the defaults, a player becomes dependent on alcohol after about 13 drinks in a short time, and on opiates after 4 uses.

Withdrawal

Key Default Description
Config.Addiction.Withdrawal.StaminaCoreDrainPerMinute 8 Stamina core points removed every minute during withdrawal. 0 = no drain.
Config.Addiction.Withdrawal.CameraShake { name = "HAND_SHAKE", amplitude = 0.25 } Camera shake during withdrawal. nil = no shake.
Config.Addiction.Withdrawal.ReminderMinutes 10 Minutes between two craving notifications. 0 = no reminder.

Adding a substance

lua
Config.Addiction.Substances.coffee = {
items = { "coffee", "cafeglace" },
gain = 2,
dependentAt = 60,
decayPerHour = 3,
withdrawalAfterMinutes = 240,
treatedBy = {},
}

Add the substance name to the addiction.substances table of each language file in shared/locales/ so the notifications and the treatment symptom read well:

lua
addiction = {
substances = { alcohol = "alcohol", tobacco = "tobacco", opiates = "opium", coffee = "coffee" },
-- ...
},

Staff can set a level by hand with doc_addiction (see Commands). Other resources can read and change levels with the GetAddictions and ReduceAddiction server exports and the GetAddictionState client export (see Server exports).

Related: Consumables · Alcohol · Treatment · Database · Localization


Last updated: November 20, 2026