Drift Quick Messages
Reference for `gameplay_drift_quickMessages`, which detects special drift achievements (close calls, big angles, long drifts, etc.) and awards bonus points with on-screen messages.
Reference for gameplay_drift_quickMessages, which detects special drift achievements (close calls, big angles, long drifts, etc.) and awards bonus points with on-screen messages.
Dependencies
gameplay_drift_general, gameplay_drift_drift, gameplay_drift_scoring
Exports
| Function | Signature | Description |
|------
| M.dependencies | table | { |----|-----------|-------------|
| onUpdate | (dt) | Check primary, confirm, and reset conditions |
| reset | () | Clear all processed states |
| onDriftPlVehReset | () | Reset on vehicle reset |
| onDriftCompleted | () | Chain ended - check reset conditions |
| onDriftActiveDataFinished | () | Single drift ended - check reset |
| onDriftCrash / onDriftSpinout | () | Reset on failure |
| getQuickMessages | () → table | All message definitions with translated names |
| getDriftDebugInfo | () → table | Debug toggle |
| getGC | () → number | Profiler garbage |
Quick Message Definitions
| ID | Primary Conditions | Reset | Reward |
|---|---|---|---|
bigAngle | angle > 80° | on drift end | 15 |
reverseDrift | angle > 105° | on drift end | 30 |
longDrift | drift time > 4s, speed > 30 kph | on drift end | 20 |
closeCall | angle > 25°, speed > 30 kph, wall < 1.5m | after 4s (no crash confirm) | 80 |
longDriftChain | chain ≥ 10 drifts | on chain end | 160 |
precisionDrifting | 3+ close calls in one chain | on chain end | 150 |
Condition System
Primary Conditions
All must be true simultaneously:
primaryConditions = {
minAngle = function(threshold, data) return data.driftActiveData.currDegAngle > threshold end,
minSpeed = function(threshold, data) return data.currentSpeed > threshold end,
minDist = function(threshold, data) return wallDistFront < threshold or wallDistRear < threshold end,
minDriftChain = function(threshold, data) return chainedDrifts >= threshold end,
minCachedScore = function(threshold, data) return cachedScore >= threshold end,
minDriftTime = function(threshold, data) return currentDriftDuration > threshold end,
notDrifting = function(_, data) return not data.driftActiveData end,
closeCallsInOneChain = function(threshold, data) return closeCallsCount >= threshold end,
minOneDriftScore = function(threshold, data) return driftActiveData.score > threshold end,
}Confirm Conditions
Must pass after primary conditions are met:
confirmConditions = {
noCrash = function(data, dt)
-- Must not crash for 1 second after conditions met
-- Returns "failed" if crash detected, true when timer expires
end,
}Reset Conditions
When to allow re-triggering:
resetConditions = {
onDriftEnd = function() return {reset = individualDriftStoppedThisFrame} end,
onChainEnd = function() return {reset = driftChainStoppedThisFrame} end,
afterTime = function(data, args) -- timer-based reset end,
}How It Works
-- Each frame:
-- 1. Check primary conditions for all unprocessed messages
-- 2. If met → either directly display or queue for confirmation
-- 3. Check confirm queues (e.g., noCrash timer)
-- 4. Check reset conditions to re-enable processed messages
-- 5. When triggered: display message, add score, fire hooks
-- Close call example:
-- Primary: angle > 25°, speed > 30 kph, wall < 1.5m → queue
-- Confirm: no crash for 1 second → award 80 points
-- Reset: 4 seconds after trigger
-- Also increments closeCallsInCurrentDriftChain for precision checkKey Behaviors
- Messages are translated via
translateLanguage("missions.drift.quickMessage.<id>") - Rewards are added directly to cached score via
gameplay_drift_scoring.addCachedScore() onDriftQuickMessageReachedhook fires with{quickMessageId, reward}for scoreboard tracking- Messages won't trigger while
gameplay_drift_general.getFrozen()is true - Close call counter resets on chain end via
reset.funcWhenReset
Module Variables
| Variable | Type | Description |
|---|---|---|
M.dependencies | table | { |
M.getDriftDebugInfo | () | - |
M.getGC | () | - |
M.getQuickMessages | () | - |
M.onDriftActiveDataFinished | () | - |
M.onDriftCompleted | () | - |
M.onDriftCrash | () | - |
M.onDriftPlVehReset | () | - |
M.onDriftSpinout | () | - |
M.onUpdate | (dt) | - |
M.reset | () | - |
See Also
- drift/bounds - Drift Zone Boundary Detection - Related reference
- drift/destination - Race Path & Wrong-Way Detection - Related reference
- drift/display - Drift UI & HUD Management - Related reference
- Gameplay Systems Guide - Guide
Drift System
Reference for `gameplay_drift_general`, which is the central manager for the drift subsystem. Controls extension loading/unloading, context switching, debug state, freeze/pause logic, and coordinates
Drift Save/Load
Reference for `gameplay_drift_saveLoad`, which loads drift spot definitions from level directories, manages per-spot score persistence, and handles career save integration.