CORE
This piece of code is essentially a configuration for a game or simulation feature, tailored towards non-programmers:
At its core, the code defines a set of behaviors for non-player characters (NPCs), interaction distances, how inventory images are fetched, and customizing UI elements like fonts and markers.
Debugging NPCs: Initially, the code sets up a debug mode for NPCs, where you can toggle the visibility of NPCs' vision cones and measure the distance NPCs can 'speak' from to the player. If you wonder why an NPC isn't interacting as expected during testing, these settings help pinpoint the issue.
Interaction Method: It allows switching between using a targeting system or key-presses for interactions. If players find it hard to interact with objects or characters, toggling
UseTargetmight improve their experience.Inventory Images: It links to a URL for inventory icons, making it easy to update or change inventory images by simply replacing files at this web address. If new items are added, their icons need to be uploaded to this location.
Visual Markers and Fonts: The configuration enables custom markers and fonts for in-game UI elements, enhancing visual cues for interactions. If the game's aesthetic changes or there's a need for clearer text, adjusting these settings will be necessary.
Additional Features: There are placeholders for functionality like key giving and progress bars, which suggest areas of the game that might need custom implementation or integration with other systems. If there's a need to change how players get keys to vehicles or how progress is displayed, these sections of the code would be the focus.
In short, during the installation process, it's important to adjust settings like UseTarget, the URLs for inventory images, and EnableCustomFonts according to the game's specific needs or the feedback from beta testers. This ensures that interactions, visibility, and user interface elements align with the intended gameplay experience.
Core = {
debug = {
npcs = {
['ConeVision'] = false,
distSpeech = function (npc)
RegisterCommand("npcSpeech", function(source, args, rawCommand)
local playerCoords = GetEntityCoords(PlayerPedId())
local npcCoords = GetEntityCoords(npc)
local distance = #(playerCoords - npcCoords)
print(distance)
end, false)
end,
},
prints = true,
},
UseTarget = true, -- When set to true, it'll use targeting instead of key-presses to interact.
NoModelTargeting = true, -- When set to true and using Target, it'll spawn a small invisible prop so you can third-eye when no entity is defined.
InteractDistance = 2.0, -- Interaction Radius
RenderDistance = 100.0,
InventoryURL = 'https://cfx-nui-ox_inventory/web/images/',
InventoryFileExt = '.png',
Marker = { -- This will only be used if enabled, not using target, and no model is defined in the interaction.
enabled = true,
id = 2,
scale = 0.25,
color = {255, 255, 255, 127}
},
Fonts = {
EnableCustomFonts = true,
ForceUniqueFont = true, -- if you want use diferents custom fonts you need set on DrawMissionText like this "!gfx !f MissionAccomplished Deliver the ~b~vehicle~w~ to the warehouse !fx"
SelectedFont = "MissionAccomplished",
CustomFonts = {
"MissionAccomplished",
},
},
GiveKeys = function (veh)
print("GiveKeys method not implemented.")
end,
OxProgress = true,
ProgressBar = function()
print("if you are using other progress there is a example AND CHANGE Config.OxProgress to false into config file;")
print("exports['progressBars']:startUI(duration * 1000, message);")
end,
}Last updated