STG ScriptsDocumentation
Crafting System

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:

FieldMeaning
itemItem name in your inventory.
countHow many are taken.
labelName shown on the crafting screen and in the "You need 3x Iron" message.
imagePicture 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.

KeyResultTimeLevelIngredients
m4a9_nikeweapon_carbinerifle900 s06 iron, 8 metalscrap, 4 plastic, 1 electronickit
pistol_mk2weapon_pistol_mk2300 s13 iron, 4 metalscrap, 2 plastic
ap_pistolweapon_appistol360 s23 iron, 5 metalscrap, 2 plastic
sawnoff_shotgunweapon_sawnoffshotgun360 s23 iron, 4 metalscrap, 1 rubber
ak47_customweapon_assaultrifle480 s35 iron, 7 metalscrap, 2 rubber, 1 electronickit
heavy_pistolweapon_heavypistol360 s34 iron, 5 metalscrap, 2 plastic
micro_smgweapon_microsmg420 s43 iron, 5 metalscrap, 3 plastic
pump_shotgunweapon_pumpshotgun540 s44 iron, 6 metalscrap, 2 rubber
combat_pdwweapon_combatpdw420 s54 iron, 5 metalscrap, 3 plastic, 1 electronickit
smg_mk2weapon_smg_mk2600 s64 iron, 6 metalscrap, 3 plastic, 2 electronickit
marksman_rifleweapon_marksmanrifle720 s76 iron, 8 metalscrap, 3 plastic, 2 electronickit
sniper_rifleweapon_sniperrifle900 s98 iron, 10 metalscrap, 4 plastic, 3 electronickit
lockpicklockpick60 s02 bobby_pin, 1 tension_wrench
advanced_lockpickadvancedlockpick180 s41 tension_wrench, 1 micro_motor, 1 precision_spring
sandwichsandwich30 s02 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.

Get help on Discord

On this page