Skip to main content

๐Ÿ“Interaction Points

This document provides a comprehensive guide on how to set up and use the sky_interactionpoints script for your project.

Overviewโ€‹

The sky_interactionpoints script is designed to add interactive points within your game environment that trigger specific events when a player approaches them. This script allows server owners to define positions, display markers, spawn NPCs, show blips and customize interactions.

Configuration Structureโ€‹

The main configuration table is Config.InteractionPoints, which holds multiple interaction points, each defined by a unique identifier (e.g., "1", "2").

Example Configurationโ€‹

Config = {}

Config.InteractionPoints = {
["1"] = {
HelpText = "Use example interaction",
Position = {x = 107.78, y = -1083.22, z = 28.19},
Distance = 2.0,
Blip = {
showBlip = true,
name = "Example Interaction",
sprite = 835,
color = 47
},
Npc = {
useNpc = true,
modelOrHash = "mp_m_waremech_01", -- Refer to https://docs.fivem.net/docs/game-references/ped-models/ for model names
heading = 0.0
},
Marker = {
useMarker = false,
marker = {
type = 1,
offset = vector(0, 0, 0) -- Offset from the location coordinates
-- Additional properties can be configured from https://docs.fivem.net/natives/?_0x28477EC23D892089
}
},
Handler = function()
Sky.Show.Notification("Interaction", "Example Interaction", "success")
end
}
-- Add more interaction points by copying and pasting this structure and updating the values
}

Configuration Propertiesโ€‹

General Propertiesโ€‹

  • HelpText (string): The text displayed when the player approaches the interaction point. Help notification can be customized in sky_base/config/functions.lua
  • Position (table): The x, y, z coordinates defining the location of the interaction point.
  • Distance (number): The radius within which the interaction point is usable.

Blip Configuration (Blip)โ€‹

  • showBlip (boolean): Whether or not to display a blip on the map.
  • name (string): The name of the blip.
  • sprite (number): The icon used for the blip. Refer to blip sprites documentation for available options.
  • color (number): The color of the blip.

NPC Configuration (Npc)โ€‹

  • useNpc (boolean): Determines if an NPC should be spawned at the interaction point.
  • modelOrHash (string/number): The model or hash of the NPC. Refer to ped models for valid values.
  • heading (number): The direction the NPC faces.

Marker Configuration (Marker)โ€‹

  • useMarker (boolean): Indicates if a marker should be shown at the interaction point.
  • marker (table):
    • type (number): The type of marker to display.
    • offset (vector): The offset of the marker from the main coordinates.
    • Additional properties can be used from the marker native documentation.

Interaction Handler (Handler)โ€‹

  • Handler (function): A function triggered when a player interacts with the point. This function can be customized to run any logic, such as open other script ui's or triggering game events.

Extending the Scriptโ€‹

To add more interaction points:

  1. Copy the existing structure inside Config.InteractionPoints.
  2. Change the key (e.g., "2", "3").
  3. Update the properties as needed.

Conclusionโ€‹

The interactionpoints script provides a flexible and powerful way to create interactive experiences within your game. Customize each point with unique positions, NPCs, markers, and handlers to enhance gameplay.