Vivum Target

Types

Learn about the type definitions of Vivum Target

@class Menu
FieldTypeDescription
name?

string

A unique name for the menu. If not specified, the name will be set to the generated id.

target

{ position?: vector3, box?: BoxTarget, poly?: PolyTarget, circle?: CircleTarget, entity?: EntityTarget, global?: GlobalTarget }

The type of target to render. Specify one of the target types.

items?

Item[] | fun(entity: number): Item[]

A table of items or a function that returns a table of items every ≈100ms.

canInteract?

fun(entity?: number): boolean

hideOnInteract?

boolean

Override the default behavior of Config.HideOnAction for this specific menu.

action?

fun(menu: Menu, entity?: number, coords: vector3, distance: number): nil

If the menu has no items, this can be used to perform a callback when clicking the menu star itself. The returned value will be used to determine whether the menu should be hidden after the action is performed.

stateful?

boolean

Marks the target as stateful, meaning that if stateful is set to false, it will not render the inner star cicle, however if it's set to true it'll render a larger star (as defined in Config.Graphics.Star.StateSize)

icon?

string | MenuIconTexture

The favicon to display at the center of the star. A texture object can be specified to render a specific ingame texture (like that of a ped headshot).

tooltip?

string

An optional help text to display over the target star. Will be hidden if the star is hovered.

linestrip?

Linestrip

Draws a linestrip from the center of the star to the specified point (vector or entity handle).

uniqueKey?

string

Multiple targets with the same uniqueKey will only render the closest one.

seethrough?

boolean

If set to true, the target star will be rendered even if something is visually obstructing it.

distance?

number

Override maximum distance at which the target can be interacted with.

renderDistance?

number

Override render distance of the target.

scale?

number

Override overall scale of the target (i.e. the size of the target star and the size of the menu) This cannot be above 1, it is only possible to scale the menu down.

starScale?

number

Override only the size of the target star, and not the menu. This cannot be above 1, it is only possible to scale the star down.

starTint?

[number, number, number]

Set a tint (RGB) for the target star.

alwaysShowStar?

boolean

Show the target star even if the player is not holding down the interact keybind (Left Alt by default). This will cause Vivum Target to not be able to idle, making the CPU usage higher at all times.

alwaysInteracting?

boolean

Always have the target in a interactable (hovered) state. This can be used to make a general target for when a player is inside a vehicle, for example.

onUpdate?

fun(self: Menu): Menu

A callback that is called every ≈100ms to do additional calculations. Returning a new menu will replace the current menu (i.e. changing Menu.items or Menu.stateful).

compatibility?

CompatiblityType

The compatibility layer that was used when creating the target. Do not set this yourself.

Item

@class Item : EntityPositioner
FieldTypeDescription
label

string

name?

string

Optional name to reference the item by. Item.label will be used if not specified.

icon?

string | MenuIconTexture

The favicon to display left of the label. A texture object can be specified to render a specific ingame texture (like that of a ped headshot).

style?

"default" | "destructive" | "success" | "ghost"

The theming of the item. Any value specified in Config.Graphics.Menu.Styles will work.

action?

fun(menu: Menu, itemIndex: number, item: Item, coords: vector3, distance: number, entity?: number): boolean | nil

The returned value will be used to determine whether the menu should be hidden after the action is performed. If nil or true is returned, the menu will be hidden (If Config.HideOnAction is set to true), if false is returned it will ignore the Config.HideOnAction setting.

canInteract?

fun(entity?: number, coords: vector3, distance: number, name?: string, bone?: string | number | number[] | string[]): boolean

distance?

number

Override maximum distance at which the item can be interacted with.

EntityPositioner

@class EntityPositioner

Properties to position the target star at an entity's bone or offset. Only works on entity and global targets.

FieldTypeDescription
bone?

string | string[] | number | number[]

The bone name or bone index to position the star at. If multiple bones are specified, the first valid one will be used.

offset?

EntityOffset

The offset to apply to the star positioning (will be added after the bone position if specified)

allowEntityHovering?

boolean

If set to true, the entity can be hovered in addition to the detached star when used with positioning properties like bone or offset.

EntityOffset

@class EntityOffset
FieldTypeDescription
relative?

vector3

Offset relative to the entity, meaning X is left/right, Y is forward/backward, and Z is up/down.

absolute?

vector3

Offset in absolute world coordinates. Meaning that the offset will remain constant independent of the entity's rotation.

outwards?

vector3

The normalized difference between the entity coordinates and the offsets (bones, relative and absolute offsets). Skips the Z (up/down) component.

fn?

fun(ref: vector3): vector3

A function to mutate the offset with external logic. This function will be called every frame and as such must only be used in an integration in the vivum-target/integrations folder.

Linestrip

@class Linestrip
FieldTypeDescription
entity?

number

A handle to an entity to take the position from.

position?

vector3

The position to draw the linestrip to, this will be overriden if entity is specified.

offset?

vector3

Offset of the entity coords or specified position.

@class MenuIconTexture

Can be used to specify a ingame texture for the menu icon (e.g. a ped headshot).

FieldTypeDescription
txn

string

txd?

string

If not specified, the txd will be set to the same value as txn.

width?

number

Defaults to 1.

height?

number

Defaults to 1.

Target Types

Box Target

@class BoxTarget
FieldTypeDescription
center

vector3

size

vector3

rotation?

number

debug?

boolean

If true, draws a red debug box while interacting.

Poly Target

@class PolyTarget
FieldTypeDescription
points

vector3[]

height

number

debug?

boolean

If true, draws a red debug poly while interacting.

Circle Target

@class CircleTarget
FieldTypeDescription
center

vector3

radius

number

debug?

boolean

If true, draws a red debug sphere while interacting.

Entity Target

@class EntityTarget : EntityPositioner
FieldTypeDescription
handle

number

The entity handle.

Global Target

@alias GlobalTargetType "all" | "player" | "ped" | "vehicle" | "object"
FieldTypeDescription
CompatiblityType

CompatiblityType "ox" | "qb" | "q"

@class GlobalTarget : EntityPositioner
FieldTypeDescription
type

GlobalTargetType

model?

number | string

Optionally filter the global target with a model.

preserveLastEntity?

boolean

Keep rendering the target (will only be visible if the target has bone or offset specified) on the last entity that was raycasted.