README
The following resources are required for
nss_quest
to work:- 1.Ensure that the
nss_quest
folder is in yourresources
folder. - 2.
- 3.
- 4.Execute
db.sql
on your database. - 5.Add
ensure nss_quest
to yourserver.cfg
. - 6.Restart your server.
- 1.
- 2.Copy the following blueprint code into the file to create the basic quest. Adjust it to your needs.local step1 = {id = "start", -- Unique quest id, only "a-zA-Z0-9_-" are allowedname = "Helping hand...", -- Step name, will be shown in the quest dialogbtn_text = "Pickup the letter", -- Button text for the promptlocation = {coords = { x = 0, y = 0, z = 0 }, -- Location where the step should be triggeredradius = 2.0 -- Radius around the location where the step should be triggered},quest_text = "You found a letter on the floor.\n\n".. "The letter reads:\n\n".. "<em>Dear Sir,\n\n".. "I am in need of your help. I am hungry and I need you to help me.\n\n".. "Please meet me at the bank in Strawberry and bring 3 red berries.</em>\n\n",-- Rewards are optional, if you don't want rewards, remove the complete section.rewards = { -- In this case the rewards is used to give quest itemitems = {{ name = "quest_letter", count = 1 }, -- Ensure that the item exists in your database}},}local step2 = {id = "end", -- Important: Do not use the same id as in step1. Ids must be unique.name = "Your letter...",btn_text = "Deliver red berries",location = {coords = { x = 0, y = 0, z = 0 },radius = 2.0},quest_text = "You deliver the letter and the red berries to an old man.\n\n".. "He says:\n\n".. "<em>Thank you Sir,\n\n".. "The red berries are delicious. Here is a little something from me.</em>\n\n",-- Requirements are optional, if you don't want requirements, remove the complete section.requires = { -- In this case we require the player to have the quest item from previous step and 3 red berriesitems = {{name = "quest_letter",count = 1,remove = true -- Remove the item from the player inventory if the step is completed},{name = "red_berries",count = 3,remove = true-- Remove the item from the player inventory if the step is completed}},},-- Rewards are optional, if you don't want rewards, remove the complete section.rewards = {items = {{ name = "coal", count = 1 }, -- Gives the player 1 coal if the step is completed},money = {amount = 5, -- Gives the player 5$ in cash if the step is completed},},}MyQuest = { -- Do not use "local MyQuest" because the variable should be accessible in the config file.id = "my_quest", -- Unique quest id, only "a-zA-Z0-9_-" are allowedname = "My Quest", -- Quest name, will be shown in the promptmax_solves = 1, -- How many times can the quest be solved, 0 = infinitysteps = { step1, step2 } -- The steps of the quest}
- 3.Go into
config.lua
file and add your new questMyQuest
to theConfig.Quests
table.-- Example for only one questConfig.Quests = { MyQuest }-- Example for more questsConfig.Quests = {MyQuest,OtherQuest,AnotherQuest} - 4.Restart your server and test your quest. Tip: You can use
refresh
in the console to reload the resources without restarting the server. And after that userestart nss_quest
to reload the quest data.
New since version 1.2.0.
- 1.Add quest log item (see example below) to your inventory database:INSERT INTO ingame01.items (item, label, `limit`, can_remove, type, usable, `desc`, metadata)VALUES ('YOUR_QUEST_LOG_ITEM_NAME', 'Questlog', 1, 0, 'item_standard', 1, '', '{}');Important: Item should be configured as non-removable, usable and with a limit of 1.
- 2.Add
YOUR_QUEST_LOG_ITEM_NAME
toConfig.QuestLogItemName
property in the config file. - 3.Copy
html_quest/img/quest_log_item.png
tovorp_inventory/html/img/items/YOUR_QUEST_LOG_ITEM_NAME.png
(or use your own image). - 4.Note:
YOUR_QUEST_LOG_ITEM_NAME
is a placeholder, you can choose any name you want.
- id (text, required) The
id
is a unique identifier for the quest. Ensure that these id only exists one time only. The id is used to identify the quest in the config file and for internal programming things. Important: Onlya-zA-Z0-9
and-_
are allowed. - name (text, required) The
name
is the name of the quest. It will be shown in the prompt and quest dialog. - description (text, optional) The
description
is the internal description for the quest, e.g. like notes for the quest writers. It is currently not used and shown anywhere. - max_solves (number, required) A positive number limits the times a quest can be solved. A value of
0
means that the quest can be solved infinite times. - restart_delay_in_seconds (number, optional) A positive number (in seconds) adds a delay until the next start of the quest. A value of
0
means no delay. Note: Set max_solves to0
to allow infinite solves for daily quests. - steps (list, required) The
steps
is a list of all steps for the quest. The steps are executed in the order they are defined in the list. See Quest steps for more information.
- id (text, required) The
id
is a unique identifier for the quest step. Ensure that these id only exists one time only. Important: Onlya-zA-Z0-9
and-_
are allowed. - name (text, required) The
name
is the name of the quest step. It will be shown in the quest dialog. - description (text, optional) The
description
is the internal description for the quest step, e.g. like notes for the quest writers. It is currently not used and shown anywhere. - btn_text (text, required) The
btn_text
is the text for the button in the prompt. It will be shown in the prompt. - location (table, required) The
location
contains thecoords
andradius
for the quest step triggering point. Example:location = {coords = { x = -858.72, y = -1340.31, z = 44.43 },radius = 2.0}- coords (table, required) The
coords
is a list of thex
,y
andz
coordinates for the quest step triggering point. Example:coords = {x = -858.72,y = -1340.31,z = 44.43} - radius (number, required) The
radius
is the radius around thecoords
where the quest step should be triggered. Ensure a float (e.g.2.0
) and not an integer (e.g.2
) is given.
- quest_text (text, required) The
quest_text
is the text for the quest dialog. It will be shown in the quest dialog. Can contain HTML tags. - callback (function, optional) The
callback
is a function that is called when the quest step is started/accepted. It can be used to add custom logic like spawning a vehicle or giving weapons to the player. Important: The callback will be executed on server side. Example:---@param _source number @The player source (server player id)---@param step NssQuestStep @The current quest step (see configured step for possible properties)---@param char NssQuestCharacter @The character that accepted the questcallback = function(_source, step, char)print("Character properties", json.encode(char))end - requires (table, optional) The
requires
is a list of requirements for the quest step. The requirements are checked before the quest step is started/accepted.- items (table, optional) The
items
is a list of items that are required for the quest step. Ifremove
is set totrue
, the item will be removed from the player inventory if the quest step starts/ends.label
is optional and can be used to overwrite the item label in the quest dialog. Important: The item must exists in the database of the supported framework. Example:items = {{ name = "red_berries", count = 3, remove = true, label = "Custom label for item" },} - money (table, optional) The
money
is a list of money that are required for the quest step. Ifremove
is set totrue
, the money will be removed from the player inventory if the quest step starts/ends. Example:money = { amount = 5, remove = true } - completed_quests (list, optional) The
completed_quests
is a list of quests that are required for the quest step. Example:completed_quests = { "quest_id1" }
- rewards (table, optional) The
rewards
is a list of rewards for the quest step.- items (table, optional) The
items
is a list of rewards for the quest step.label
is optional and can be used to overwrite the item label in the quest dialog. Important: The item must exists in the database of the supported framework. Example:items = {{ name = "red_berries", count = 3, label = "Custom label for item" },} - money (table, optional) The
money
is a list of money as rewards for the quest step. Example:money = { amount = 5 }
- background_filename (text, optional) The
background_filename
is the filename of the background image for the quest dialog. The image must be located in thehtml_quest/img
folder. - padding_left / padding_top / padding_right / padding_bottom (number, optional) The
padding_left
,padding_top
,padding_right
andpadding_bottom
are the padding for the quest dialog. The padding is used to move the quest content inside the quest dialog, e.g. if you use your own background image. - title_color (text, optional, default is black) The
title_color
is the color for the quest title in the quest dialog. The color must be a valid CSS color, like#ff0000
orred
. - text_color (text, optional, default is black) The
text_color
is the color for the quest text in the quest dialog. The color must be a valid CSS color, like#ff0000
orred
. - shadow_color (text, optional, default is none) The
shadow_color
is the color for the quest text shadow in the quest dialog. The color must be a valid CSS color, like#ff0000
orred
. - marker (table, optional, new since 1.2.0) The
marker
defines if a special symbol is shown at the given coordinates so the player can see the location before he arrives. Example:marker = {coords = { x = -858.72, y = -1340.31, z = 44.43 },radius = 10.0,type = 0x94FDAE17,color = { r = 102, g = 0, b = 255 },}- coords (table, required) The
coords
is a list of thex
,y
andz
coordinates for the marker triggering point. Example:coords = {x = -858.72,y = -1340.31,z = 44.43} - radius (number, required) The
radius
is the radius around thecoords
where the marker should be triggered. Ensure a float (e.g.10.0
) and not an integer (e.g.10
) is given. - type (number, required) The
type
is the visiable type of the marker. See Marker Types for available types. - color (table, required) The
color
is a list of ther
(red),g
(green) andb
(blue) color values for the marker. Example:color = {r = 255,g = 0,b = 0}
- blip (table, optional, new since 1.2.0) The
blip
allows to show a blip on the map for the quest step coordinates. Example:blip = {color = 'BLIP_MODIFIER_PICKUP_WEAPON_RARE',title = "Example title",icon = "blip_ambient_king",}- title (string, required) The
title
of the blip. - icon (number, required) The
icon
of the blip. See Blip Multiplayer Icons and Blip Singleplayer Icons for available icons.
- radius_blip (table, optional, new since 1.2.0) The
radius_blip
allows to show a radius blip with a defined radius on the map for the quest step coordinates. Example:radius_blip = {color = 'BLIP_MODIFIER_PICKUP_WEAPON_RARE',radius = 200.0,}- radius (float number, required) The
radius
in meters of the blip.
No known issues/bugs at the moment.
Currently, it is not possible to give weapons to the player. But you can use the
callback
function to give weapons to the player.Unlimited.
Unlimited.
Last modified 1mo ago