The Director
The Director builds missions, heists and stories in game from cards, with no code. Your resource can start and steer its runs, hear what they do, ship scenarios, and add cards of its own.
Scenarios, runs and cards
- Scenario. A job or story: its placed things (NPCs, vehicles, props, spots, containers) and its cards, wired together in the editor. Every revision is kept, so the one switched on never changes under its players.
- Card. One step: a line of dialogue, a goal, giving an item, waiting for an event. It goes on through one of its outcomes, along a wire to the next card. Resources can add their own: Cards of your own.
- Run. One playing of a scenario, for its players. Your code reads it as a
DirectorRunView(Runs from a script). - Test. A builder's private run from the editor. It changes nothing that lasts.
Scenarios are managed in /whip → Director (the /w menu's Director row opens it too) and built in game, in the world.
Who may build
| Level | Permission | May |
|---|---|---|
| Builder | director.build | See every scenario; make, edit, test, switch on and off; restore an old revision; stop a run |
| Director admin | director.admin | All a builder may, and delete scenarios, accept shipped packs, export packs, and give or take Director access |
| Dungeon Master | director.live | Dungeon Mode: change the live world until a restart. Neither of the other two includes it, nor does it include them |
| Full admin | whip.devtools | All three, always, and the /director dev commands |
Give access per account in /whip → Director → Access: pick a character, and every character on that account has it. A builder who isn't a full admin sees only the Director in /whip; a Dungeon Master sees only its Dungeon Mode page.
How a scenario starts
Switching a scenario on makes it available. A run then begins the way its Scenario Enabled card's It starts says:
| It starts | How |
|---|---|
| When it's switched on | The default for a new scenario. A run starts at once with nobody in it, and players join it (below) |
| Talk to an NPC | Talk on a standing NPC. While its runs are full, others see "They're busy right now." |
| Press something | An E prompt, in your words, on a standing prop or a spot (a laptop, a keypad, a job board) |
| A player comes near | Within the distance of a placed thing. Once a visit: still there when their run ends, they must leave and come back. One turned away by full runs gets one as soon as a place frees |
| Use an item | Kept unless Used up. Only an item that does nothing else when used (Check refuses one that does); two scenarios can't start with the same item |
| On a timer | Every so many minutes, the first that long after switching on: one run for every player near a placed thing |
| From a script | exports.whip_core:StartScenarioRun(key, source) from another resource (a phone app, a job menu) |
| By hand | Only Start a run: admin-run events |
When it's switched on, Scenario Enabled's cards play straight away and what they make (an NPC to talk to, vehicles, props) is out for everyone. The first player to talk to its NPC (a Dialog Line), press its prompt (Wait for Press, an Interaction Menu) or come near (Player Arrives) joins the run, and that card plays for them. The job starts at Scenario Started By Player (before it nothing counts), or as they join when there's no such card.
When that run ends, however it ended, a fresh one starts a couple of seconds later. One that ended before anyone joined (a Succeed with nobody there) waits until the scenario is switched off and on. Start a run and StartScenarioRun put the player into the waiting run.
With the other choices, a run starts for the player who does it, and Scenario Enabled's cards play then. Test starts one for you at once whatever it says, and anyone with Director access can press Start a run on its page in /whip. Started any other way, a player is never in two runs of the same scenario, and Runs at once and Players this close join apply.
For other resources#
The Director tells other resources what its runs do, and its server exports start, read and steer runs. Two rules run through all of it:
- A builder's Test is private. It sends none of these events, and every export leaves it out unless you pass
{ tests = true }. A script that pages officers when a heist starts doesn't fire on every Test. - You get copies. A run is a
DirectorRunView, made when you ask: changing it changes nothing.
A builder fills in settings for you in Settings → For scripts: Kind (a few words, "heist, crime") and Where it happens (a placed thing: the bank, not the job giver) become a run's and a scenario's kinds and where. Scripts may switch it on and off allows SwitchScenario.
| Server event | Payload |
|---|---|
whip_core:run:started | { run, startedBy = { mode, by } }. mode: interaction · press · area · item · timer · script (by: the resource) · hand · enabled (When it's switched on: the run has nobody in it yet) |
whip_core:run:ended | { run, outcome, reason, vars, payout, faultCard, stopping }. outcome: succeeded · failed · calledOff (a Call Off card) · aborted (an admin, the last player leaving, whip_core stopping) · faulted |
whip_core:run:playerJoined | { run, source, charId, by }: AddPlayerToScenarioRun |
whip_core:run:playerLeft | { run, source, charId, why, by, runEnds }. run is without them; sent before its run:ended; by: the resource that took them out |
whip_core:run:signalled | { run, name, data = { value }, source }: a Send Signal card |
whip_core:scenario:switchedOn / :switchedOff | { scenario, name, rev, replaced | why, by }. by: { source, name } (a person), { resource } (SwitchScenario) or nil (the server itself) |
AddEventHandler('whip_core:run:started', function(e)
if GetInvokingResource() ~= 'whip_core' then return end
local run = e.run
for _, k in ipairs(run.kinds) do
if k == 'heist' and run.where then
-- one mark for every on-duty officer, by character (it follows them through a relog)
local people = {}
for _, o in ipairs(exports.whip_core:GetClockedOnEmployees('police') or {}) do
people[#people + 1] = { charId = o.charId }
end
if #people > 0 then
-- the run's tag: the mark goes when the run ends
exports.whip_core:ShowBlip({ people = people }, 'heist:' .. run.id,
{ coords = run.where.coords, label = 'Alarm: ' .. run.where.label, sprite = 161, color = 1, tag = run.tag })
end
end
end
end)- Tag what you make. Anything you make for a run with
tag = payload.run.tag(a blip, a point, an NPC, a skill check, a vehicle) goes when the run ends. Anything made with it after that is refused. - Check the sender. Any server resource can fire these events. Before paying anything out, check
GetInvokingResource() == 'whip_core'(forrun:startedyou can also askGetScenarioRun; an ended run is gone). - Wait for a player. An
enabledrun starts empty. Wait forrun:playerJoinedbefore treating it as a job going on (a heist being reported). - Never mid-run. Events are sent just after the Director's scheduler has done its work, so your handler never runs in the middle of a run's cards.
Two cards let a builder work with your script without a card of yours: Send Signal (you hear whip_core:run:signalled) and Wait for Script Event (the run carries on when you call SendDirectorEvent).
On the player's game (a phone's job screen, a HUD), exports.whip_core:GetPlayerScenarioRuns() returns the runs that player is in: { { runId, scenario, name, objective, countdown } }. The local events whip_core:run:joined, :updated (their objective or clock changed), :left and :ended ({ outcome, payout }) say when that changes. Never a Test.
Shipping scenarios in a resource
A resource can bring scenarios as data, with no scripts: one manifest line per file.
-- fxmanifest.lua of your pack
whip_director_scenario 'scenarios/bank_job.json'
whip_director_scenario 'scenarios/drug_run.json'Each file is a scenario document as the editor saves it ("format": 2, at most 512 KB), with "key" (its key on every server) and "requires": { "items": [...], "models": [...], "resources": [...] }. Its "taskTimes": 2 says a task time of 0 is no end and a give-up of 0 is never; in a document without it, either 0 is a tenth of a second. Things it ships unplaced ("coords": "spot") are placed by each server in a copy. Export as a pack (a Director admin, on a scenario in /whip) writes one in exactly this shape to whip_core/pack_exports/, with its manifest beside it.
- whip_core reads each file when the resource starts, checks it, and offers it to a Director admin to accept.
- Accepted, it's a scenario like any other but read-only: Duplicate it to change it. It goes off while its resource is stopped and comes back on with it.
- Deleted, it's never offered again. A file that changes is offered again; what was accepted stays as it was until then.
To offer scenarios or editor templates from code, use Whip.scenario and Whip.template (Cards of your own).
The Director in /whipServer owners
| Page | What it shows |
|---|---|
| Overview | Numbers for every scenario, or some, over 7, 14, 30 or 90 days: payouts, runs, successes, why runs fail, the newest runs. Tests left out |
| Scenarios | Every scenario. Its page has Active (its newest revision; edits made while on go live when you switch it off and on), Previous Versions with Restore, Duplicate, Open Editor, Start a run and Delete |
| Lore characters | The people your stories come back to: picture, details, voice lines, where they're used |
| Shipped | Scenarios resources bring, and anything this server lacks to run one |
| Live runs | Runs going now, with Stop; scenarios on from a file (/director load) |
| Access · Dungeon Mode | Who has Director access (Director admins only) · what you made in Dungeon Mode, each with Remove |
Building a scenarioServer owners
New scenario or Open Editor takes you into the world builder: place its people and things with Place, set each one up with Configure, and open Blueprint for its cards in a window over the world. Fullscreen opens the full editor (Cards, World, Variables and Settings tabs; Save, Test and Check); its ‹ or Esc goes back into the world.
- Saving. Save writes the world into the scenario and saves it. The world builder also saves every five minutes, unless Auto-save in the world builder is off (World tab). Exit leaves the Director and throws away what you placed, moved or removed since the last Save (it asks first; what other builders did stays). Other changes not saved stay with the scenario until you open it again.
- Keys. In the world, R switches between moving and turning, G steps snapping, Ctrl+click selects several. On the grid, right-click adds a card, a drag from a pin draws a wire, C makes a comment box, and the usual Ctrl keys copy, paste, undo and save.
- Wires. An outcome can have several: every card they lead to starts at the same moment, the first-drawn first.
- Only once. A switch on every card that does something and goes on: it works the first time a run reaches it, then the run skips it through its first outcome. To stop the run the second time, use First Time Only.
- Several things on one card. Most cards that name placed things take several, or a group: every NPC or prop whose page gives that Group name, as it is when the scenario plays. Talking cards, cards that change one vehicle (Claim Vehicle, Change Plate, Put in Vehicle, Force Player(s) Change Vehicle Seat) and cards about one spot (Survive, Set Waypoint, Skill Check) name one.
- An outcome for each. When any one of several things can set a card off (Go To, Player Arrives, Wait for Press, NPC Killed, Vehicle Entered and others), its Outcomes keys pick One for each: each thing its own outcome, named after it, up to eight (a group counts as one). One for all gives them a single outcome. On Go To they are Get to: Individual location or Any location. Goal: Collect's are Individual item (the first kind collected, out of its own) or All items; Player Has Item?, needing any one of several, has A Yes for each or One Yes. Goal: Deliver the Vehicle and Vehicle Delivered have Any vehicle, All vehicles (every one must arrive), One per vehicle or One per drop-off. Take a thing or an item off the card and its wire goes with it.
- Watching. A scenario's live runs light each card they enter on the grid; after a test, the test plays back the same way. During a test, the test map's Free camera (H for the mouse first) flies round it, and G hides the test map.
Building togetherServer owners#
Several builders can work on one scenario at the same time. Everyone who opens it is in the same scenario: what one changes, the others see as it happens, and Save saves everyone's changes as the next revision, whoever presses it.
- Who's in. Each builder gets a colour. The others show as rounds at the top right of the editor and at the top of the world builder; hover one for their name and where they are.
- On the blueprint. Each other builder's pointer, the cards they have picked (ringed, with their name over them) and the last field they pressed or typed in, all in their colour. A card someone is dragging is theirs until they let go.
- In the world. Each other builder's camera with their name over it, the spot their pointer is on, and a tag over each thing someone is working on, above its own mark: its ring split between their colours (up to four), their names one under another, and what they're doing (Moving it, Configuring: and the tab of its page, Recording scripted driving event, or Working on it). A spot or an item spot someone is on turns their colour. What they place, move and remove shows in your world builder as they do it. What they have picked or are moving wears their colour: the box round an NPC or a vehicle, the outline round an object. Something they are moving is theirs until they let go.
- Recording a drive. While someone records a Scripted Driving Event, the others see the vehicle drive with the line it has driven behind it, in their colour, instead of its see-through copy. The line goes and the copy is back once they save, retry or discard.
- The map in the world builder shows each other builder as an arrow in their colour with their name: their camera while they build, else where they stand, and the vehicle whose drive they're recording.
- Undo takes back your own changes, never someone else's.
- The same field changed by two builders at once keeps the later change, on every screen.
- Leaving. Changes nobody has saved stay with the scenario for the others. When the last builder leaves without saving, they are kept for 30 minutes, so opening it again brings them back.
- Coming back. There is only ever the one scenario. Whatever the others changed or saved while you were away is what you come back to; anything of yours that hadn't reached them yet is added on top.
- Testing. With others in, Test asks first. Isolate & Test Alone tests it for you alone, in a world of your own. Offer other players to join asks each of them at the top of their screen. It starts by itself once everyone has answered and one has joined, or when you press Start test. Those who join test it together in a world of their own, one run, each with their own test map, while the rest keep building.
- A test plays the scenario as it was when it started. Changes the others make meanwhile wait: its players are told there are some, and F5 starts it again with them, for everyone in it. F9 takes only you out, back to the world you were in.
- Cards that need a permission can only be added or changed by a builder who has it, whoever saves.
Cards builders useServer owners
| Card | What it does |
|---|---|
| Dialog Line | An NPC's line with answers. Each answer can have rules: offered only if (an item, cash, a player flag, a variable), a cost, once a run or once ever, and a chance rolled on the server (a miss goes out of Answer N failed) |
| Multiple Choice | A question with up to four answers on the player's screen, with no NPC: "Shots inside: go in, or stay in the car?" The keys and the answer rules are a Dialog Line's, and each answer is its own outcome. It waits while the player is talking to someone or is down, and the inventory or phone only hides it until they close it |
| Sell to NPC · Haggle | The NPC buys an item at a price. Haggle agrees a price and moves no money: wire Deal to Sell to NPC, Pay or Take Item |
| Goal cards | Show Objective, Show Blip, the wait and Clear Objective in one: Go To, Deliver the Vehicle, Kill Them All, Collect, Bring Item To, Steal the Vehicle, Search, Speak To, Survive |
| Set Player Flag · If Player Flag | Remember something about the player for good (Player flags), and branch on it |
| Claim Vehicle · Give Vehicle | The run's vehicle made the player's own (ClaimVehicle), or a new vehicle of their own |
| Force Player(s) Change Vehicle Seat | For each seat of the run's vehicle, where its player goes: "If in Driver, move to…" lists that model's other seats. The run's players move as if they picked the seat on the wheel's Seats page. Players who swap seats go one after another, through a free seat. A seat held by someone who stays (an NPC, or a player whose seat is set to Stay) isn't freed for them, and the card goes out of Not all moved |
| Fire Weapon | Remote Control Firearms (firearms placed from the world builder's More, a rifle until you change its Gun) fire real shots that hurt, every one picked at once, in a Test too |
| Play on Speakers · Stop Speakers | Props play a song from a Fivemanage link, in step, heard through walls like a voice, until stopped or the run ends (Speakers) |
| Send Signal · Wait for Script Event | Talk to your scripts (For other resources) |
| Phone Call · Lore Says | A lore character phones a player or speaks (Lore phone calls, Lore characters speak) |
Others give items, take money, show objectives and clocks, put up props, open menus and move NPCs. A card that waits on the server gives up out of Took too long.
What a run hands out#
In a live run, items are real: what Give Item, Drop Item and Put in Vehicle hand out, a heist's loot and a run vehicle's keys are the player's to keep. A Test marks everything it hands out and takes it back when it ends, from its players and the ground (a test's items).
- Run tags. An item one of a live run's cards looks for (Item Picked Up, Take Item, Collect, Bring Item To) carries a plain tag naming the run, so the run can tell its own package from anyone else's. Nothing else reads it, and it stays on the item.
- A Test changes nothing that lasts. Costs, sales, Charge Player, Claim Vehicle and Give Vehicle are only said; flags it sets live on the test run alone; Send Signal sends nothing.
NPCs, vehicles and propsServer owners
Configure opens a thing's page, with these tabs among others:
- Outfit. What an NPC wears, part by part. A freemode NPC (
mp_m_freemode_01,mp_f_freemode_01) can open the players' character editor instead. - Tasks. What an NPC, vehicle or prop does, top to bottom: go somewhere, take cover, shoot, drive, sound a siren, slide. Start Tasks starts them when it is reached; a spawn card can start them as it makes them instead (its Start their tasks, off by default). Play Tasks previews them on your screen only. A task's time (For, Gives up after) is hours, minutes and seconds, to a tenth. 0 is no end: the task goes on until its list is stopped or the run ends, and a new Shoot At, Aim At, Look At, Wander, Follow, Run Away From, fight, Play Emote, Cruise Around, Follow in a Vehicle or Writhe starts there. A task that does one thing (Throw, Turn To Face, Sound the Horn, Flash the Lights, Brake, Speed Up To, and a prop's Slide To, Turn To and Fade) lasts its time, and its 0 is at once. A task that waits to be done gives up after its time; 0 is never.
- Stages. + Stage cuts a list into stages that start at different moments of the run: the tasks above the first Stage are stage 1, and each Stage holds the tasks under it, up to the next. A Start Tasks card's Which stage picks one by its name (nothing picked: stage 1; a spawn card's Start their tasks plays stage 1 too). Open a stage (click its name) for a + Task that adds to the end of that stage. A stage ends at its last task, and the NPC keeps where it got to until the next one starts. Ended in a vehicle, it stays in it until a task gets it out (Get Out, Go To) or the vehicle's Everyone Out. Play Tasks plays every stage, one after the other.
- Takes. Drives you record, up to three minutes, played back exactly by Play Scripted Driving Event, trailers included. One card can play several vehicles from the same moment (a race, a chase): pick a vehicle and its driving event, then Add another vehicle. If any of them can't play, none does. Ride along puts the player at the wheel of the first. A vehicle its tasks froze plays the drive unfrozen and is frozen again after it, unless a Freeze since says otherwise or its driver drives on.
- Where a take starts. A take plays from wherever the vehicle is when it starts, if that's within 50 m of where it was recorded from. Over its first 2 seconds the vehicle slides onto the recorded line as it drives, rather than jumping to it. Further away, it doesn't play: the card goes out of Could not, and a vehicle's own Play a Scripted Driving Event task is skipped. To record from somewhere other than where the vehicle spawns (a bay it will be parked in by then), place its Scripted drive start point on the same tab: a fainter copy of the vehicle in the world builder, where recordings start from. A vehicle that tows records with its trailer placed behind the start point, the way it is placed behind the vehicle.
- Eye sight. A guard notices the run's players in its cone, with nothing in between, as a meter fills (by default 2 s up close, 8 s at its full distance; sneaking halves the distance). Then Guard Spots You goes on. The server works out the cone and meter.
Interaction points (More, Interaction Point) are what Wait for Press puts up for players to press. Each one's page sets its Interaction Text and icon, its size, how far it's seen and pressed from, whether it faces the player or stays locked as placed (turned with it, leaning back on a table), and whether it's gone once pressed until the next run. Place and turn it in the world builder like any other thing; while it's selected there it shows as it looks up close. An Interaction Menu on a point takes its place and look, with the menu's own words.
Routes (More, Route) are points an NPC walks with its Walk a Route task. Props have Physics on unless switched to static; a static one is made by each player's game (ShowPropSet). Config.ExperimentalDriveSync (off by default) has every game play recorded drives itself, smooth on every screen. /npcdebug shows each NPC's and vehicle's task.
Dungeon ModeServer owners#
The world builder with no scenario: what a Dungeon Master (director.live) makes goes into the live world, for everyone, with nothing to save. Open it from /whip → Director → Dungeon Mode → Start Dungeon Mode, or the Dungeon Mode row under Panels in /w (full admins).
- Put down props, NPCs, vehicles or a Remote Control Firearm (a gun as a prop). Click one of yours to move it, open its Options (an NPC attacks, follows or guards; a Remote Control Firearm fires) or Remove it.
- Click a player for Spawn a vehicle for them (its key in their pocket) and Send NPCs after them, or anything else for the Object Viewer's options.
- Vehicles are made unlocked with no key; their Dungeon vehicle options set where the key is, Locked and Only its key opens it.
- The map's own props, once changed, are hidden on every game until a restart, with Put back on the Dungeon Mode page.
What you make stays until a restart or until you remove it. It's yours by account, so it stays when you log off; only you or a full admin removes it. One account may have 150 things and 20 effects up at once; everyone together, 600 and 80. Everything is logged on the activity log as dungeon_mode.