Skip to content

Scenes & templates ​

A template is what a scene is made of: its objects, tasks, stages, hazards, who may clear it and what they earn. A scene is a live instance of a template at a spawn point. Staff author templates in the in-game editor (table env_templates); other resources add code templates with RegisterTemplate. Each scene keeps a snapshot of its template, so editing or deleting a template never breaks a scene that is already in the world.

Discovery ​

Nothing is announced. A scene shows up for a player in three steps:

  1. Streamed. Within Config.Scenes.streamRadius (250 m) the client gets the scene's public data and draws its fires, particles, sounds and wrecks; np_prophandler and np_npchandler stream its props and peds (only the objects of the stages reached, no tasks or clues).
  2. Seen. With line of sight to the scene centre or one of its objects inside discoverRadius (35 m), the world markers appear (tiles on a stem, nearest 12 within 40 m) and the scene card opens: the state (reported or not, calls so far), the stage ("Getting worse"), what you can see, and who can clear it. The server checks the distance again and remembers that this player has seen it.
  3. Inspected. Within inspectRadius (8 m), E inspects (2.5 s, kneeling). The card now lists the clues ("The stump is cut halfway through with a saw. Somebody started this.") and the full task list, and a report from this player is precise: its pin is the scene itself.
Seen Inspected Reported Hazard
Scene Inspected Reported Hazard

Keys at a scene (Config.Client.keys): E inspect, G call it in, F work on a task (falls back to E once the scene was inspected). The card's H takes a photo with the np_phone camera. With np_menu the objects also get Inspect, Report and Work on it in the context menu.

Template fields ​

Field Description
id Slug [a-z0-9_], 2 to 32 characters
label, kind Name and kind (road, fire, water, nature, hazard, strange). The kind gives icon and tint
icon, tint Font Awesome name and Nimbus tint, default from the kind
weight 0..100, how often the director picks it. 0 = never rolled
enabled The director may pick it
rarity A label only (Common … Staff only)
lifetime Seconds until the scene expires (default Config.Scenes.defaultLifetime, 7200)
conditions weather = { 'RAIN', … }, hours = { from, to }, minPlayers, minOnDuty, staffOnly
factions { [factionKey] = { pay, canClear = true, tasks = 'all' | { taskId, … } } }. civilian is allowed (no pay)
objects The layout (below)
tasks The work (below)
stages How it gets worse (below)
hazards { { object?, kind = 'electric' | 'gas' | 'fumes' | 'fire', radius, damage, until = taskId, protect = item } }
chain { template, delay, on = 'cleared' | 'expired' | 'both' }: a follow-up scene at the same spot, delay seconds later
meta Free flags. Used ones: closure (force the GPS road closure on or off), ownSpawns (only this template's own spawn points), nearLabs (prefer spawn points near an np_drugs lab), turfAttention (np_gangs police attention)

Labels, task labels and clue texts are template data in any language staff write. A value starting with @ is a locale key ('@catalogue.fallen_tree.label'). The starter scenes are in English; translate or rewrite them in the editor.

Limits: 64 objects, 32 tasks, 6 stages, 12 hazards, 16 factions per template.

Objects ​

Objects are stored relative to the anchor: offset = { x = right, y = forward, z = up }, heading added to the scene's heading. One layout fits every spawn point.

Field Description
id, label Unique id, shown name
kind prop, fire, particle, sound, ped, vehicle, block (traffic node block with radius), hazard
model Vanilla model name; particles are '<asset>:<effect>', sounds '<soundset>:<name>'
offset, heading Position relative to the anchor
stage Appears from this stage on (default 1)
task Disappears one by one as this task advances (the branches of a fallen tree)
placed Appears one by one as this task advances (the cones of "Close the road")
clue Text shown after inspecting

Tasks ​

Field Description
id, label Unique id, shown name
group safe (make it safe), clear (clear it), optional. The scene is cleared when every safe and clear task is done
kind hold (hold the key), drag (carry an object off the road), place (cones, flares, fences), vehicle (a vehicle nearby), inspect
object Where it is done (default the scene centre), within Config.Scenes.taskRadius
count, duration Steps and milliseconds per step
requires item, vehicle = { models = { … } } or { types = { 'boat' } } (or { class = n }, client-side only)
consumes Items used up per step
after Task ids that must be done first ("after 2" on the HUD)
people Eligible players within Config.Scenes.peopleRadius (10 m) needed at once
civilian Anyone may do it, without a job
factions Only these factions of the list (none = everyone on the list who has it in tasks)
bonus Dollars for an optional task, split evenly among the doers
reward { item, count } handed out per step (the logs of a fallen tree give lumber)

Stages ​

stages = { { at, label, severity, payMult, addFactions? } }. Stage 1 starts at at = 0; the others at seconds after the spawn. A later stage raises the severity (1..4, four pips on the board), multiplies the faction pay, can add factions (addFactions, which must be on the template's list: such a faction can only work the scene from that stage on) and shows objects with that stage. The starter scenes mostly use Fresh ×1.0, Worse ×1.15 and Critical ×1.35.

Life of a scene ​

  • Live until it is cleared or its lifetime runs out.
  • Expired: the lifetime ran out. It is removed only when nobody is within Config.Scenes.despawnRadius (120 m), so it never vanishes in front of somebody.
  • Cleared: every required task done, /event cleanup, staff, or the ClearScene export. Pays out and fires the chain follow-up when there is one.
  • Removed: gone from the world, without pay.

Live and expired scenes are loaded again after a restart.

The starter catalogue ​

On the first start with an empty env_templates table these 20 scenes (plus the sinkhole's follow-up) are inserted once (Config.Catalogue.seedTemplates). Deleting every template later does not bring them back. Pay is per faction, before the stage multiplier.

# Scene Kind Weight Rarity Lifetime Who clears it, pay Conditions, notes
1 Fallen tree fallen_tree road 24 Common 2 h Public Works $1400, Fire $900, Police $300, EMS $500, civilians road closure; EMS only from Critical (addFactions)
2 Burst water main burst_main water 20 Common 2 h Public Works $1200 road closure
3 Dumpster fire dumpster_fire fire 18 Common 90 min Fire $1100 fire hazard
4 Abandoned wreck abandoned_wreck road 16 Common 2 h Police $400, Tow $1100 road closure
5 Dead traffic lights dead_lights road 14 Common 90 min Public Works $1000, Police $600
6 Downed power line power_line hazard 10 Uncommon 2 h Public Works $1500, Fire $800 electric hazard (safe with insulated_gloves), road closure
7 Loose livestock loose_livestock nature 8 Uncommon 90 min Police $400, Rangers $1000, civilians road closure
8 Rockslide rockslide road 8 Uncommon 2.5 h Public Works $1700 road closure, own spawn points
9 Fuel spill fuel_spill hazard 10 Uncommon 2 h Public Works $900, Fire $1100 fumes hazard, road closure
10 Illegal dumping illegal_dumping hazard 10 Uncommon 3 h Public Works $1000, Police $500 fumes hazard (safe with hazmat_suit), own spawn points, turf attention
11 Flooded underpass flooded_underpass water 12 Weather 2 h Public Works $1300, Tow $800 weather RAIN / THUNDER / CLEARING; road closure, own spawn points
12 Gas leak gas_leak hazard 9 Uncommon 90 min Fire $1400, Police $600 gas hazard (safe with hazmat_suit)
13 Brush fire brush_fire fire 6 Rare 2 h Fire $2200, Rangers $1200 weather EXTRASUNNY / CLEAR / CLOUDS / SMOG, 2 on duty; fire and fumes hazards, own spawn points
14 Boat adrift boat_adrift water 5 Rare 2 h Police $1200, civilians own spawn points
15 Scaffold collapse scaffold_collapse road 5 Rare 90 min Fire $1600, EMS $1000 2 on duty
16 Chemical drum chemical_drum strange 4 Rare 2 h Fire $2000 fumes hazard (safe with hazmat_suit), near labs, turf attention
17 Sinkhole sinkhole road 4 Rare 3 h Public Works $1100 road closure; once cleared, Fenced sinkhole follows 6 h later
18 Beached whale beached_whale nature 2 Very rare 3 h Rangers $2400, News $600, civilians 8+ players; own spawn points
19 Light aircraft down aircraft_down strange 2 Very rare 3 h Fire $1800, Police $1200, EMS $1400, News $700 10+ players, 2 on duty; fire hazard, own spawn points
20 Something fell something_fell strange 0 Staff only 4 h Police $1000, News $800 staff only (never rolled); own spawn points
– Fenced sinkhole sinkhole_fill road 0 Follow-up 6 h Public Works $1800 road closure; only spawned by the sinkhole's chain

Every starter scene needs at least one member of a listed faction on duty (minOnDuty = 1) unless noted.

Tasks and stages of every starter scene
Scene Make it safe Clear it Optional Stages (minutes after spawn, pay)
Fallen tree Close the road (traffic_cone, ×3) · Check for power lines Drag off the branches (anyone, ×6) · Cut the trunk (chainsaw, ×3) · Winch the pieces off (flatbed or tow truck) Check on the driver (+$250) · Load the logs (+$420, gives 2 lumber, ×2) Fresh 0 ×1.0 · Worse 30 ×1.1 · Critical 75 ×1.3
Burst water main Close the lane (traffic_cone, ×2) Find the valve cover · Shut the valve (valve_key, ×2) Grit the ice (+$200) Fresh 0 ×1.0 · Worse 30 ×1.15 · Critical 90 ×1.35
Dumpster fire Put out the fire (×3) · Rake out the embers Smouldering 0 ×1.0 · Spreading 10 ×1.15 · Out of control 20 ×1.35
Abandoned wreck Close the lane (traffic_cone, ×2) · Check the plate Tow it away (flatbed or tow truck) · Sweep the debris (anyone) Search the car (+$150) Fresh 0 ×1.0 · Worse 45 ×1.15 · Critical 90 ×1.35
Dead traffic lights Direct traffic (×2) Open the control box (pry_bar) · Fix the control box (insulated_gloves, ×2) Fresh 0 ×1.0 · Worse 20 ×1.15 · Critical 50 ×1.35
Downed power line Close the road (traffic_cone, ×3) · Cut the power at the pole (insulated_gloves) Secure the line (×2) · Raise the line (utility truck) Fresh 0 ×1.0 · Worse 40 ×1.15 · Critical 80 ×1.35
Loose livestock Slow the traffic Herd the cows back (anyone, ×3) · Fix the fence (lumber, ×2) Fresh 0 ×1.0 · Worse 25 ×1.15 · Critical 60 ×1.35
Rockslide Close the road (traffic_cone, ×2) Clear the small rocks (pry_bar, ×4) · Move the boulder (dozer) Fresh 0 ×1.0 · Worse 45 ×1.15 · Critical 100 ×1.35
Fuel spill Close the lanes (traffic_cone, ×2) Sand the slick (absorbent, ×3) · Wash it down (fire engine) Fresh 0 ×1.0 · Worse 30 ×1.15 · Critical 70 ×1.35
Illegal dumping Read the barrel label Seal the leaking barrel (absorbent) · Haul it away (×5) Photograph the scene (+$100) Fresh 0 ×1.0 · Worse 60 ×1.15 · Critical 120 ×1.35
Flooded underpass Close the underpass (traffic_cone, ×2) Tow the stalled car (flatbed or tow truck) · Clear the drain (×2) · Pump it out (×2) Fresh 0 ×1.0 · Worse 30 ×1.15 · Critical 70 ×1.35
Gas leak Evacuate the block (×2) · Find the leak Cap the leak (valve_key, ×2) Fresh 0 ×1.0 · Worse 15 ×1.15 · Critical 40 ×1.35
Brush fire Cut a fire line (×3) Knock down the flames (×5) · Watch for spot fires Water from above (a helicopter, +$600) Fresh 0 ×1.0 · Worse 15 ×1.15 · Critical 40 ×1.35
Boat adrift Tow it in (a boat, anyone) · Find out whose it is Fresh 0 ×1.0 · Worse 30 ×1.15 · Critical 80 ×1.35
Scaffold collapse Secure the pavement · Search under the rubble (2 people) Lift the poles (2 people, ×3) · Treat the worker Fresh 0 ×1.0 · Worse 15 ×1.15 · Critical 40 ×1.35
Chemical drum Cordon off the area Neutralise the leak (absorbent, ×2) · Remove the drum Fresh 0 ×1.0 · Worse 30 ×1.15 · Critical 70 ×1.35
Sinkhole Check how deep it goes Fence it off (×4) Set road flares (road_flare, +$100, ×2) Fresh 0 ×1.0 · Worse 45 ×1.15 · Critical 120 ×1.35
Beached whale Move the crowd back (×3) Keep it wet (anyone, ×4) · Refloat it at high tide (3 people, ×2) Film the rescue (+$300) Fresh 0 ×1.0 · Worse 60 ×1.15 · Critical 120 ×1.35
Light aircraft down Put out the fires (×2) Check the pilot · Secure the wreck · Remove the wreck (2 people, ×2) Open the flight case (bolt_cutters, +$500) · Film the scene (+$300) Fresh 0 ×1.0 · Worse 20 ×1.15 · Critical 60 ×1.35
Something fell Cordon off the crater Examine the object · Recover the object (2 people) Film the crater (+$300) Fresh 0 ×1.0 · Crowded 60 ×1.2
Fenced sinkhole Fill the hole (tipper truck, ×3) · Compact and patch (×2) · Remove the fence (×4) Fenced 0 ×1.0 · Overdue 180 ×1.2

Models are vanilla GTA V props, peds and vehicles. Vehicle requirements: flatbed or tow truck (flatbed, towtruck, towtruck2), fire engine (firetruk), dozer (bulldozer), utility truck (utillitruck, utillitruck2, utillitruck3), a boat or a helicopter (by vehicle type).

The editor ​

/envadmin (or the np_admin tool Open the scene editor) opens the template editor. It needs the np_environmental.editor node (or .admin).

Editor

  • Templates · by weight on the left, each with its kind, object count and weight bar; New template starts blank or from a duplicate. Code templates from other resources are marked and cannot be edited.
  • Scene layout in the middle: the objects relative to the anchor. LMB moves, R rotates, N adds an object, W Place in world leaves the editor and lets you walk to drop objects at your position. The stage cards below show what each stage adds and pays; New stage adds one.
  • Inspector on the right with the tabs Rules (weight, lifetime, min on duty, min players, hours, weather, who can clear it), Pay (pay and tasks per faction), Tasks, Object and Stage. Every change is validated live: every reference (object → task, task → object, after, hazard → object / task) must exist, after has no cycles, stage 1 starts at 0, factions added by a stage are on the list, and some faction on the list (or a civilian task) can finish every required task.
  • Test spawn here spawns the selected template at your position. The editor can also show the layout as local ghost props in front of you (only you see them), per stage.
  • Save and sync writes the template; Discard drops the unsaved changes. Templates can be duplicated and deleted.

Spawn points ​

The director only spawns at spawn points. A spawn point is either a point (coordinates and heading: the anchor the layout follows) or a zone (a polygon; a random spot inside). A point or zone with a template serves only that template; without one it serves every template whose kind is in its kinds (none = every kind). Templates with meta.ownSpawns use only their own points (beaches, piers, fields).

In the editor's Spawn points for this template panel:

Action How
Add a point where I stand Anchor and heading from your position
Or anywhere in a zone Walk the corners: E drops a corner, BACKSPACE returns to the editor with them
Enable / disable The switch on each row
Delete × on each row
Walking mode result
Walked

The starter catalogue brings 52 example spawn points (Config.Catalogue.seedSpawns). They are examples on the vanilla map: check them before going live.

When the director picks a spot it skips spawn points with a player within Config.Scenes.noWitnessRadius (150 m), within Config.Director.sceneGap (300 m) of a live scene, or inside the area cooldown (areaRadius 500 m, areaCooldown 24 h). With np_drugs, points near a lab weigh more for chemical scenes (see Integrations).

Code templates ​

Another resource can register a template from code: picked by the director like any other, not editable in game, not stored in env_templates, removed when that resource stops.

lua
local id, err = exports.np_environmental:RegisterTemplate({
  id = 'my_pothole', label = 'Pothole', kind = 'road', weight = 10, lifetime = 3600,
  conditions = { minOnDuty = 1 },
  factions = { publicworks = { pay = 600, tasks = 'all' } },
  objects = { { id = 'barrier', kind = 'prop', model = 'prop_barrier_work05', label = 'Barrier', offset = { x = 0.0, y = 0.0, z = 0.0 }, heading = 0.0 } },
  tasks = {
    { id = 'fix', label = 'Fix the barrier', group = 'clear', kind = 'hold', object = 'barrier', count = 2, duration = 6000 },
  },
  stages = { { at = 0, label = 'Fresh', severity = 1, payMult = 1.0 } },
})

See Exports.