Recipes
How recipes are written in STG Crafting System shared/recipes.lua, the 15 recipes that ship with the script and how to add your own.
Recipes live in stg-crafting/shared/recipes.lua. The file stays editable in the escrow version. A bench only shows the recipes listed in its recipes field in Config.Benches, so the same recipe can be offered at several benches.
Recipe format
Config.Recipes = {
['pistol_mk2'] = {
label = 'Pistol MK2',
description = 'Upgraded pistol with improved accuracy and damage.',
image = 'weapons/weapon_pistol_mk2.png',
category = 'weapon',
resultType = 'weapon',
craftTime = 300,
minLevel = 1,
ingredients = {
{ item = 'iron', count = 3, label = 'Iron', image = 'materials/iron.png' },
{ item = 'metalscrap', count = 4, label = 'Metal Scrap', image = 'materials/metalscrap.png' },
{ item = 'plastic', count = 2, label = 'Plastic', image = 'materials/plastic.png' },
},
result = { item = 'weapon_pistol_mk2', count = 1, ammo = 0 },
},
}The key (pistol_mk2 above) is the name you put in a bench's recipes list. It must be unique.
Prop
Type
Each ingredient has four fields:
| Field | Meaning |
|---|---|
item | Item name in your inventory. |
count | How many are taken. |
label | Name shown on the crafting screen and in the "You need 3x Iron" message. |
image | Picture on the crafting screen, same rules as the recipe image. |
Every item in ingredients and result must exist in your inventory. The script does not check this on start: a missing ingredient can never be collected, and a missing result item is not given.
Images
The script ships pictures for every GTA weapon in web/assets/img/weapons/, named after the weapon item, for example weapons/weapon_carbinerifle.png. Materials are in web/assets/img/materials/: iron, metalscrap, plastic, rubber, electronickit, gunpowder, magazine_large, polymer_stock, rifle_barrel, rifle_receiver and trigger_assembly. Put your own pictures in the same folder, or use a link to your inventory images.
Shipped recipes
Both shipped benches offer the 12 weapon recipes. The tool and food recipes are ready to use but not on a bench, add their keys to a bench to offer them.
| Key | Result | Time | Level | Ingredients |
|---|---|---|---|---|
m4a9_nike | weapon_carbinerifle | 900 s | 0 | 6 iron, 8 metalscrap, 4 plastic, 1 electronickit |
pistol_mk2 | weapon_pistol_mk2 | 300 s | 1 | 3 iron, 4 metalscrap, 2 plastic |
ap_pistol | weapon_appistol | 360 s | 2 | 3 iron, 5 metalscrap, 2 plastic |
sawnoff_shotgun | weapon_sawnoffshotgun | 360 s | 2 | 3 iron, 4 metalscrap, 1 rubber |
ak47_custom | weapon_assaultrifle | 480 s | 3 | 5 iron, 7 metalscrap, 2 rubber, 1 electronickit |
heavy_pistol | weapon_heavypistol | 360 s | 3 | 4 iron, 5 metalscrap, 2 plastic |
micro_smg | weapon_microsmg | 420 s | 4 | 3 iron, 5 metalscrap, 3 plastic |
pump_shotgun | weapon_pumpshotgun | 540 s | 4 | 4 iron, 6 metalscrap, 2 rubber |
combat_pdw | weapon_combatpdw | 420 s | 5 | 4 iron, 5 metalscrap, 3 plastic, 1 electronickit |
smg_mk2 | weapon_smg_mk2 | 600 s | 6 | 4 iron, 6 metalscrap, 3 plastic, 2 electronickit |
marksman_rifle | weapon_marksmanrifle | 720 s | 7 | 6 iron, 8 metalscrap, 3 plastic, 2 electronickit |
sniper_rifle | weapon_sniperrifle | 900 s | 9 | 8 iron, 10 metalscrap, 4 plastic, 3 electronickit |
lockpick | lockpick | 60 s | 0 | 2 bobby_pin, 1 tension_wrench |
advanced_lockpick | advancedlockpick | 180 s | 4 | 1 tension_wrench, 1 micro_motor, 1 precision_spring |
sandwich | sandwich | 30 s | 0 | 2 bread, 1 cheese, 1 ham |
Adding a recipe
Add a new entry to Config.Recipes in shared/recipes.lua with a unique key. Copying an existing recipe is the quickest start.
Make sure every ingredient and the result exist as items in your inventory.
Add the key to the recipes list of every bench that should offer it, in shared/config.lua or with the bench creator.
Restart the resource.
Still having trouble?
Open a ticket on our Discord. Our team answers around 15 hours a day.