Esc to clear, Enter to open the best match, click an export to open it in its page
Interactions & UI

Interactions

Everything a player does with E, a car part's prompt or the F1 wheel is one client call: AddAction. Server code adds prompts with AddPoint and NPC conversations with StartConversation.

A first prompt#

Declare actions in Whip.register, so they come back when whip_core restarts. An action is yours by id: the same id again replaces it, and it goes when your resource stops.

Whip.register(function()
    Whip.core:AddAction({
        id = 'stash',
        at = { coords = vector3(200.0, -800.0, 30.0) },
        label = 'Open Stash',
        onSelect = function(ctx)
            TriggerServerEvent('myres:openStash')   -- its own thread: waiting is fine
        end,
    })
end)

A prompt shows within Config.InteractVisibleRange (5 m) and works within Config.InteractActiveRange (2 m); E acts on the one nearest the centre of view, inside Config.InteractFocusCone (40°). Prompts hide while a screen or bar has the input, and while the player is dead or in a vehicle unless require says alive = false or vehicle = 'in'. Ground items, containers and doors make their own. Later examples show AddAction alone.

AddAction

AddAction(def)CLIENT#

Puts an action in the world. at says where; every other field reads the same wherever that is. "World prompts" below means every at but the wheel and car parts.

FieldTypeDescription
idstring?Yours: another resource's 'bench' is another action. Left out, one is made from the rest, the same every time
attableRequired. See at
labelstring | function(ctx)What it says; a function is asked at every draw, so it mustn't wait. The wheel needs one
iconstring?A glyph, or text drawn as is. On the wheel, no icon or text over 3 letters draws the label's first letter
imagestring | function(ctx)?World prompts: a picture above the label, a path under whip_core's html/ ('img/vehicles/<model>.webp') or a https://cfx-nui-<resource>/… URL
descriptionstring | function(ctx)?Wheel only: shown beside the name while aimed at. A function is asked as the wheel opens
requiretable?See require
canInteractfunction(ctx)?Your own rule on top of require: return true to offer it. Asked often; mustn't wait
onSelectfunction(ctx)Required, here or on each option (an option takes the nearest one above it; with none, F8 says so). Runs in its own thread, so it may wait
optionstable?See options
reachnumber?Metres to use it (default Config.InteractActiveRange). Match your server's distance check
seeFromnumber?World prompts: how far it appears. Clamped to Config.InteractVisibleRange (the default); raise that to go further
scalenumber?World prompts: size against other prompts (1.5, 0.75), 0.25 to 4
sizeRangenumber?World prompts: the distance its size is designed at (default its reach, so changing the reach resizes it; set the first reach here to stop that)
focusMode'aim' | 'near'World prompts: 'aim' (default) picks the one looked at, for things side by side; 'near' the closest in a wide cone, for a door or counter
onBlurfunction?World prompts: called when it stops being the one E acts on, to fold an opened menu
stylestring | table?World prompts: see Styles
holdMsnumber?World prompts: hold E (A on a pad) this long instead of a press (1500 to plant a charge); letting go, looking away or scrolling cancels. Per option too (0 is a press). Your server still checks it like any press
pressboolean | vector3 | table?World prompts and car parts: the hand reaches towards true (the prompt's point), a point, or { coords | offset, normal }, for looks only; onSelect runs at once. Too far, seated or no clips installed: a plain press. Per option too (false for one with its own animation). See PlayPress
firstboolean?vehiclePart: above the part's own options (Open Door, Lock), so E does it while canInteract says yes. Per option too
onGonefunction(ctx)?entity: called once the entity and the action have gone (ctx.id, ctx.owner); add it again from here
onFound, onLostfunction(ctx)?model: told as every prop of the model comes within 50 m and leaves (60 m, or gone), with ctx = { id, owner, entity, model, prop, coords }, each in its own thread. In onLost use ctx.coords
groupstring?For RemoveActionGroup
enabledboolean?false hides it
Returns: id, false, warnings, or false, reason, warnings (no at, an at naming nothing, no onSelect, a wheel entry with no label, an unknown require word). warnings lists what was wrong but not refused, or is nil; the false on success carries it through the export.
exports.whip_core:AddAction({
    id = 'bench',
    at = { coords = vector3(12.1, -1105.3, 29.8), heading = 90.0 },
    label = 'Weapon Bench', icon = 'store',
    require = { job = 'gunsmith', item = 'toolkit' },
    onSelect = function(ctx) TriggerServerEvent('mygunsmith:openBench') end,
})
Misspellings are warned about, not refused. An unknown field (lable, canUse), a wrong type or an out-of-range number is reported in F8 with its likely meaning, then left out or clamped; so is a field the place doesn't read. Only require is strict. ox_target's and qb-target's distance is read as reach.

at: where it lives#

atWhat it is
{ coords = vector3, heading? }A prompt at a point. With heading it stands like a sign (not drawn from behind); without, it faces you. follow = function() return x, y, z, heading end moves it
{ entity = handle, offset?, bone?, heading?, visualOffset?, radius? }On a local entity. Removed a few seconds after the entity goes (see onGone). offset is in the entity's own frame. heading stands it like a sign at that turn from the entity's facing, turning as it turns (180: on its back); without one it faces the player. For anything networked use netId
{ netId = n, offset?, bone?, heading?, visualOffset?, radius? }On a networked NPC or car, shown whenever it's streamed in, whatever its handle; nothing to re-add. The id can come from the server before it streams in
{ model = 'prop_vend_soda_01', offset?, heading?, visualOffset?, radius?, faces?, perModel? }On every prop of that model nearby (or a list of models), offered on the nearest, never from a car. offset: x across, y out of its face, z up. heading stands it like a sign at that turn from the prop's facing (try 0, 90, 180). faces = 2 for two-sided props. perModel = { ['prop_x'] = { offset, heading, visualOffset, radius } } overrides one model
{ vehiclePart = 'hood' }A choice on a car part: 'hood' (shown only while open; engine work goes here), 'trunk', 'door_dside_f', 'door_pside_f', 'door_dside_r', 'door_pside_r', or the Get On / Board prompt of a 'bike', 'bicycle' or 'boat'
{ radial = true }An F1 wheel entry with its icon and label, sorted by label. Aimed with mouse or stick, then click or A
{ aimBox = 'vehicle' | 'object' | 'ped' | 'world', aimModels?, offset?, heading?, visualOffset?, radius? }Where the player looks on the car, prop or person (or a list of kinds) within reach, on its bounding box (or body, for a helicopter's rotor span); a wall in front hides it. An offset moves the prompt on the entity. Set a radius to aim at the offset point independently. 'world' is the map itself: ctx.entity is nil, ctx.world true, ctx.normal the surface's facing, and a car or prop in front wins. aimModels = { 'prop_dumpster_01a', … } (names or hashes): offered only on those models, checked before your canInteract is asked
{ list = 'atm:balance' }Options added to another prompt's list, right after one of its options, named '<prompt group>:<option id>': 'atm:balance' scrolls them in under the ATM's Check Balance. Every list holding that option gets them, on every prompt of that group (a submenu without it does not). If no prompt of that group has the option, F8 says so once, a few seconds after the group's prompts appear: check the name. ctx.entity / ctx.model: the prop that prompt is on. label and icon are read as the list is built; require and canInteract every frame
An aimBox casts a ray every frame. Add it only while it means something (a rope in hand, an officer on duty) and remove it after.

Entity offsets and model defaults#

at.offset also works with aimBox. It fixes the prompt at a point measured in metres from the entity's origin along its local X/Y/Z axes. Moving or turning the entity moves the prompt with it. at.heading is a yaw from the entity's facing and makes an upright sign; without a heading, a fixed offset faces the camera. Set heading = false to face the camera even when the model has a default heading. An aimed prompt without an offset or default keeps its usual surface placement. Map-only hits have no entity and ignore these fields. A named bone still takes precedence over an offset.

The point is usable where it is drawn. Set radius to opt in to aiming at the point, with values from 0.01 to 5.0 metres. An offset alone keeps the usual targeting behavior. Invalid offset and visualOffset values are ignored. You do not have to hit the prop first. reach still limits the player's distance to the point. Both the camera and player must have a clear line to it: walls, vehicles, peds and the target's own collision can block it. Put points just outside a solid surface, not inside it. A radius without an offset targets the entity origin, or its named bone.

at.visualOffset moves only the label, measured from the interaction point along the entity's local X/Y/Z axes. Aim, reach and ctx.coords stay at the interaction point. For example, visualOffset = vector3(0, 0, 0.2) raises the label by 20 cm without raising the usable point. A zero vector overrides a model's visual offset. These fields belong to client AddAction; they are not extra fields for zones or server AddPoint.

Nearby aimed-entity candidates are discovered every 500 ms, and obstruction checks are reused for up to 100 ms while displaying a point. Pressing E, completing a hold or submitting input checks reach, aim and obstruction again. Drawing and movement stay per-frame. Actions without point placement keep their existing targeting path.

exports.whip_core:AddAction({
    id = 'mic',
    at = { entity = microphone, offset = vector3(0.0, -0.08, 1.2),
           visualOffset = vector3(0.0, 0.0, 0.2), radius = 0.25, heading = 180.0 },
    label = 'Use microphone',
    onSelect = function(ctx) useMicrophone(ctx.entity) end,
})

For a housing shell, register separate actions with unique ids on the same entity (or network id). Each has its own offset, such as a door, wardrobe and stash. They all follow the shell's position and rotation. Use explicit offsets for these separate points; a model default is only one fallback placement per model.

Config.PropPromptDefaultOffset supplies defaults by model name (numeric hashes also work). These apply to entity, network-entity, model and aimed-entity actions. Explicit action fields win, including a zero offset; perModel wins over the action's fields. Built-in prop prompts keep their own explicit placements and use this table before their generic fallback. The table accepts offset, heading, visualOffset and radius. Restart the resource after editing the table.

Config.PropPromptDefaultOffset = {
    ['sf_prop_impact_driver_01a'] = { offset = vector3(0.0, 0.0, 0.5563), heading = false },
}

Place it visually: enable developer mode with /w, look at an entity and run /promptoffset, or choose Prompt offset in the Object Viewer. If you are not looking at an entity, the command uses the nearest prop within 20 m of you. It searches only when opened. Drag the arrows to move the preview, press R to rotate its heading, hold right mouse to fly the camera, and press H to switch between a sign and facing the camera. Press V to switch the gizmo between the interaction point and label position. Up/Down adjusts the radius by 0.05 m; the blue sphere shows the aim area. Print & Exit prints the offset, visual offset, radius and heading as script fields, and a model-default entry without the radius (a default radius makes every prompt on that model need a precise aim), in F8. It does not use the clipboard. Esc cancels. Only an invisible local marker moves; the original entity and config are not changed.

require: who may use it#

Every key given must pass. The client uses it to decide what to offer, so check again on the server. Any other key (a door's jobs) refuses the whole action.

KeyExamplePasses when
alivealive = falseAlso offered to the downed (by default, nobody downed is)
vehicle'in' / 'out'In a vehicle / on foot. World prompts default to on foot; the wheel to either
job'police' or { 'police', 'ems' }A role at one of these jobs (key or jobId)
onDutytrue…on duty there; with no job, anywhere
jobPermission'canManage'…with this permission; with no job, at any job
item'toolkit', { item = 'lockpick', count = 2 }, { 'toolkit', 'gloves' }Carrying all of them
held'jerry_can' or a listThe item in hand is one of these (SetHeldItem)
zone'mrpd' or a listStanding in one of these zones
charId12 or a listOne of these characters
ace'whip.devtools'Holds this ACE (asked once, then remembered)

A vehiclePart action refuses alive = false and vehicle = 'in': it's always used on foot and alive.

require is free; canInteract isn't. World prompts cache canInteract results for 500 ms while the context stays the same. A different entity or other context change rechecks immediately, and selection always checks again. Custom conditions can take up to half a second to show or hide a prompt; drawing and built-in requirements continue updating. Say what you can with require, checked first, and for a state only you know, add the action while it holds and remove it after.

ctx: what your functions get#

label, canInteract and onSelect get one table; only onSelect's has the functions.

FieldDescription
id, owner, optionYour action's id, your resource, and which option
underIn a menu: the option it was chosen under ('repair'); nil at the top
entity, coordsThe entity aimed at, ridden or the part's car (nil for aimBox = 'world'), and the prompt's point
model, face, propat = { model }: model name, face (1, or 2), and the prop's id
playerOn a person who is a real player: { serverId, playerIdx, activeJob, isDead }; nil for an NPC. Name: GetPlayerFullName(ctx.player.serverId)
flash(r, g, b), status(text, ms), refuse(why)Tint the prompt, say something on it, or flash amber with a reason (a notification off world prompts)
beginInput(opts), cancelInput(), inputText()See typing into a prompt
typedWhat's typed so far with a caret, or false, for your label
exports.whip_core:AddAction({
    id = 'frisk', at = { aimBox = 'ped' }, label = 'Frisk', reach = 2.0,
    require = { job = 'police', onDuty = true },
    canInteract = function(ctx) return ctx.player ~= nil and not ctx.player.isDead end,
    onSelect = function(ctx) TriggerServerEvent('police:frisk', ctx.player.serverId) end,
})

options: several choices on one action#

Each option has its own id, label, icon, image, description, require, canInteract and onSelect, and takes the action's for what it leaves out. A world prompt shows them as a stack the player scrolls; the wheel, as entries.

exports.whip_core:AddAction({
    id = 'counter', at = { coords = vector3(25.7, -1346.7, 29.5) }, icon = 'store',
    options = {
        { id = 'buy', label = 'Buy', onSelect = function() TriggerServerEvent('shop:buy') end },
        { id = 'stock', label = 'Restock', require = { job = 'shopkeep', onDuty = true },
          onSelect = function() TriggerServerEvent('shop:restock') end },
    },
})
An option's require and canInteract add to the action's. An option can only narrow who sees it. The exception is alive: the option's own wins, else the action's.

Menus#

On a world prompt, an option can have options of its own, any levels deep. Its label gets a ›, and choosing it shows them on the same prompt with a Back; pressing one, or looking away, folds back. A nested option must also pass every option above it and takes what it leaves out from them; ids need only differ within one menu. Car parts and the wheel have no menus (F8 warns, and leaves them out).

options = {
    { id = 'repair', label = 'Repair', options = {
        { id = 'engine', label = 'Engine', onSelect = function() TriggerServerEvent('mech:fix', 'engine') end },
        { id = 'body', label = 'Body', onSelect = function() TriggerServerEvent('mech:fix', 'body') end },
    } },
    { id = 'wash', label = 'Wash', onSelect = function() TriggerServerEvent('mech:wash') end },
}

A menu whose options depend on the player (the cars they own, the orders waiting for them) is filled when it opens: give options a function returning the list. It's called each time the menu opens, with the same ctx as onSelect, in a thread of its own, so it can wait for a server callback. The prompt shows "One moment…" until it returns and "Nothing here" for an empty list. What it returns is read like any options, menus of either kind included. Going Back to a filled menu shows the list it had, without asking again.

An option with stay = true keeps the prompt on its menu after onSelect, instead of folding back to the top, and a filled menu is filled again once onSelect has finished. Use it for something a player may press twice, or that changes what the menu shows.

{ id = 'orders', label = 'My orders', options = function(ctx)
    local orders = exports.whip_core:Callback('mycafe:myOrders') or {}
    local list = {}
    for _, o in ipairs(orders) do
        list[#list + 1] = { id = 'order' .. o.id, label = o.name, stay = true, onSelect = function()
            exports.whip_core:Callback('mycafe:collect', o.id)
        end }
    end
    return list
end }

Changing and removing actions

UpdateAction(id, patch)CLIENT#

Lays patch over one of your actions; an at in it replaces the old one whole. A refused change leaves it as it was.

Returns: true, false, warnings, or false, reason, warnings
SetActionStyle(id, style)CLIENT#

Restyles one of your world prompts in place, without fading or losing its place, so it can turn red as a timer runs out. style is a name, a table or nil for the default.

Returns: true, false, warnings, or false, reason
RemoveAction(id)CLIENT#

Takes out one of your actions; another resource's is refused.

Returns: true, or false, reason
RemoveActionGroup(group)CLIENT#

Takes out all your actions in a group, not another resource's of the same name.

Returns: true, count, or false, reason
GetAction(id)CLIENT#

One of your actions as data, with whether each option is offered to this player now and why not. The first thing to check when an action never shows.

Returns: { id, owner, key, group, reach, seeFrom, enabled, at, label, icon, mounted, engineIds, options = { { id, label, offered, why } } } or nil. mounted: 'prompt', 'aimbox', 'props', 'radial', 'part', 'list', or false if it failed (F8 says why)
for _, opt in ipairs((exports.whip_core:GetAction('bench') or {}).options or {}) do
    print(opt.id, opt.offered, opt.why)
end

The hand: press and held props#

Put a torch or clipboard in a player's hand with HoldProps from your server, never your own CreateObject and attach, so everyone sees it in the hand. The hand holds one set, shared with WHIP's own (an emote's cup, a progress bar's tool), and a new set replaces the old. Yours go when your resource stops, and whip_core:heldProps:lost says why when yours leave without you asking.

PlayPress(target, opts)CLIENT#

The player's hand reaches out to a point and back, for looks only: it never moves the player or takes control. It returns at once, so do the real thing yourself, before or after.

ParamTypeDescription
targetvector3 | tableA point, or { entity, offset?, bone? }
opts.normalvector3?The surface's facing: the hand stops where it meets it. Pass one for walls, doors and panels
opts.onContactfunction?Runs once as the hand arrives, or as a press is cut short (a ragdoll, a car, an emote). Never when it returns false
Returns: true, or false, why: 'off' (disabled, too far, seated, falling, swimming, aiming, already against the surface, or no animation reaches), 'busy', 'dead'
ringTheBell()
exports.whip_core:PlayPress(vector3(x, y, z), { normal = vector3(0, -1, 0) })
Server owners. Config.InteractPress: enabled (Hand press in /whip → Settings → Config), maxDistance (2.5 m), followHand. Picking up from the ground always plays GTA's own grab.
HoldProps(source, props, tag)SERVER#

Puts props in a player's hand for everyone. At most one new set a second per player; faster calls wait, and only the newest is made.

ParamTypeDescription
sourcenumberThe player
propstable[]One or two { model, bone?, offset? = { x, y, z }, rot? = { x, y, z } }; bone defaults to the left hand (18905)
tagstring?Default 'held', kept as '<resource>:<tag>'
Returns: true, or false, why
exports.whip_core:HoldProps(source, { { model = 'prop_cs_police_torch', offset = { 0.1, 0.0, 0.0 } } }, 'torch')
DropHeldProps(source, tag)SERVER#

Takes your props of tag, or all of yours, out of the player's hand. Never anyone else's.

Returns: true, or false, why when they held none of yours
GetHeldPropsTag(source)SERVER#

What the hands hold or are about to: '<resource>:<tag>', WHIP's 'emote', 'bar', 'give', 'take', or nil.

Returns: string|nil
GetOwnHeldProp(model, tag) · DropOwnHeldProp(model, tag) · SetOwnHeldPropPose(model, tag, pose)CLIENT#

Your held prop (your tag, its model) on this player's game, while it holds it. GetOwnHeldProp returns its entity; DropOwnHeldProp lets go here at once (still tell your server's DropHeldProps); SetOwnHeldPropPose sets another grip for a while, pose = { bone?, offset = { x, y, z }, rot = { x, y, z } }, or nil for the server's.

Returns: entity|nil; the other two boolean, whether it was done
AimDot(on)CLIENT#

true shows the aim dot while you aim something that isn't a weapon, false after (weapons get it from Config.AimDot). Removed if your resource stops.

Returns: nothing

Typing into a prompt#

A world prompt can ask for a value: start it from onSelect with ctx.beginInput. The prompt steps aside, and what stands in its place depends on what the player is holding:

Both stand where the prompt was, facing the player, and stay there while they look round. Picking up a pad or putting it down while typing swaps them, keeping what was typed. By default the value is a number (digits only, no leading zero); numeric = false takes any text.

exports.whip_core:AddAction({
    id = 'deposit', at = { coords = vector3(150.2, -1040.1, 29.4) }, icon = 'deposit', label = 'Deposit',
    onSelect = function(ctx)
        ctx.beginInput({
            max = 6,            -- most characters (default 9 for a number, 64 for text)
            prefix = '$', commas = true,   -- shown as $1,250
            onSubmit = function(text) TriggerServerEvent('bank:deposit', tonumber(text)) end,
            onCancel = function() end,   -- left, or replaced by another input
        })
    end,
})
optsTypeDescription
maxnumber?The most characters: default 9 for a number, 64 for text
numericboolean?true (default): digits only, the number pad on a controller. false: any text, the whole keyboard
titlestring?What is being typed, over the text. Default: the option's own words
prefixstring?Shown before the text, such as '$'
commasboolean?A number shown in groups of three (1,250); what onSubmit gets stays digits
placeholderstring?What shows until something is typed. Default 'Start typing'
valuestring?The text it starts with
onSubmitfunction(text)The value was given
onCancelfunction?It was left, the player walked off, or another input replaced it
onChangefunction(text)?Each change of the text

Styles#

A style sets a world prompt's size, colour, visibility and motion, by name or as a table. What it leaves out comes from its base, then 'default' (Config.Interact3D). WHIP ships subtle (smaller, hidden until in reach) and lively; server owners add styles in Config.Interact3D.styles and set every prompt under styles.default. WHIP's own prompts take one per group from groupStyles: doors, vehicles, ground_items, garages, containers, properties, conversation, atm, and actions for every AddAction and AddPoint. A prompt's own style wins; a misspelt one is warned about in F8.

style = 'subtle'
style = { base = 'subtle', badgeScale = 1.3, tint = '#ffc850', fadeMs = 250 }
FieldDescription
baseStart from this named style
badgeScale, labelScaleCircle or label size, 0.25 to 4, on top of scale
opacity{ seen = 0.35, inReach = 0.85, focused = 1.0 }; seen = 0 hides it until in reach
tint, labelTint'#ffc850' or { 255, 200, 80 }; white is no change
fadeMs, crossfadeMs, slideMs, appearMsFades (default 100), ring to key, stack slide, arrival (220), in ms
flash, flashMsThe ctx.flash answer: 'blink' (default) or 'fade', back to tint; flashMs defaults to Config.Interact3D.flashMs
gap, stackGap, stackAlpha, previewScaleSpacing, unselected-option alpha and picture size
cullBehindfalse draws a sign-like prompt from behind too
easing'smooth' (default), 'linear', 'out', 'inOut', 'back'; or fadeEasing, crossfadeEasing, slideEasing
appear, focus, idle, pressMotion: 'fade' (default) 'pop' 'slide' 'none'; 'none' 'pop' 'pulse'; 'none' 'pulse' 'bob'; 'none' 'pop'
labelWeight, labelOutline, labelOutlineColour, labelCase, labelShadow400–800 (700); width 0–8 (3); colour (black); 'upper' or 'none'; false removes it
theme'keycap', 'classic', 'glass', 'rim' or 'dot'. Left out, the player's Prompt shape setting in the pause menu's Map & HUD (default Config.Interact3D.theme)
darkBlack and white swapped. Left out, the player's Dark prompts setting (default Config.Interact3D.dark)

Glyphs#

lock unlock lockpick door hood_closed hood_open trunk_closed trunk_open trunk_lid garage car store turbo furnish house pickup bank deposit withdraw back fuel nozzle cash talk phone bag emote id power headlights seat devtools place give eat respawn objective target pin star timer, and mfr_<brand> for a car maker's badge. Other text is drawn as is ('$'). The default, 'E', shows the player's Interact key, or A on a pad.

Points from the server: AddPoint#

A prompt your server adds while it runs (a Talk on an NPC, a hand-in spot), for everyone or named players. Pressing it runs onUse on the server after WHIP checks distance, audience and requirements. It's gone when your resource stops, and isn't saved.

AddPoint(def)SERVER#

Adds a prompt from the server.

FieldTypeDescription
attable{ coords, heading?, tilt? } (a heading stands it like a sign; tilt leans that sign back, in degrees: 90 lies face up on a table); { netId, offset?, bone? } (while each game has it); { vehicle = id | { plate }, offset?, bone? } (a WHIP car while it's out); { ground = groundItemId, offset? } (until picked up); or { container = containerId, offset? }. On a car, pile or container it sits above their own prompts
label, iconstring?Text and glyph
optionstable?Up to 6 { id, label?, icon?, require?, reach?, options? }; none means use.option = 'default'. An option's reach (0.5–25 m) is its own: the prompt reaches as far as the furthest option, and a nearer one shows (and is accepted) only within its own, so on foot at 2.5 m and from the car at 7 m share one point. A menu's reach goes to its options unless they give theirs. Nested options make a menu with a Back: 3 deep, 6 a level, 40 in all. Only a leaf is pressed, named by use.path ('tools/hack/firewall'), and the server checks every require on the path. What a menu requires, its options and Back need too
requiretable?AddAction's words, checked again on the server. An unknown word is refused; a zone must be a saved one
audiencetable|'everyone'?{ people = { serverId | { charId = n } } }: only they see and use it. Default 'everyone'
reach, seeFrom, focusMode, enabled, style, holdMs, scale?As AddAction's (scale: its size, 0.25–4); false clears style, holdMs or scale. In a menu only leaves are held. A hold is the player's game asking: onUse is still the check
talkboolean?A Talk on its NPC (icon talk). While the NPC talks to someone else it shows Config.Conversations.speakingText; while disabled, busyText. Pressing it then only says so again
quietForaudience?With talk: who sees nothing, not "busy", while it's disabled
tagstring?Your run tag (ReleaseTag)
onUsefunction(source, use)use = { pointId, option, path, useId, coords, netId }. Return false, 'why' to refuse; the player is told why. Keep it quick: start a thread for slow work
Returns: pointId, false, warnings, or false, reason, warnings: warnings lists unknown fields (onSelect, lable) and a clamped reach or seeFrom, also in the server console; a wrong value is refused. Also UpdatePoint(pointId, patch) (false clears a field; the tag stays), RemovePoint(pointId), GetPoints({ tag }).
local pointId = exports.whip_core:AddPoint({
    at = { netId = npcNetId, offset = vector3(0.0, 0.0, 0.3) },
    label = 'Talk',
    options = { { id = 'work', label = 'Got work?' }, { id = 'bye', label = 'Leave' } },
    audience = { people = { source } },
    tag = 'run:42',
    onUse = function(source, use)
        if use.option == 'work' then StartJob(source) end
    end,
})

Conversations: StartConversation#

An NPC talks and the player picks one of up to four answers in the dialog capsule: the scroll wheel and E, or the number key shown beside the answer (the hotbar keys, 1 to 4 by default); on a controller the D-pad and A. It opens only from a point's onUse, or with screen = true whenever you call it, and the server checks each answer before onChoose hears it. It ends when you end it, an ends answer is chosen, the player leaves, opens a screen, goes down or logs out, or the NPC dies, goes or turns hostile. Others nearby see it as /me bubbles (Config.Conversations.watcherBubbles).

StartConversation(source, spec)SERVER#

Opens a conversation for the player who pressed your point; a new one replaces theirs.

FieldTypeDescription
fromUsenumberuse.useId, within 10 s. A point on an NPC opens only with that NPC
npcId / netIdnumberThe speaker: a living SpawnNpc NPC or a networked entity
speaker, linestringName, and what they say (440 characters at most)
optionstable1 to 4 { id, label, ends?, input?, cost? }. input = { min, max, prefix }: the answer becomes a field for an amount, checked against min and max (Backspace on an empty field goes back). cost = { amount, currency?, method?, reason? }: charged like ChargePlayer before onChoose (method auto/cash/bank, or currency an item key); unpaid, it's refused with the reason and the answers stay up
nexttable?{ [answerId] = { line, options } }: replies sent ahead. Without one the capsule dims until UpdateConversation (15 s, then it ends). A costed answer's reply waits for payment
layout'grid'|'stack'?2x2 grid (default) or a column
screenboolean?true: on the player's screen at the bottom centre, with no speaker (the Director's Multiple Choice). Leave out fromUse, npcId and netId. It takes a line and its answers, with no input. Walking away doesn't end it, and a screen the player opens only hides it until they close it
onChoosefunction(source, answerId, convId, amount)?A checked (and paid) answer; amount for input
canChoosefunction(source, answerId, convId)?Return false, 'why' to refuse an answer before it's taken or paid
onEndfunction(source, why)?'ended', 'chose', 'left', 'blocked', 'downed', 'logout', 'killed', 'gone', 'hostile', 'no answer', 'replaced', 'released', 'stopped'
tagstring?Your run tag
Returns: convId, or false, reason. Also UpdateConversation(convId, { line, options, next, speaker, canChoose }) (canChoose = false removes it), EndConversation(convId), GetConversation(convId).
onUse = function(source, use)
    exports.whip_core:StartConversation(source, {
        fromUse = use.useId, npcId = npcId, speaker = 'Fence', line = 'Got the goods?',
        options = { { id = 'yes', label = 'Here.' }, { id = 'bye', label = 'Leave', ends = true } },
        next = { yes = { line = 'Let me see.', options = { { id = 'deal', label = 'Deal?' } } } },
        onChoose = function(source, answer, convId)
            if answer == 'deal' then PayFor(source); exports.whip_core:EndConversation(convId) end
        end,
    })
end

Good to know