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
Bool (Flowgraph Node)Color (Flowgraph Node)Generic Set/Get Variable (Flowgraph Node)Get Variable (Flowgraph Node)Number (Flowgraph Node)Quat (Flowgraph Node)Set Variable (Flowgraph Node)String (Flowgraph Node)Transform (Flowgraph Node)Vec3 (Flowgraph Node)

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 Extensionsflowgraphnodestypes

Set Variable (Flowgraph Node)

- **Node Name:** `Set Variable`

Overview

  • Node Name: Set Variable
  • Category: repeat_instant
  • File: extensions/flowgraph/nodes/types/setVariable.lua
  • Icon: cloud_upload
  • Hidden: Yes (created via variable system, not node palette)

Writes a value to a flowgraph variable (graph-local or project-global) through a dynamically typed input pin.

Pin Schema

Input Pins

PinTypeDescription
flowflowExecution flow
(dynamic)(matches variable type)Value to write to the variable

Output Pins

PinTypeDescription
flowflowPasses through input flow

The input pin is created dynamically based on the selected variable's name and type.

Internals

FieldPurpose
self.varNameName of the selected variable
self.globaltrue = writes to project-level variables; false = graph-local
self.targetReference to the variable store

How It Works

  1. init() - Sets varName = nil, defaults to local graph variables.
  2. setGlobal(global) - Switches variable target between graph-local and project-global. Removes the current input pin and resets varName.
  3. setVar(name) - Looks up the variable, removes the old input pin, creates a new pin matching the variable's type, and reconnects compatible links.
  4. work() - Calls self.target:change(varName, value) to update the variable, then passes flow through.
  5. renameVariable(source, name, newName) - Handles variable renames from the variable system.
  6. typeUpdated(source, name, newType) - Recreates the input pin when the variable type changes.
  7. drawMiddle() - Shows the current variable value inline or ??? if missing.

Serialization

  • Saves varName and global flag.
  • On deserialization, calls setGlobal() then setVar() to rebuild the pin.

Example Usage

-- In the flowgraph editor, this node is created automatically when
-- you drag a variable from the variable panel as a "setter".
-- Equivalent runtime behavior:
self.graph.variables:change("myVar", newValue)

Additional Methods

C:_onDeserialized(nodeData)

Called after the node is deserialized (loaded from file). Restores runtime state from saved data.

Parameters:

  • nodeData

C:_onSerialize(res)

Called when the node is serialized (saved to file). Returns data to persist.

Parameters:

  • res

C:drawCustomProperties()

Custom ImGui drawing for the node's properties panel in the editor.


See Also

  • Bool (Flowgraph Node) - Related reference
  • Color (Flowgraph Node) - Related reference
  • Generic Set/Get Variable (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Quat (Flowgraph Node)

- **Node Name:** `Quat`

String (Flowgraph Node)

- **Node Name:** `String`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsHow It WorksSerializationExample UsageAdditional MethodsC:_onDeserialized(nodeData)C:_onSerialize(res)C:drawCustomProperties()See Also