← All docsCivilian jobs

Swarm Farming

A farming and ranching job: plant, water and harvest crops in field zones with a harvest-quality minigame, and raise livestock on rented ranch plots. Includes upgrades, a journal and 10 levels.

QboxQBCoreESXResource: swarm_farming

New to Swarm scripts? Read Getting started first. It covers Swarm Bridge, install order and the licence.

Requirements

Frameworks: Qbox, QBCore, ESX.

RequirementWhat it's forIncluded
swarm_bridgeTalks to your framework, inventory, target and so on. Included with every Swarm script.Yes
ox_libShared library (callbacks, progress bars, text UI).No
oxmysqlSaves player stats and progress.No
ox_target or qb-targetNPCs and the ranch plot, trough and bucket are target-only. Ranching can't be used without one.No
A supported inventorySeeds, produce and ranch goods are real items.No
Qbox, QBCore or ESXSeeds and fertilizer become usable items through your framework.No

Install

  1. Copy the folders swarm_farming, swarm_bridge into your server's resources folder. Already have swarm_bridge from another Swarm script? Keep just one copy, the newest.
  2. Add them to server.cfg, dependencies first:
    ensure ox_lib
    ensure oxmysql
    ensure ox_target
    ensure ox_inventory
    ensure swarm_bridge
    ensure swarm_farming
  3. Database: tables are created automatically the first time the script starts. If you prefer, import install/swarm_farming.sql yourself first.
  4. Items: add the item definitions for your inventory from install/items/:
    • ox_inventory.items.lua for ox_inventory (any framework)
    • qbcore.items.lua for QBCore or Qbox with qb-inventory
    • esx.items.sql for legacy ESX

    Then copy install/images/*.png into your inventory's image folder (ox_inventory/web/images/ or qb-inventory/html/images/). Icons are named SS_<item>.png so they never overwrite another resource's images. Every item has an icon included.

    Items added (25)
    watering_can seed_wheat seed_carrot seed_potato seed_corn seed_tomato seed_pumpkin seed_grapes wheat carrot potato corn tomato pumpkin grapes animal_feed raw_beef raw_pork raw_mutton raw_chicken cow_hide pig_hide wool water_jug fertilizer

    Common names such as wheat, corn, potato, carrot, tomato, grapes, wool and fertilizer may already exist on your server. Skip any you already have.

    The grape item is grapes, the same name Swarm Winery uses.

  5. Licensed edition only: put your ServerSecret in swarm_bridge/licence/private_config.lua. One secret unlocks every Swarm script you own. How to get it. The Source Code edition has no licence check, so skip this.
  6. Start the server and check the console for errors.

Configuration

Open config.lua and check these before going live. Anything marked as a placeholder should be moved to a spot that suits your map.

SettingWhat it does
Config.SupplyPed.coordsWhere the Farm Supply NPC stands (clock in and shop). Placeholder coords.
Config.MarketPed.coordsWhere the produce buyer NPC stands.
Config.FieldsField zones players can plant in: coords, radius and minimum level.
Config.Ranch.plotsThe rentable ranch pens: coords, radius and rent. Three placeholders ship.
Config.Ranch.foodOffset / waterOffsetWhere the trough and water bucket sit, relative to each pen's centre.
Config.Ranch.horseModelLeave as nil to disable horses, or set it to an addon horse ped model.
Config.Ranch.enabledSet false to turn ranching off.
Config.MoneyAccountAccount players are paid into. 'cash' by default.
Config.Locale'auto' follows the language set in Swarm Bridge. Set a code such as 'de' to force this script into another language. See Languages.

Commands & permissions

CommandWhoWhat it does
/farmingEveryoneOpens the farming hub (shop, upgrades, sell, journal) from anywhere.
/farmposDebug mode onlyCopies your current position as a vec4. Only exists while Config.Debug = true.

Debug helpers only exist while Config.Debug = true in config.lua. Leave debug off on a live server.

No ACE permissions are needed.

Keys

  • E: water or harvest a nearby crop

Good to know

  • Animal feed, water jugs and fertilizer aren't sold in the farming shop. Give players a way to get them, for example through another shop.
  • Planted crops aren't saved, so they are lost on disconnect or server restart.
  • Ranch animals keep needing food and water while their owner is offline.
  • Grapes unlock at level 8 with the Greenhouse perk.

Need help?

Ask in the Swarm Scripts Discord and we'll help you get set up.