βž•Adding New Drugs

How to add a new drug type to the system.

  • Open server/config.lua

  • Add a new drug in the DrugDefinitions list

  • An example is provided for you:

{ -- EXAMPLE
    id = 'drug_id', -- unique identifier for the drug
    name = 'Drug Name', -- name of the drug
    description = 'Description of the drug', -- description of the drug
    icon = 'fa-icon-name', -- FontAwesome icon (without the "fas" prefix)
    color = 'blue', -- Valid colors: 'blue', 'pink', 'orange', 'green'
    ingredients = { -- list of ingredients required to make the drug
        -- Must have a minimum of 1 ingredient, no maximum amount
        -- id: item name of the ingredient (string)
        -- name: display name of the ingredient for UI (string)
        -- amount: amount of the ingredient required (number)
        { id = 'ingredient_id1', name = 'Ingredient Name 1', amount = 1},
        { id = 'ingredient_id2', name = 'Ingredient Name 2', amount = 2},
        { id = 'ingredient_id3', name = 'Ingredient Name 3', amount = 3}
        { id = 'ingredient_id4', name = 'Ingredient Name 4', amount = 4}
        { id = 'ingredient_id5', name = 'Ingredient Name 5', amount = 5}
    },
    -- optional: define a custom ideal formula (must match number of ingredients)
    -- if not provided, the server will generate this randomly on startup
    idealMix = {40, 30, 30, 20, 10},
    effects = 'Effects description for UI display' -- effects of the drug (string, for UI)
},
  • So, based on this example we could add a new Drug called "Molly":

  • We can specify an idealMix here, defining the formula for a player to use of the ingredients. In this example, a formula of 70 Safrole Oil, 50 Methylamine and 20 Hydrogen Peroxide would make a package with the perfect purity. These do not need to add up to 100.

  • If you don't define an idealMix, the server will generate it automatically every restart. I would recommend allowing this to happen, as it makes sure your players need to experiment everyday to find the perfect formula.

  • The ingredients you add must also exist in your inventory resource. So for our example, safrole_oil, methylamine and hydrogen_peroxide should be added to ox_inventory/data/items.lua (or your custom inventory) like the example below:

  • It's your choice what you choose for weight, decay, etc. I would recommend setting realistic weights and decay values. It ensures your players can't stockpile ingredients, and makes for some reasonable inventory management. You will need to either make your own inventory images, or find them online. Here is a useful link for free item images.arrow-up-right

  • Finally, add your new drug type to the DrugPriceModifiers table, for example:

πŸŽ‰ That's it, you're done! After saving your changes and restarting the resource, this new drug will appear in the Drug Processing UI: both on the products tab with the information you supplied, and on the mixing tab for players to begin creating them.

"Molly" in the Products menu
"Molly" in the Mixing menu

Last updated