ARunForLife (Flowgraph Node)
- **Node Name:** `ARunForLife`
Overview
- Node Name:
ARunForLife - Category:
repeat_instant - File:
extensions/flowgraph/nodes/mission/ARunForLife.lua
A complex all-in-one flowgraph node that drives a "Run For Life" minigame scenario. The player's camera scrolls forward while props (obstacles) spawn on lanes. The player must dodge, push balls, jump ramps, crash gates, and collect coins/repair buffs to score points.
Pin Schema (Summary)
Key Input Pins
| Pin | Type | Description |
|---|---|---|
reset | flow (impulse) | Resets the game state |
plId | number | Player vehicle ID |
pool | table | Vehicle pool containing all spawnable props |
minPropLine / maxPropLine | number | Min/max props per spawn line |
baseTimeToNextLine | number | Average time between spawn lines |
startCamSpeed / maxCamSpeed | number | Camera scroll speed range |
camNaturalAccel | number | Camera acceleration rate |
gatePoints / ballPoint / jumpPoints | number | Scoring values |
coinTime / repairBuffCost | number | Buff timing and costs |
bronze / silver / gold | number | Medal thresholds |
cont1id – cont12id | number | Container IDs for scrolling scenery |
cannon / jumpRamp / crashGate / coinTrigger / repairTrigger | flow (impulse) | Trigger events |
Key Output Pins
| Pin | Type | Description |
|---|---|---|
score | number | Current score |
totalBonusScore | number | Points from bonus actions |
timeLeftToLose | number | Countdown when player is out of bounds |
camSpeed | number | Current camera speed |
coins | number | Collected coins |
currMedal | string | Current medal tier |
lost | flow (impulse) | Fires when player loses |
repaired | flow (impulse) | Fires when vehicle is repaired |
Various *Pos | vec3 | Trigger positions for ramp, gate, cannon, etc. |
How It Works
- Initialization: On first frame (or reset), links prop pool, containers, and creates decal pools.
- Camera: Scrolls forward with acceleration. Slows down during repair buff, then catches up.
- Scoring: Base score scales with player position (closer to front = more points). Bonus points from ramp jumps, gate crashes, and ball pushing.
- Prop Spawning: Props spawn on 5 lanes at random intervals ahead of the camera. Inactive props recycle from a pool.
- Buffs: Coin buff spawns on a timer; collecting enough coins unlocks a repair buff that freezes and repairs the vehicle.
- Lose Condition: If the player is outside the camera zone for 5 seconds, they lose.
- Decals: Arrow decals drawn above interactive props (ramps, gates, ball). Red arrow shows player position when behind camera.
- Containers: Background scenery containers teleport cyclically to create infinite scrolling.
Key Dependencies
core_camera- camera position/rotation controlspawn.safeTeleport()- safe prop repositioningcore_vehicleBridge- freeze/unfreeze vehicle for repairEngine.Render.DynamicDecalMgr- dynamic decal renderingmap.objects- vehicle tracking data_flowgraph_createNode()- standard flowgraph node registration
Additional Methods
C:activateBuff(buff, pos)
Node method.
Parameters:
buffpos
C:activatePropsAndBuffs()
Node method.
C:calcMedal()
Node method.
C:checkBuffAvailabilty()
Node method.
C:checkCoinForRepair()
Node method.
C:checkLose()
Node method.
C:checkTriggers()
Node method.
C:coinBuff()
Node method.
C:createDecalPool()
Node method.
C:deactivateBuff(buff)
Node method.
Parameters:
buff
C:deactivateProp(propName)
Node method.
Parameters:
propName
C:deactivatePropsAndBuffs()
Node method.
C:doBuffsTime()
Node method.
C:doScore()
Node method.
C:drawDecals()
Custom ImGui drawing function for the node editor.
C:getBuffByName(name)
Node method.
Parameters:
name
C:getBuffNextTime(baseTime)
Node method.
Parameters:
baseTime
C:getPropByName(name)
Node method.
Parameters:
name
C:increaseDecalPool(amount)
Node method.
Parameters:
amount
C:linkContainers()
Node method.
C:linkProps()
Node method.
C:moveCamera()
Node method.
C:moveTriggers()
Node method.
C:pushBall()
Node method.
C:resetValues()
Node method.
C:setParameters()
Node method.
C:setReferences()
Node method.
C:slowDownCar()
Node method.
C:tpContainers()
Node method.
C:updateValues()
Node method.
C:work()
Main work function called each frame/tick when the node is active.
See Also
- Update Display Drag Race (Flowgraph Node) - Related reference
- Clear Lights Drag Race (Flowgraph Node) - Related reference
- Countdown Lights Controller (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide