Vivum Target
Types
Learn about the type definitions of Vivum Target
Menu Types
Menu
| @class Menu | ||
|---|---|---|
| Field | Type | Description |
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 |
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 |
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 |
seethrough? | boolean | If set to |
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 |
compatibility? | CompatiblityType | The compatibility layer that was used when creating the target. Do not set this yourself. |
Item
| @class Item : EntityPositioner | ||
|---|---|---|
| Field | Type | Description |
label | string | |
name? | string | Optional name to reference the item by. |
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 |
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 |
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 | ||
|---|---|---|
| Field | Type | Description |
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 |
EntityOffset
| @class EntityOffset | ||
|---|---|---|
| Field | Type | Description |
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 |
Linestrip
| @class Linestrip | ||
|---|---|---|
| Field | Type | Description |
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 |
offset? | vector3 | Offset of the entity coords or specified position. |
MenuIconTexture
| @class MenuIconTexture Can be used to specify a ingame texture for the menu icon (e.g. a ped headshot). | ||
|---|---|---|
| Field | Type | Description |
txn | string | |
txd? | string | If not specified, the |
width? | number | Defaults to |
height? | number | Defaults to |
Target Types
Box Target
| @class BoxTarget | ||
|---|---|---|
| Field | Type | Description |
center | vector3 | |
size | vector3 | |
rotation? | number | |
debug? | boolean | If |
Poly Target
| @class PolyTarget | ||
|---|---|---|
| Field | Type | Description |
points | vector3[] | |
height | number | |
debug? | boolean | If |
Circle Target
| @class CircleTarget | ||
|---|---|---|
| Field | Type | Description |
center | vector3 | |
radius | number | |
debug? | boolean | If |
Entity Target
| @class EntityTarget : EntityPositioner | ||
|---|---|---|
| Field | Type | Description |
handle | number | The entity handle. |
Global Target
| @alias GlobalTargetType "all" | "player" | "ped" | "vehicle" | "object" | ||
|---|---|---|
| Field | Type | Description |
CompatiblityType | CompatiblityType "ox" | "qb" | "q" | |
| @class GlobalTarget : EntityPositioner | ||
|---|---|---|
| Field | Type | Description |
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 |