Koja Scripts
NEW

Crafting Stations Settings

This comprehensive guide covers how to configure crafting stations, add items, create categories, configure blueprints, and customize your crafting system.

Crafting Stations Settings

πŸ—οΈ Station Configuration

Basic Structure

Crafting stations are configured in shared/config.lua under Config.Craftings:

Config.Craftings = {
    {
        id = 'unique_station_id',
        coords = vector4(x, y, z, heading),
        blip = { ... },
        title = 'STATION TITLE',
        desc = 'Station description',
        prop = 'prop_name',
        categories = { ... },
        items = { ... },
        blueprints = { ... }
    },
    -- Add more stations...
}

Station Properties

PropertyTypeRequiredDescription
idStringβœ… YesUnique identifier for the station
coordsVector4βœ… YesLocation (x, y, z, heading)
blipTableβœ… YesMap blip configuration
titleStringβœ… YesDisplay title in UI (uppercase recommended)
descStringβœ… YesShort description shown in UI
propStringβœ… YesObject model to spawn at location
categoriesTableβœ… YesList of item categories
itemsTableβœ… YesCraftable items list
blueprintsTableβ­• OptionalSpecial blueprint-locked items

πŸ†• Adding New Stations

  1. Find Coordinates

    Get your position in-game via /tx command or your other script that supports it.
  2. Add Station Configuration

    Config.Craftings = {
        -- Existing stations...
        
        -- Your new station
        {
            id = 'my_custom_station',
            coords = vector4(123.45, -678.90, 28.50, 180.0),
            blip = {
                name = 'My Crafting Station',
                sprite = 478,
                colour = 2,
                scale = 0.7,
                visible = true,
            },
            title = 'CUSTOM CRAFTING',
            desc = 'Craft custom items here',
            prop = 'prop_tool_bench02',
            categories = {
                {
                    id = 'custom_category',
                    label = 'Custom Items'
                }
            },
            items = {
                {
                    respname = 'custom_item',
                    name = 'Custom Item',
                    category = 'custom_category',
                    image = './images/custom.webp',
                    craftingTime = 30,
                    requiredLevel = 1,
                    resources = {
                        { name = 'iron', amount = 5 }
                    },
                    exp = 25
                }
            },
            blueprints = {}
        }
    }
  3. Test and Adjust

    • Restart resource: restart koja-crafting
    • Go to coordinates in-game
    • Verify prop spawns correctly
    • Test crafting interaction
    • Adjust position/heading if needed

πŸ“‘ Categories

Purpose

Categories organize items in the crafting menu for better navigation.

Structure

categories = {
    {
        id = 'category_unique_id',
        label = 'Display Label'
    },
    -- More categories...
}

Example - Multiple Categories

categories = {
    {
        id = 'medical',
        label = 'Medical Items'
    },
    {
        id = 'tools',
        label = 'Tools & Equipment'
    },
    {
        id = 'weapons',
        label = 'Weapons'
    },
    {
        id = 'food',
        label = 'Food & Drink'
    },
    {
        id = 'materials',
        label = 'Raw Materials'
    }
}

🎨 Items Configuration

Basic Item Structure

items = {
    {
        respname = 'item_id',           -- Item name in inventory
        name = 'Display Name',          -- Name shown in UI
        category = 'category_id',       -- Category it belongs to
        image = './images/item.webp',   -- Image path
        craftingTime = 30,              -- Seconds to craft
        craftingAmount = 1,             -- Amount crafted per operation
        requiredLevel = 1,              -- Minimum level needed
        resources = { ... },            -- Required materials
        exp = 25                        -- XP gained on completion
    }
}

Item Properties Explained

respname (Required)

respname = 'bandage'
  • Must match your inventory item name exactly (case-sensitive)
  • Used to give item to player on completion
  • Examples: 'bandage', 'weapon_pistol', 'lockpick'

name (Required)

name = 'Bandage'
  • Display name shown in crafting UI
  • Can include spaces and special characters
  • Doesn't need to match inventory name

category (Required)

category = 'medical'
  • Must match a category.id from categories table
  • Determines which tab item appears in
  • Case-sensitive

image (Required)

-- Option 1: Local image (starts with ./)
image = './images/bandage.webp'

-- Option 2: Inventory image (no ./)
image = 'bandage.png'

-- Option 3: Full path
image = 'nui://ox_inventory/web/images/bandage.png'

See Images Settings for detailed image configuration.


craftingTime (Required)

craftingTime = 30
  • Time in seconds to craft one batch
  • Minimum: 1 second
  • Recommendations:
    • Simple items: 5-20s
    • Common items: 20-60s
    • Rare items: 60-180s
    • Epic items: 180-600s

craftingAmount (Optional)

craftingAmount = 3
  • How many items are crafted per operation
  • Default: 1 if not specified

requiredLevel (Required)

requiredLevel = 1
  • Minimum crafting level to unlock this item
  • Range: 1 to max level in Config.Levels
  • Shows as "Locked" in UI with level requirement

resources (Required)

resources = {
    { name = 'wood', label = 'Wood', amount = 5 },
    { name = 'iron', label = 'Iron Brick', image = './images/iron.webp', amount = 3 },
    { name = 'cloth', amount = 2 }
}

Resource properties:

  • name (required): Inventory item name (must exist)
  • label (optional): Label for the item in the UI
  • amount (required): Quantity required
  • image (optional): Custom image for this resource

exp (Required)

exp = 25
  • Experience points gained on successful craft
  • Typically scales with crafting difficulty/time
  • Example balancing:
    • Simple 10s craft: exp = 10
    • Medium 30s craft: exp = 30
    • Complex 60s craft: exp = 60
    • Or use formula: exp = craftingTime / 2

See Player Progression for XP balancing.


Complete Item Example

{
    respname = 'medikit',
    name = 'Medical Kit',
    category = 'medical',
    image = './images/medikit.webp',
    craftingTime = 45,
    craftingAmount = 1,
    requiredLevel = 3,
    resources = {
        { name = 'bandage', image = './images/bandage.webp', amount = 3 },
        { name = 'pills', amount = 2 },
        { name = 'syringe', amount = 1 }
    },
    exp = 50
}

πŸ” Blueprints System

What Are Blueprints?

Blueprints are special items that require:

  • Finding/earning a blueprint item
  • Admin giving blueprint with /addblueprint command
  • Purchasing/unlocking through gameplay

Once unlocked, the item becomes available to craft (if level requirement met).


Blueprint Structure

blueprints = {
    {
        respname = 'item_id',
        name = 'Display Name',
        category = 'category_id',
        image = './images/item.webp',
        blueprintItem = 'blueprint_item_name',  -- πŸ”‘ KEY DIFFERENCE
        craftingTime = 60,
        requiredLevel = 3,
        resources = { ... },
        exp = 100
    }
}

Key property:

blueprintItem = 'parachute_blueprint'
  • This is the "key" item that unlocks crafting
  • Must be given via /addblueprint command
  • Stored in player's database record
  • Can be rare drop, quest reward, or admin gift

Blueprint vs Regular Item

FeatureRegular ItemBlueprint Item
Visible by defaultβœ… Yes (if level met)❌ No
Unlock methodReach levelAdmin command or drop
Config locationitems = { ... }blueprints = { ... }
Special propertyNoneblueprintItem required

Blueprint Example

blueprints = {
    {
        respname = 'parachute',
        name = 'Parachute',
        category = 'advanced',
        image = './images/parachute.webp',
        blueprintItem = 'parachute_blueprint',  -- Required blueprint
        craftingTime = 120,
        requiredLevel = 4,
        resources = {
            { name = 'cloth', amount = 10 },
            { name = 'rope', amount = 5 },
            { name = 'metal_frame', amount = 2 }
        },
        exp = 150
    },
    {
        respname = 'night_vision',
        name = 'Night Vision Goggles',
        category = 'advanced',
        image = './images/nvg.webp',
        blueprintItem = 'nvg_blueprint',
        craftingTime = 180,
        requiredLevel = 5,
        resources = {
            { name = 'electronics', amount = 15 },
            { name = 'glass', amount = 5 },
            { name = 'battery', amount = 3 }
        },
        exp = 200
    }
}

Giving Blueprints

Admin command:

/addblueprint [playerID] [blueprintItem]

# Examples:
/addblueprint 1 parachute_blueprint
/addblueprint 5 nvg_blueprint

What happens:

  1. Blueprint added to player's database record
  2. Item appears in crafting menu (if level met)
  3. Player can now craft the item
  4. Blueprint persists through restarts/disconnects

See Admin Permissions for command details.


πŸ—ΊοΈ Blip Configuration

Blip Structure

blip = {
    name = 'Weapon Crafting',
    sprite = 89,
    colour = 1,
    scale = 0.7,
    visible = true,
}

Blip Properties

PropertyTypeDescriptionExample
nameStringText shown when hovering blip'Weapon Crafting'
spriteNumberIcon sprite ID89, 478, 402
colourNumberColor ID (0-85)1 (red), 2 (green)
scaleNumberSize (0.5-1.5)0.7, 0.8, 1.0
visibleBooleanShow on maptrue, false

Common Blip Sprites

SpriteIconUse Case
89πŸ”« PistolWeapon crafting
478πŸ”¨ HammerTool/general crafting
402πŸ’Š PillsMedical crafting
409πŸ” FoodFood/cooking
499πŸ› οΈ RepairRepair station
566πŸ“¦ CrateMaterials
521βš™οΈ GearMechanical

Find more: https://docs.fivem.net/docs/game-references/blips/


Blip Colors

IDColorHexUse Case
0White#FFFFFFGeneral
1Red#E03232Weapons/Danger
2Green#32E032Medical/Safe
3Blue#3232E0Police/Official
5Yellow#FFD700Gold/Premium
25Purple#B432E0Special/Rare
27Orange#FF8C00Warning/Tools

Blip Examples

Weapon Crafting (Red pistol):

blip = {
    name = 'Weapon Crafting',
    sprite = 89,
    colour = 1,  -- Red
    scale = 0.8,
    visible = true
}

Medical Crafting (Green pills):

blip = {
    name = 'Medical Station',
    sprite = 402,
    colour = 2,  -- Green
    scale = 0.7,
    visible = true
}

πŸ› οΈ Props/Objects

Common Crafting Props

Prop NameDescriptionBest For
prop_tool_bench02WorkbenchGeneral crafting
prop_tool_bench01Small benchTool crafting
gr_prop_gr_bench_02aGarage benchVehicle work
prop_toolchest_01Tool chestSmall items
prop_ld_bench01Long benchLarge projects
bkr_prop_meth_table01aLab tableMedical/chemical
bkr_prop_weed_table_01bProcessing tableMaterials

πŸ› Troubleshooting

Station Not Spawning

Problem: No prop appears at coordinates

Solutions:

  1. Verify coordinates are correct (/getcoords)
  2. Check prop model name is valid
  3. Ensure resource is running
  4. Try different prop model
  5. Check console for errors
Items Not Showing

Problem: No items in crafting menu

Solutions:

  1. Check category IDs match between categories and items
  2. Verify items array is not empty
  3. Check for syntax errors (missing commas, brackets)
  4. Ensure requiredLevel is achievable
  5. Check console for Lua errors
Can't Craft Item

Problem: Item visible but can't craft

Solutions:

  1. Check player has required level
  2. Verify player has all resources
  3. Check resource names match inventory items exactly
  4. Ensure resource amounts are not zero
Wrong Item Given

Problem: Crafting completes but wrong item given

Solutions:

  1. Verify respname matches inventory item exactly
  2. Check case sensitivity (bandage β‰  Bandage)
  3. Ensure inventory item exists
  4. Test giving item manually
  5. Check framework's item database
Blueprint Not Appearing

Problem: Blueprint given but item not showing

Solutions:

  1. Check player meets requiredLevel
  2. Verify blueprint is in blueprints table, not items
  3. Check blueprintItem name matches command
  4. Query database to verify blueprint saved
  5. Player may need to reopen menu

  • General Settings β€” This page covers the basic configuration options for Koja-Crafting that control debug mode, language, and player behavior.
  • Server Settings β€” This page covers server-side configuration options including database management, crafting recovery, and shared table functionality.
  • Images Settings β€” This page explains how to configure item images, add custom graphics, and manage image paths in Koja-Crafting.
  • Player Progression Settings β€” This page covers the player progression system including levels, experience points, and how to configure the leveling system in Koja-Crafting.
  • Admin Settings β€” This page covers admin permission configuration and available admin commands for managing Koja-Crafting.
  • Interaction Settings β€” This page covers how players interact with crafting stations - either through key press or target system (ox_target,qb-target,).
  • Configuration β€” back to the section overview