Skip to content

Item Usage Profiles and Effects

Choose consumption profiles and configure portions, effects and controls.

An item usage profile1 defines finished-product holding, opening, eating/drinking and effects. Edit the matching file inside 0r-restaurant:

What you want to changeFile
Enabled state, portions, use time, hunger/thirst and controlsconfig/item_usage.lua
Models, animations, attachments, glasses, liquids and appearance variantsconfig/item_usage/visuals/<presentation>.lua
Alcohol, ingredient effects, extra numeric effects and provider settingsconfig/item_usage/effects.lua
Preparation timeout and calibration controlsconfig/item_usage/advanced.lua

Production tools, device baskets and installed stations use the assets resource's production config. See Configuration File Map.

Connect the output material#

Open the finished output Material, expand Advanced and select an existing Item usage key. Use item name leaves the choice empty and resolves to the logical Item Name when new stock is produced.

Apply, Save draft and Publish the material change. Newly produced items receive that usage key; existing inventory retains its previously saved key. Unknown or disabled profiles can leave an item storable while denying consumption.

Edit a profile after its definition#

Find the named entry inside Config.itemUsage.items in config/item_usage.lua. Edit that existing table directly. Keep the other item entries. For example, replace the existing Hamburger entry with this illustrative entry:

lua
hamburger_product = {
    enabled = true,
    type = 'food',
    flow = 'portion',
    portions = 4,
    durationMs = 2000,
    canCancel = false,
    effects = { scope = 'portion', hunger = 10 },
    presentation = 'hamburger',
},

This gives four bites, each lasting two seconds and granting 10 hunger. Keep presentation = 'hamburger' to use config/item_usage/visuals/hamburger.lua. That visual file contains the model, pose and ingredient mappings. Changing hunger does not require editing it.

Restart the main resource to load file changes. Do not append old profile overrides or recreate shared defaults. A product records its portion total on its first successful use; partly used products keep their saved total.

Portions and effect scale#

portions is the number of uses in one logical product; durationMs is one use duration in milliseconds. Set effects.scope in the item's entry:

  • 'portion': grant the configured hunger/thirst for every completed bite or sip.
  • 'item': divide the configured hunger/thirst and extra numeric metadata amounts across the item's saved total portions.

For example, hunger = 20 over four portions grants 20 each time with 'portion', or 5 each time with 'item'. Do not divide a whole-item amount again by hand. Timed screen effects and alcohol ingredient doses keep their own per-use rules.

Pizza has separate container/slice views while its inventory quantity remains one box. See Consumption.

Optional disable and cancellation#

Inside the existing item's table, change these fields to disable use while preserving the item:

lua
enabled = false,
disabledMessage = 'usage.unavailable',

Use a real locale key. Set canCancel = true in the same item entry to allow user cancellation. A cancelled use keeps the item and grants no effects. If cancellation or an error leaves the player stuck, check the progress provider and the first F8 error.

Additional numeric effects#

Edit config/item_usage/effects.lua. Extra player metadata needs both allowed bounds and an item effect. For a provider that supports numeric stress, add this field inside Config.itemUsage.effectSettings.providers.metadata, keeping other configured metadata entries:

lua
stress = { minimum = 0, maximum = 100 },

Then add this entry inside Config.itemUsage.effectSettings.profiles, keeping the other profiles, including Cocktail's alcohol contribution rules:

lua
hamburger_product = {
    metadata = { stress = -2 },
},

If hamburger_product already exists there, add metadata inside it instead of creating a duplicate entry. With the Hamburger example's 'portion' scope, this reduces stress by 2 per completed bite. Keep base hunger/thirst in config/item_usage.lua.

Your framework adapter must support reading and changing that numeric field. If it does not, the effect cannot run. Check the change with your framework; custom ESX fields need a matching integration.

Variant details and alcohol#

Keep saved product details intact. The selected visual file uses them to choose the glass, size, ingredients and appearance. It can use defaults for optional missing details, but an invalid saved value can prevent use.

Configure alcohol levels, their decrease over time and their walking/screen effects in config/item_usage/effects.lua. The amount comes from the drink's alcoholic ingredients when consumed.

Test the complete use#

Use a newly produced product or an authorized test item. Check holding, opening, eating or drinking, putting away, remaining portions and final removal. Check hunger, thirst and other effects after consumption. If an effect fails, read the error before trying again.

Use Diagnostics for usage calibration and Inventory Problems for slot/provider errors.

Controls and profile defaults#

Edit controls and individual items in config/item_usage.lua. Each item declares its own values; there is no shared portion-default table to edit.

Exact keyType / unitDelivered valueExample
Config.itemUsage.controls.primaryInteger FiveM control38 (E)Keep 38 for the delivered use prompt
Config.itemUsage.controls.putAwayInteger FiveM control73 (X)Keep 73 for put away
Config.itemUsage.movementBoolean fieldswalking=true, sprint=false, combat=false, vehicle=falseChange only if you intend to change holding restrictions
Config.itemUsage.items.hamburger_product.portionsPositive whole number34
Config.itemUsage.items.hamburger_product.durationMsMilliseconds per bite20002500
Config.itemUsage.items.hamburger_product.effects.hungerNumeric food effect2510
Config.itemUsage.items.coffee_product.effects.thirstNumeric drink effect2510
Config.itemUsage.advanced.prepareTimeoutMsMilliseconds, in config/item_usage/advanced.lua1500020000

Pizza's entry uses flow = 'container', portions = 8, durationMs = 6000, openDurationMs = 1000 and effects.scope = 'item'. Pasta uses durationMs = 1000 and canCancel = true. Read each installed item entry before changing it.

File changes load after main restart. A Material's profile-key selection needs Save draft and Publish and applies to newly issued stock. Changing profile settings does not replace the key saved on an older item. Put away and re-equip a partly used product to check its remaining portions.

Alcohol settings#

In config/item_usage/effects.lua, the fields under Config.itemUsage.effectSettings.alcohol are enabled=true, dosePerUnit=20, maxDosePerDrink=40, maxLevel=100, decayPerMinute=8 and updateMs=10000. Doses/levels use the configured alcohol scale; updateMs is milliseconds. They do not represent real-world blood alcohol units.

To disable this effect, edit enabled to false inside that alcohol table, then restart main. This changes subsequent consumption behavior, not saved ingredient contents. Keep tier thresholds consistent with maxLevel if editing them. Check with a configured alcoholic Cocktail and compare the effect and notifications; ordinary Coffee remains a thirst effect.

Footnotes

  1. Server configuration defining how a finished product is held, opened, eaten or drunk. Read the definition. ↩