RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Gameplay AchievementGameplay CityDiscoverForce FieldGarage ModeMarker InteractionParking SystemGameplay Playmode MarkersGameplay PoliceGameplay RallyGameplay Rally LoopGameplay Raw POIsGameplay Skidpad TestSpeed Trap LeaderboardsSpeed Traps and CamerasGameplay StatisticsTaxi Ride SystemTraffic SystemVehicle PerformanceWalking
Delivery Missions

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsgameplaydelivery

Delivery Missions

Reference for `gameplay_delivery_delivery`, a class-based module providing delivery mission logic. Manages location selection, route calculation, timing, damage checking, and delivery progression.

Reference for gameplay_delivery_delivery, a class-based module providing delivery mission logic. Manages location selection, route calculation, timing, damage checking, and delivery progression.


Overview

This module returns a constructor function that creates delivery objects. Each delivery has a pickup point, a set of delivery locations selected from sites, a calculated roundtrip time limit, and fail conditions for damage and time.

Note: This is a class module (uses metatables), not a standard extension.


Constructor

local Delivery = require("gameplay/delivery/delivery")
local delivery = Delivery()

Methods

MethodSignatureDescription
setup(sites, pickupPos, pickupRadius, tag, count)Initialize delivery with sites and pickup location
setTimeParameters(baseTime, timePerKm)Set time limit formula
startDelivery()Begin the delivery (state → "active")
proceedDelivery()Advance to next location; returns true if all delivered
update(dt)Per-frame update: check fail conditions
getCurrentLocation()Get the current delivery target location
selectLocations(tag, count)Select random locations from sites with a given tag
calculateRoundtrip()Calculate total route distance via road network
getCurrentRewardFactor()Get reward multiplier based on progress
checkFail(dt)Check damage and time fail conditions
clearEvents()Clear event flags

State Machine

StateDescription
"disabled"Initial state, not active
"start"Setup complete, waiting to start
"active"Delivery in progress
"return"All locations delivered, returning to pickup
"failed"Failed due to damage or time

Setup Flow

local delivery = Delivery()
delivery.vehId = playerVehId
delivery:setTimeParameters(60, 30) -- 60s base + 30s per km

delivery:setup(sites, pickupPos, 10, "deliveryPoint", 3)
-- Selects 3 random locations tagged "deliveryPoint"
-- Calculates roundtrip distance via road network
-- Sets timer = baseTime + timePerKm * distance/1000

delivery:startDelivery()

How It Works

  1. setup() loads sites, selects random tagged locations, calculates the roundtrip distance via the road map, and sets the time limit
  2. startDelivery() transitions to "active" state and sets locationIndex = 1
  3. update(dt) decrements the timer and checks fail conditions each frame
  4. proceedDelivery() advances locationIndex; when all locations are visited, state becomes "return"
  5. checkFail(dt) checks if vehicle damage exceeds maxDamage (5000) or time runs out

Route Calculation

calculateRoundtrip() uses map.findClosestRoad() and map.getPath() to compute road-network distances between:

  • Pickup → First location
  • Each location → Next location
  • Last location → Pickup

Fail Conditions

ConditionThresholdFail Reason
Vehicle damage5000"damage"
Time expiredCalculated per route"time"
Vehicle stopped10 seconds (unused in update)N/A

Key Behaviors

  • Locations are shuffled randomly using Fisher-Yates shuffle
  • The locationRewardFactor (0.5) scales reward based on completion progress
  • Timer pauses briefly when isPartiallyInsideLocationOneFrame is true
  • The events.proceedDelivery flag is set when advancing to the next location
  • Route distances include road offset distances from findClosestRoad
FunctionSignatureReturnsDescription
M.init()nilinit

See Also

  • Gameplay Systems Guide - Guide

Crawl Engine

Reference for `gameplay_crawl_utils`, the core runtime engine for rock crawling gameplay. Handles crawl state management, pathnode detection, penalty/infraction system, marker rendering, vehicle track

Discover Experiences

Reference for `gameplay_discover_discover_037`, which defines the curated discover experiences for the 0.37 (2025 Fall) update including the Limousine Test Drive, Destructive Props, and several missio

On this page

OverviewConstructorMethodsState MachineSetup FlowHow It WorksRoute CalculationFail ConditionsKey BehaviorsSee Also