RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Flowgraph Base ModuleFlowgraph Base NodeFlowgraph Base State NodeFlowgraph Node BuilderFlowgraph GraphFlowgraph Group HelperFlowgraph LinkFlowgraph ManagerNew Node TemplateFlowgraph PinFlowgraph States ManagerFlowgraph UtilsFlowgraph Variable Storage
Align For CouplingApply Velocity to VehicleBoost VehicleSet Vehicle ColorsCustom Parts Config ProviderEnter VehicleFlip UprightFreeze VehicleGenerate License PlateGet Vehicle ActiveGet Electrics ValueGet GearboxmodeGet Powertrain DataGravity ForceDistance From GroundHas Coupler TagIs CoupledIs Player UsableKeep VehicleMove Vehicle ToOn Cannon FiredOn Vehicle DestroyedOn Vehicle ResetOn Vehicle SpawnedOn Vehicle SwitchedPlayer UsableRandom Config ProviderRecover In PlaceRemove VehicleTimeline ReplaySet Vehicle ActiveSet Gearbox ModeSet IgnitionSet License PlateSet LightbarSet LightsShift to Gear IndexSpawn VehicleVehicle StatesTeleport To Last RoadToggle Vehicle ControlsMove To ShowroomVehicle TouchProps TouchStatic Object TouchTrack VehicleTrailer Respawn ControlVehicle Config ProviderGet Vehicle DataGet Vehicle DataGet Vehicle BoundsVehicle PingGet Vehicle Wheel Center

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 Extensionsflowgraphnodesvehicle

On Vehicle Destroyed

- **Node Name:** `On Vehicle Destroyed`

Overview

  • Node Name: On Vehicle Destroyed
  • Category: logic
  • File: extensions/flowgraph/nodes/vehicle/onVehicleDestroyed.lua

Detects when a vehicle is destroyed and fires an impulse with the destroyed vehicle's ID. This is an event-driven node that listens for the onVehicleDestroyed hook.

Pin Schema

Input Pins

PinTypeDescription
flowflowInflow for this node

Output Pins

PinTypeDescription
flowflow (impulse)Fires once when a vehicle is destroyed
vehIdnumberID of the vehicle that was destroyed

Legacy Pin Mapping

  • out.vehicleID → vehId

Internals

Key Methods

MethodDescription
init()Empty initialization
_executionStarted()Resets flag and info table
onVehicleDestroyed(id)Hook - stores the destroyed vehicle ID and sets the flag
work()If flag is set, outputs the vehicle ID and fires impulse flow, then clears flag
_afterTrigger()Clears the flag to ensure single-frame impulse

How It Works

  1. The node subscribes to the onVehicleDestroyed hook automatically.
  2. When any vehicle is destroyed, onVehicleDestroyed(id) stores the vehicle ID and sets a flag.
  3. On the next work() tick, the node outputs the vehicle ID on vehId and fires the flow impulse.
  4. The flag is cleared immediately after, so the impulse fires for exactly one frame.

Usage Example

-- In a flowgraph:
-- [On Vehicle Destroyed] → (vehId) → [Log / Scoring / Respawn Logic]

-- The hook is called engine-side when a vehicle object is destroyed:
-- onVehicleDestroyed(vehicleId)

Key Dependencies

  • onVehicleDestroyed engine hook - fires when a vehicle object is destroyed

See Also

  • Align for Coupling (Flowgraph Node) - Related reference
  • Apply Velocity to Vehicle (Flowgraph Node) - Related reference
  • Boost Vehicle (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

On Cannon Fired

- **Node Name:** `on Cannon Fired`

On Vehicle Reset

- **Node Name:** `On Vehicle Reset`

On this page

OverviewPin SchemaInput PinsOutput PinsLegacy Pin MappingInternalsKey MethodsHow It WorksUsage ExampleKey DependenciesSee Also