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.