Skip to main content
The addGlobal* exports register rules for an entire class of entity - every vehicle, every NPC, every other player, every object - with no per-entity registration.
Returns a rule id (number) on success, or nil with a console error explaining what’s wrong. exports.lation_interact:remove(id) removes the rule and every anchor it created, immediately. Rules are also cleaned up when your resource stops.
This page covers what globals add on top of the shared vocabulary. The anchor fields (label, options, icon, stages, expand, reveal, debug), the option table, condition gates, and handlers are documented in Options.

Parameters

table
required
The anchor template - all the shared anchor fields plus the same placement fields addEntity takes:
  • bone (string) - bone the anchor rides on each matching entity (e.g. 'boot'); missing bones fall through to offset, then to the entity center
  • offset (vector3) - entity-local offset from the center, rotating with the entity
What each export matches:
  • addGlobalVehicle - every vehicle. The one you’re sitting in is excluded by default - see your own vehicle below.
  • addGlobalPed - every NPC ped. Never players, never your own ped.
  • addGlobalPlayer - every other player’s ped. Never your own.
  • addGlobalObject - every object.
Across all model and global rules combined, at most the nearest 24 matches are active at once - over the cap, the nearest win.

Merging

Globals merge into the same per-spot stacks as every other source, at the lowest priority: explicit addEntity > model rules > globals. One trunk rule plus a mission vehicle’s own trunk option is one stack, mission option on top. See Merging for a worked example.
On a rule-created anchor, the handler payload’s data.id identifies which entity’s stack fired - it is not the rule id. Keep the id your addGlobal* call returned; that’s the one remove(id) takes.

Behavior Notes

Rule-created anchors default to reveal = 'focus': nothing renders until the player looks at the entity, so a street full of cars and peds stays perfectly quiet. Pass reveal = 'ambient' on the rule to mark every match with a grain of light from a distance.
addGlobalVehicle skips the vehicle you’re sitting in by default. Glovebox-style scripts that expect their options while seated need Config.IncludeOwnVehicle = true.
A match moving faster than 3.0 m/s holds at the grain stage and can’t be focused - a passing car earns a point of light, not a prompt. It becomes interactable the moment it slows down.
The addGlobal* names are also ox_target export names, told apart by shape: a native spec always carries an options array, while ox-style calls route to the compatibility bridge.

Example

A pickpocket option on every NPC - one rule, registered once at resource start:
Every option here is gated - matched peds show nothing at all to anyone without a lockpick.