Skip to content
swkeep edited this page Jun 17, 2022 · 3 revisions

Welcome to the keep-crafting wiki!

a brief tutorial on how to use the script:

How to add a new workbench

  • all workbenches are listed below Config.workbenches
  • to add a new workbench you need to enter the information below.
{
          table_model = 'gr_prop_gr_bench_03a', -- if not specified workbench_default_model is used 
          coords = vector3(-1838.76, 2909.63, 38.90), -- workbench spawn coord
          rotation = vector3(0.0, 0.0, 150.0), -- workbench rotation,
          item_show_case_offset = vector3(0.0, 0.0, 2.25), -- item show case offset to workbench (sometimes models have different offsets)
          job = {
               allowed_list = {}, 
               allowed_grades = {}
          },
          categories = {}, -- categories used in workbench
          recipes = {}, -- recipes used in workbench
          radius = 3.0 -- interaction radius
     }

How to add job restrication

job = {
       allowed_list = {}, 
       allowed_grades = {}
},
  • if you want to restrict by the job:
job = {
       allowed_list = { 'police' }, 
       allowed_grades = {}
},
  • if you want to restrict it by job and their grades
job = {
       allowed_list = { 'police' }, 
       allowed_grades = { ['police'] = {2,3,4} }
},

How to add a new category

  • all categories are listed below Config.categories
     ['weapons'] = {
          key = 'weapons', -- must be same as table name 
          label = 'Weapons', -- category label
          icon = 'fa-solid fa-gun', -- category icon
          jobs = {}, -- reserved for future 
     },
  • How to add sub categories
['weapons'] = {
          key = 'weapons', -- must be same as table name 
          label = 'Weapons', -- category label
          icon = 'fa-solid fa-gun', -- category icon
          jobs = {}, -- reserved for future 
          sub_categories = {
               ['pistol'] = {
                    label = 'Pistol',
               },
               ['smg'] = {
                    label = 'SMG',
               },
          }
},         
  • How to add categories to workbenches -- add them in workbenches categories
categories = { Config.categories.weapons, ... }

How to make a new recipe

  • first, choose the recipe's name and then create an empty table
local weapons_recipe = { }
  • second, add items to recipe
local weapons_recipe = {
     ['w_ar_carbinerifle'] = {
          categories = {
               sub = 'smg',
          },
          item_settings = {
               label = 'Rifle',
               image = 'weapon_advancedrifle', -- use inventory's images
               object = {
                    name = 'w_ar_carbinerifle',
                    rotation = vector3(45.0, 0.0, 0.0)
               },
               level = 0,
               job = {
                    allowed_list = {},
                    allowed_grades = {}
               }
          },
          crafting = {
               success_rate = 100,
               amount = 1, -- crafted amount
               duration = 60,
               materials = {
                    ["metalscrap"] = 50,
                    ["steel"] = 60,
                    ["rubber"] = 30,
               },
               exp_per_craft = 5
          }
     },
}

-- the last step, add the recipe to a workbench

recipes = { weapons_recipe },

Item's crafting information

  • to choose a category for items you should specify just one category for that item
  • for example, if you have a 'weapons' category and want to put w_ar_carbinerifle under a sub-category 'rifles' you must specify sub-category as 'rifles' and then remove main category from the categories.
categories = {
             -- main = 'weapons',
             sub = 'rifles',
},
  • to use main category to show items, first make sure that category has no sub-categories then you can add it as bewlow.
categories = {
             main = 'weapons',
             -- sub = 'rifles',
},
['w_ar_carbinerifle'] = {
          categories = {
               main = 'weapons',
               sub = 'rifles',
          },
          item_settings = {
               label = 'Rifle', -- items' label
               image = 'weapon_advancedrifle', -- it's on hover image and located in qb-inventory's images (html/images)
               object = { -- optional (to show prop when crafting an item)
                    name = 'w_ar_carbinerifle',
                    rotation = vector3(45.0, 0.0, 0.0)
               },
               level = 0, -- min required craftingrep to craft an item
               job = {
                    -- same as workbench restriction
                    allowed_list = {},
                    allowed_grades = {}
               }
          },
          crafting = {
               success_rate = 100, -- success_rate 
               amount = 1, -- crafted amount
               duration = 60, -- crafting duration
               materials = { -- crafting materials 
                    ["metalscrap"] = 50,
                    ["steel"] = 60,
                    ["rubber"] = 30,
               },
               exp_per_craft = 5
          }
     },