dev | ||
models | ||
textures | ||
config.lua | ||
depends.txt | ||
fs_edit_options_dialog.lua | ||
functions.lua | ||
init.lua | ||
inventory.lua | ||
mobs.lua | ||
mod.conf | ||
privs.lua | ||
readme.md | ||
README.md | ||
show_fs.lua | ||
tools.lua | ||
trade_list.lua | ||
trade_simple.lua | ||
usage.md |
This mod allows to set RPG-like texts for NPC where the NPC "says" something to the player and the player can reply with a selection of given replies - which most of the time lead to the next dialog.
Terminology
dialog A text said by the NPC, with diffrent replys the player can select from.
option A reply/answer to the text the NPC said.
precondition All listed preconditions have to be true in order for the NPC to offer this option.
effect Further effects (like setting variables, handing out items) selecting a particular option has.
How to configure NPC and add dialogs
There are two ways:
- Just talk to them and click on the "I am your owner"-Dialog. This opens up a menu where you can edit most things.
- Use /giveme to get the staff you want, wield the staff and point it at the NPC you want to change. This is much more powerful. Lua code can be entered and later executed by the NPC.
The privs
npc_talk_owner will allow players to edit their own NPC by talking to them. Does not include usage of the staffs! Ought to be given to all players.
npc_talk_master allows players to edit any NPC supported by this mod. Does not include usage of the staffs! Ought to be given to selected trusted players who want to help others with their NPC configuration and/or support NPCs owned by the server.
npc_master allows players to edit any NPC supported by this mod. Does include usage of the staffs. This is very powerful and allows to enter and execute lua code without restrictions. Only grant this to staff members you really trust.
Tools
There are diffrent staffs for diffrent functionality: Staff of.. does: ..I-said-so edit what the NPC says (extremly powerful) ..shut-up mute the NPC ..dawai-dawai un-mute the NPC ..game-over remove the NPC (but not its data) ..fashion change skin etc.
Be careful: With the staffs, you can add more than one result of the type "dialog" - which will confuse the NPC and lead to unexpected results. Use the staffs only with care!
Mute
When you edit an NPC, you might want to stop it from talking to other players and spoiling unifinished texts/options to the player.
For this case, the NPC can be muted. This works either with the staff or by selecting the appropriate option in the talk menu after having started edit mode by claiming to be the NPC's owner.
Skin
The skin and what the NPC wields can be changed via the "Edit Skin" button.
Simple variables
If you want to let your NPC greet the player by name, you can do so. Some variables/texts are replaced appropriately in the text the NPC says and the player can reply:
MY_NAME
will be replaced by the name of the NPC
NPC_NAME
same as above
OWNER_NAME
will be replaced by the name of the owner of the NPC
PLAYER_NAME
will be replaced by the name of the player talking to the NPC
GOOD_DAY
will be replaced by "Good morning", "Good afternoon" or
"Good evening" - depending on the ingame time of day
good_DAY
same as above, but starts with a lowercase letter (i.e.
"good morning")
Note: If you want to extend this, you can do the following in your own mod:
local old_function = yl_speak_up.replace_vars_in_text yl_speak_up.replace_vars_in_text = function(text, dialog, pname) -- do not forget to call the old function text = old_function(text, dialog, pname) -- do your own replacements text = string.gsub(text, "$TEXT_TO_REPLACE$", "new text") -- do not forget to return the new text return text end
The replacements will not be applied in edit mode.
Trading (simple)
The NPC can trade item(stacks) with other players. Only undammaged items can be traded. Items that contain metadata (i.e. written books, petz, ..) cannot be traded. Dammaged items and items containing metadata cannot be given to the NPC.
Trades can either be attached to dialog options (and show up as results there) via the edit options dialog or just be trades that are shown in a trade list. The trade list can be accessed from the NPC's inventory.
Trades cannot be added with the staffs.
If there are trades that ought to show up in the general trade list (i.e. not only be attached to dialog options), then a button "Let's trade" will be shown as option for the first dialog.
Trades that are attached to the trade list (and not dialog options) can be added and deleted without entering edit mode ("I am your owner. ...").
If unsure where to put your trades: If your NPC wants to tell players a story about what he sells (or if it is i.e. a barkeeper), put your trades in the options of dialogs. If you just want to sell surplus items to other players and have the NPC act like a shop, then use the trade list.