orbit-craftingsystem - Configuration guide for 'QBX' framework.
Resource Configurations
Ox Inventory Configuration
You will need to configure ox_inventory before anything for the resource to work properly.
ox_inventory/data/items.lua
In the specified file path, you will find a file called items.lua, in this file you will find all the predefined items that is in your server. We will need to add the crafting benches specified in the config (benchName) and also 'blueprint' into this file to be able to use them. You can also use the custom blueprints feature to add any kind of item that adds a specific blueprint to the bench which is specified in the config. Add the following code into the file, you can change the label and the weight as you like.
-- Orbit Studios Advanced Crafting System ['bench_name'] = { -- Whatever the bench name is in config. label ='Crafting Bench', -- You may change this. This is the display name. description ='A crafting bench. Might come in handy if you have blueprints.', -- You may change this. stack =false, -- Do not change this. weight =10000, -- You may change this. }, ['blueprint'] = { label ='Blueprint', -- You may change this. This is the display name. description ='A blueprint might come in handy, that\'s if you have a crafting bench.', -- You may change this. stack =false, -- Do not change this. weight =100, -- You may change this. },
ox_inventory/web/images
After you added these items, you may add a image of your choice named 'crafting_bench.png' and 'blueprint.png' for their respective items into the specified file path. This will allow the items to fetch the images from the specified file path into the game inventory.
Orbit Studios Advanced Crafting System
You will need to configure orbit-craftingsystem according to the guide for the resource to work properly.
This configuration file has extensive details within the comments, it is relatively easy to configure this file. Read the comments and put in your configuration according to the comments and the syntax of the config file. This is a dummy config file, you will need to put in the items you actually have in your framework/inventory. You can customize it to your own needs.
Note: Custom Blueprints is for the people that doesn't want to use the built in blueprints feature.
Config = {}
Config.DeveloperMode = true -- true = Enables prints and the CreateBlueprint command, false = Disables some of the prints and disables the CreateBlueprint command.
Config.CustomImageURL = false -- Example: Config.CustomImageURL = "https://cfx-nui-ox_inventory/web/images/", only change if you're using a unique, centralized image repo within your server for all of your images
Config.CraftingWithWheel = true -- The default crafting mechanism that works with a success percentage based wheel. If disabled you can only craft items which is the same level as you or below your level.
-- Config.OnCraft = nil -- Leave Config.OnCraft like this and delete the other one if you do not want to use it!
-- Delete this one and use the one above if you do not plan to use this!
Config.OnCraft = function(source, stationId, itemName, craftedAmount, isWin) -- Function to be triggered on craft (SERVER SIDE)
local desc = ""
if isWin then
desc = "[orbit-craftingsystem] Successful craft by source ID"
else
desc = "[orbit-craftingsystem] Unsuccessful craft by source ID"
end
print(desc, source, "in station", stationId, 'where the user crafted', craftedAmount, itemName)
end
Config.Celebration = { -- Celebration animation for when you successfully craft.
animDict = "anim@mp_player_intcelebrationmale@air_guitar", -- Make it nil to disable
animName = "air_guitar" -- Make it nil to disable
}
Config.BenchAnimations = { -- Bench animations for putting down or moving the bench
putting_down_bench = {
duration = 5000,
animDict = 'amb@world_human_hammering@male@base',
anim = 'base',
flag = 1
},
moving_bench = {
duration = 1000,
animDict = 'amb@world_human_hammering@male@base',
anim = 'base',
flag = 1
},
}
Config.LevelValues = {
xpGainMultiplier = 10, -- The multiplier for xp gain
levelUpXPMultiplier = 100, -- The multiplier for the xp necessary to level up
loseMultiplier = 0.5 -- What to multiply the gained xp with if you make an unsuccessful craft, 0.5 means getting half of the xp if it was unsuccessful
}
Config.MainRoutingBucket = 0 -- Leave as 0 if you don't know what your server's main routing bucket is.
Config.Benches = {
onlyOwnerCanMove = true, -- true = Only the user that placed it can move it, false = Anyone could move the bench
enableBenches = true, -- true = Crafting benches is enabled, false = Crafting Benches is disabled.
enablePersistentBenches = true,
HideBenchDistance = 50,
benchTypes = {
['weapon-crafting_bench'] = { -- The same as the item name of the crafting bench, it cannot start with 'weapon_'. Must have 'bench' in it.
benchProp = 'prop_tool_bench02', -- The prop for the bench
benchLabel = 'Weapon Bench', -- The label of the bench.
title = "Weapon Crafting Bench", -- The title of the bench.
secondaryTitle = "Orbit Studios", -- Secondary title of the bench.
nonBlueprintItems = { -- Items that are always in the bench, no matter the blueprints.
["weapon_knife"] = { -- Item name.
type = 'weapon', -- Only have this if the item is a weapon, otherwise you can remove 'type' completely.
itemLevel = 1, -- Item base level, meaning that you will get base odds at that level, if below you will get worse odds, if above you will get better.
baseOdds = 50, -- The odds to get at the item level.
maxOdds = 90, -- The maximum amount the odds can increase to, ex. 90 is 90% success rate.
amountToCraft = 1, -- This is how many of the item it gives per item crafted. It's not mandatory to have this, only if you want, it will default to 1.
-- Requirements to craft the item. Make sure that the items exist in your framework/inventory in items.lua
requirements = { -- removeOnFail for removing the item when failed, and removeOnSuccess for removing the item on a successful craft.
{ item = "metalscrap", amount = 10, removeOnSuccess = true, removeOnFail = true },
{ item = "steel", amount = 5 },
{ item = "rubber", amount = 2 },
{ item = "iron", amount = 3 },
{ item = "aluminium", amount = 2 }
}
}
}
},
['medical_bench'] = {
benchProp = 'prop_tool_bench02',
benchLabel = 'Medical Bench',
title = "Medical Crafting Bench",
secondaryTitle = "Orbit Studios",
nonBlueprintItems = {
}
}
},
benchPlacement = {
enabled = true, -- true = Whitelist/Blacklist for bench placement is enabled, false = Whitelist/Blacklist for bench placement is disabled.
mode = 'blacklist', -- Could only be 'blacklist' or 'whitelist'
zones = { -- The zones to check, if mode is 'blacklist' then you can't place a bench in those zones, if mode is 'whitelist' you can only place benches in those zones.
{ -- makes a poly zone
vectors = { -- Only a single vector3 for box/sphere zone but an array for poly zones.
vector3(494.22534179688, -1328.0008544922, 29),
vector3(494.7057800293, -1333.9619140625, 29),
vector3(500.11663818359, -1335.0971679688, 29),
vector3(498.75512695312, -1328.3658447266, 29),
vector3(499.08578491211, -1326.0651855469, 29)
},
height = 10, -- Only use thsi fi the zone is a poly zone. It's the height of the zone.
-- radius = 5.0, -- Only use this if the zone is a sphere zone.
-- size = vec3(2, 2, 2), -- Only use this if the zone is a box zone. This defines the shape, and vectors is the coords of the box zone.
},
{ -- This makes a sphere zone.
vectors = {
vector3(493.93173217773, -1335.25, 29),
},
radius = 5.0,
}
}
},
}
Config.Blueprints = { -- All the blueprints needs to be here, even if you want to use a custom blueprint item. A ITEM CAN ONLY BE BOUND TO 1 BENCH, YOU CANNOT HAVE 2 BLUEPRINTS OF THE SAME ITEM.
store = 'player', -- 'bench' = Store the blueprints on the bench, 'player' = Store the blueprints on the player.
items = {
["firstaid"] = { -- Item name
bench = 'medical_bench', -- What bench the blueprint should be binded to.
itemLevel = 2,
baseOdds = 40,
maxOdds = 90,
amountToCraft = 2, -- This is how many of the item it gives per item crafted. It's not mandatory to have this, only if you want, it will default to 1.
-- Requirements to craft the item. Make sure that the items exist in your framework/inventory in items.lua
requirements = { -- removeOnFail for removing the item when failed, and removeOnSuccess for removing the item on a successful craft.
{ item = "bandage", amount = 5 },
{ item = "painkillers", amount = 2 }
}
},
["weapon_pistol"] = {
bench = 'weapon-crafting_bench',
type = 'weapon',
itemLevel = 1,
baseOdds = 60,
maxOdds = 90,
amountToCraft = 1, -- This is how many of the item it gives per item crafted. It's not mandatory to have this, only if you want, it will default to 1.
-- Requirements to craft the item. Make sure that the items exist in your framework/inventory in items.lua
requirements = { -- removeOnFail for removing the item when failed, and removeOnSuccess for removing the item on a successful craft.
{ item = "metalscrap", amount = 10 },
{ item = "steel", amount = 5 },
}
}
}
}
Config.CustomBlueprints = { -- If you don't want to use the built-in blueprint system you can use this.
['weapon_pistol'] = { -- Item name of the blueprint in Config.Blueprints.items
customBlueprintName = 'blueprint_weapon_pistol' -- What item should give the blueprint of that item. In this case blueprint_weapon_pistol gives the blueprint to 'weapon_pistol' in Config.Blueprints.items
}
}
Config.Stations = {
HideStationDistance = 50, -- What the distance should be to hide the station, the station respawns when the distance is less than 50, too big of a distance may result in issues.
["weapon_station"] = { -- Station ID.
title = "Weapon Crafting Station", -- Title of the station.
secondaryTitle = "Orbit Studios", -- Secondary title of the station.
blip = { -- Blip info
haveBlip = true, -- Whether the station should have a blip or not.
sprite = 110, -- Sprite of the blip
color = 1, -- Color of the blip
scale = 0.8, -- Scale of the blip
coords = vector3(502.64, -1338.17, 29.31) -- Coords of the blip, in most cases put in the same coords of the station.
},
target = { -- What the target for the station is.
type = "npc", -- 'npc' = NPC type station, 'prop' = Prop type station.
model = "s_m_m_ammucountry", -- What model the NPC/Prop should be depending on 'type'
coords = vector3(502.64, -1338.17, 29.31), -- Coords of the station.
heading = 37.18 -- Heading of the NPC/Prop depending on 'type'
},
groups = { -- Groups that can access the station. If you put in a group only that group can access it, if it's empty everyone can access it. LEAVE EMPTY FOR PUBLIC USE.
jobs = {
["police"] = 0,
["ambulance"] = 2
},
gangs = { -- Gangs that can access the station. If you put in a gang then only that gang can access it, leave empty like this for public use.
},
},
items = { -- Station items.
["weapon_assaultrifle_mk2"] = {
type = 'weapon',
itemLevel = 3,
baseOdds = 20,
maxOdds = 30,
amountToCraft = 1, -- This is how many of the item it gives per item crafted. It's not mandatory to have this, only if you want, it will default to 1.
-- Requirements to craft the item. Make sure that the items exist in your framework/inventory in items.lua
requirements = { -- removeOnFail for removing the item when failed, and removeOnSuccess for removing the item on a successful craft.
{ item = "metalscrap", amount = 20 },
{ item = "steel", amount = 10 },
{ item = "iron", amount = 10 },
{ item = "plastic", amount = 8 },
{ item = "copper", amount = 5 }
}
},
["weapon_pistol"] = {
type = 'weapon',
itemLevel = 1,
baseOdds = 50,
maxOdds = 90,
-- Requirements to craft the item. Make sure that the items exist in your framework/inventory in items.lua
requirements = { -- removeOnFail for removing the item when failed, and removeOnSuccess for removing the item on a successful craft.
{ item = "plastic", amount = 5, removeOnSuccess = true, removeOnFail = true },
{ item = "iron", amount = 5, removeOnSuccess = true, removeOnFail = false },
}
},
}
},
["medical_station"] = {
title = "Medical Crafting Station",
secondaryTitle = "Orbit Studios",
blip = {
haveBlip = true,
sprite = 153,
color = 2,
scale = 0.8,
coords = vector3(586.34, -1450.3, 20.02)
},
target = {
type = "prop",
model = "prop_table_03",
coords = vector3(586.34, -1450.3, 20.02),
heading = 123.75
},
groups = {
jobs = {
},
gangs = {
},
},
items = {
["firstaid"] = {
itemLevel = 2,
baseOdds = 40,
maxOdds = 90,
-- Requirements to craft the item. Make sure that the items exist in your framework/inventory in items.lua
requirements = { -- removeOnFail for removing the item when failed, and removeOnSuccess for removing the item on a successful craft.
{ item = "bandage", amount = 5, removeOnSuccess = true, removeOnFail = true },
{ item = "painkillers", amount = 2, removeOnSuccess = true, removeOnFail = true },
}
}
}
}
}