GR1M Docs

Craft

Modular 3D crafting framework for FiveM (Qbox). Two built-in table types — general crafting (GENERAL_3D_TABLE) and weapon/blueprint crafting (WEAPON_3D_TABLE) — plus a registry for adding more, a scene camera with world props and particle effects, a rotatable 3D weapon attachment lab, blueprint rarity progression, NPC barter shops, player-placed stations, a staff audit log, and a full in-game admin panel with templates and item autocomplete.

v1.1.0Needs oxmysql, ox_lib, qbx_core, ox_inventory

#Install

  1. Folder must be named GR1M_Craft (events and NUI callbacks bind to the resource name).
  2. Qbox only. Hard dependencies: oxmysql, ox_lib, qbx_core, ox_inventory. ox_target is used when started (marker + E fallback otherwise) and GR1M_Skills provides skill gates and craft XP. The old qb-core / ESX / standalone bridges were removed.
  3. All tables auto-create on first boot (sql/gr1m_craft.sql documents them). See Data storage.
  4. Merge the item definitions from items/ox_items.lua into ox_inventory/data/items.lua. Weapons and ammo-9 already exist in ox defaults.
  5. Start order is in ENSURE.cfg (after GR1M_Skills, before GR1M_Parts), plus the ACE:
add_ace group.admin gr1mcraft.admin allow

#Configuration

Config is split by topic under config/ (load order is in fxmanifest.lua):

FileHolds
config/core.luaDebug, admin ACE/commands, limits, craft XP, blueprint loot, audit console, item image aliases
config/types_anims.luaCrafting table types, animations, recipe animation overrides
config/props.luaTable display props (item → prop model rules)
config/admin_catalogs.luaAdmin pickers (props, peds, effects), table templates
config/curated.luaCategory labels, placeable stations, curated recipes, station assignment, curated stations
config/seeds.luaSeed recipes/blueprints for an empty database (shops/tables seeds are empty on purpose)
config/skill_gates.luaSkill gate rules applied to recipes/blueprints at boot
config/markomods_attachments.luaMarkoMods weapon/attachment blueprints and lab components

#Commands

CommandWhoPurpose
/gcadminACE gr1mcraft.adminOpen the admin panel (tables/templates/recipes/blueprints/shops/players CRUD)
/gcexportACE gr1mcraft.adminCopy-paste list of every live recipe (for guides)
/gcgive <item> <n>ACE gr1mcraft.adminGive yourself a test item (audited)

#Admin panel

#Crafting UI

#NPC sell / barter shops

Admin-placed peds that buy items for money and/or trade item-for-item:

#Blueprint unlocks

Weapon and attachment crafts are blueprints, gated per player. Rarity is common / uncommon / rare / legendary. Seeded rows follow category crates (melee common, pistols uncommon, shotguns rare, SMG/AR/sniper legendary; attachments by slot: grips/mags uncommon, stocks/scopes rare, suppressors/zoom scopes legendary). /gcadmin blueprint saves are adminLocked and keep their rarity across restarts. Weapon benches auto-show every unlocked blueprint — you do not assign them per table.

  1. Rarity crate — using bp_common, bp_uncommon, bp_rare, or bp_legendary rolls a random loot-eligible blueprint of that rarity (weapons and attachments) and unlocks that craft. It does not give the physical gun. If the player already knows every schematic in that pool, the crate is not consumed. A toast (lib.notify) shows the unlocked name and rarity. ox: server.export = 'GR1M_Craft.bp_item'.
  2. Craft count — unlockCondition = { type = 'craftCount', recipe = 'gun_parts', count = 5 } unlocks after crafting that recipe enough times (optional; exclude from crates with Loot Crate Eligible off).
  3. Admin — grant/revoke a specific blueprint from the admin panel's Players tab.

MarkoMods weapons and their generated attachments are inserted as blueprints on boot if missing. Seed rarity is overlaid whenever it differs from the live row (including downgrades) so crate pools follow the category remap above. Weapon crafts need at least 5 different input items; attachments need at least 3 — boot pads older DB rows that fall short.

#Specializations: at most 2 of 6 (skill-node recipe gating)

Most skillRequirements in config/skill_gates.lua only check the player's overall crafting category level, which every character reaches just by playing — it doesn't require spending points on any particular GR1M_Skills tree node. Six tier-3 nodes on the crafting tree — Artisan, Prospector, Field Mechanic, Medic, Chemist, Gunsmith — gate an entire recipe family each and are wired into a mutual-exclusion clique so a character can hold at most 2 of the 6 at once, never all six. That's the point: nobody can craft everything alone, so you go find another crafter for the categories you didn't pick.

Mechanically this is a 2-slot system. Each specialization has a slot-A node (crf_<key>_track) and an identical slot-B twin (crf_<key>_track_ii) — see GR1M_Skills/config/trees/crafting.lua. All 6 slot-A nodes block each other, all 6 slot-B nodes block each other, and each specialization's A/B twin blocks itself both ways (so you can't spend both slots on the same one). Recipe gates don't care which slot a specialization landed in — the generic SPEC(key, level) helper in config/skill_gates.lua builds an { all = { crafting level, { any = { slot-A rank 1, slot-B rank 1 } } } } requirement, and the any clause is resolved by GRSkills.NormalizeRequirements/meetsClause in server/skills_bridge.lua.

Artisan and Prospector still can't reach each other's half of the jewelry/armor chain alone — an Artisan can't smelt their own gold/silver/titanium, and a Prospector can't turn refined stock into a finished ring, necklace, or armor plate. Getting a third, fourth, fifth, or sixth specialization onto one character requires a real respec (Config.Respec) that frees a slot, or trading with a player who picked what you didn't. Every other tree node effectively only delays access (enough level + points eventually unlocks it); this 6-way/2-slot fork is the one place a skill-point choice has a permanent, felt trade-off. Follow the SPEC_NODES table and SPEC(key, level) pattern in config/skill_gates.lua to add a 7th specialization.

#Zombie border economy (GR1M_Zombies integration)

A small curated recipe set (Config.CuratedRecipes) plus a matching item pair wire GR1M_Craft's crafting into GR1M_Zombies' infection system, using raw materials scavenged from zombies north of the border:

#Attachment lab

Open from any WEAPON_3D_TABLE. The selected weapon spawns as a 3D object in front of the scene camera — drag to rotate, scroll to zoom, hover an owned attachment to preview it live. Install/remove writes metadata.components on the weapon item via ox_inventory SetMetadata, so attachments persist and re-apply on equip. The bench's job/skill lock applies to the lab too.

The right panel has three stacked sections: INSTALLED (components on the selected weapon, with REMOVE), OWNED ATTACHMENTS (inventory attachments that fit the selected weapon, with INSTALL), and CRAFTABLE (unowned attachments that fit the selected weapon — info-only with recipe hint). Switching weapons re-filters both lists; incompatible items are hidden, not greyed.

#MarkoMods weapon attachments

config/markomods_attachments.lua (loaded after the config/*.lua files in fxmanifest.lua) is the source of truth for every MarkoMods addon-weapon attachment component GR1MCraft knows about — verified directly against each installed pack's weapons.meta/weaponcomponents.meta under [weapons]/MarkoMods-*/meta/. Structure:

#Adding a new table type

-- config/types_anims.lua > Config.CraftingTypes
{
    id = 'CHEM_LAB_TABLE',
    label = 'Chemistry Lab',
    allowed_recipe_kinds = { 'drug', 'consumable' },
    defaultAnimationTag = 'mixing',
    interactionRadius = 2.5,
    allowBlueprints = false,
    allowAttachmentLab = false,
    camera = { lookAtHeight = 0.98, fov = 60.0, distance = 1.45, height = 1.28, sideBias = 0.0 },
    effects = { crafting = { asset = 'core', name = 'ent_amb_dry_ice_area', offset = { x = 0, y = 0, z = 1.0 }, scale = 1.0 } },
},

Then create tables of that type from /gcadmin. Other resources can also call the exports: CreateTable, UpdateTable, DeleteTable, GetTable, GetTables, RegisterRecipe (memory-only), UpsertRecipe (persist to MySQL — used by GR1M_Parts), DeleteRecipe (persist delete — used by GR1M_Parts retirement), RegisterBlueprint, RegisterCraftingType. The Mechanic Parts Bench template assigns every mechanic_parts recipe.

#Data storage

Everything lives in MySQL through oxmysql; the tables auto-create on boot (server/db.lua, server/blueprints.lua, server/audit.lua). Registry rows are one JSON blob under data plus a few indexed columns.

TableContentsIndexed by
gr1m_craft_tablesWorld benches (admin panel and placed stations)type
gr1m_craft_recipesRecipes (seeds, curated, admin, GR1M_Parts)category, kind
gr1m_craft_blueprint_defsBlueprintsrarity
gr1m_craft_shopsBarter shops—
gr1m_craft_categoriesRecipe category names—
gr1m_craft_blueprintsPer-character blueprint unlocks(citizenid, blueprint_id)
gr1m_craft_statsPer-character total craftscitizenid
gr1m_craft_recipe_statsPer-character craft count per recipe (bumped in place; old per_recipe JSON is moved here on first load)(citizenid, recipe_id)
gr1m_craft_auditStaff audit log: weapon/attachment crafts, barter trades, admin edits, grants/revokes, /gcgive, placed/packed stationscitizenid, (action, created_at)

data/backup/*.json are only read as a migration source when the matching table is empty. Set the convar gr1m_craft_audit_webhook to also post audit lines to Discord, or Config.AuditConsole = true to print them.

One-time data fixes (GRCore.RunOnce in server/boot.lua) record a marker in the server's resource KVP store (gr1m_craft:migration:<name>), so each runs once per server. Parked refunds use gr1m_craft:refund:<citizenid>; materials held for queued crafts use gr1m_craft:escrow:<citizenid>.