Go to file
2021-07-29 21:17:13 +02:00
dev first commit 2020-11-20 11:45:50 +01:00
models first commit 2020-11-20 11:45:50 +01:00
textures first commit 2020-11-20 11:45:50 +01:00
config.lua quest api variables are now properly saved and restored 2021-07-03 21:25:38 +02:00
custrom_functions_you_can_override.lua allowed nil as return value for aborting actions 2021-06-29 04:51:39 +02:00
depends.txt added mobs in depends.txt as mobs_redo is required 2021-05-16 22:30:00 +02:00
formspec_helpers.lua allow to select variables in manage_variables 2021-07-26 22:08:45 +02:00
fs_alternate_text.lua completed turning dialog into alternate text 2021-07-25 21:55:14 +02:00
fs_edit_actions.lua fixed crash 2021-07-18 01:49:05 +02:00
fs_edit_effects.lua convert to numbers were necessary in the effects 2021-07-12 00:31:27 +02:00
fs_edit_general.lua completed turning dialog into alternate text 2021-07-25 21:55:14 +02:00
fs_edit_options_dialog.lua allow to turn alternate text into a new dialog 2021-07-17 16:23:06 +02:00
fs_edit_preconditions.lua removed debug message 2021-07-12 00:35:33 +02:00
fs_fashion.lua make sure items are given back when setting wielded items via inventory slots 2021-07-27 19:28:45 +02:00
fs_initial_config.lua allow to set up the npc again 2021-07-27 01:58:44 +02:00
fs_save_or_discard_or_back.lua fixed bugs with undeclared variables 2021-07-02 01:13:50 +02:00
functions.lua npc_talk_owner priv is still required even for players added to the list of allowed editors 2021-07-26 19:41:35 +02:00
init.lua added yl_speak_up.create_dropdown_playerlist in new file formspec_helpers.lua 2021-07-26 19:37:21 +02:00
inventory.lua added input formspec for action of type trade 2021-06-16 00:25:18 +02:00
mobs.lua first commit 2020-11-20 11:45:50 +01:00
mod.conf first commit 2020-11-20 11:45:50 +01:00
print_as_table.lua moved some helper functions from quest_api.lua to print_as_table.lua 2021-07-25 02:12:35 +02:00
privs.lua registered npc_talk_master priv 2021-05-29 19:35:27 +02:00
quest_api.lua show which npc and node_pos(itions) use a variable; fixed bug in manage_variables formspec 2021-07-29 21:17:13 +02:00
readme.md Add Documentation 2020-11-21 19:15:58 +01:00
README.md explained alternate texts 2021-07-17 15:04:50 +02:00
register_node_punch.lua added register_node_punch.lua 2021-06-05 22:54:48 +02:00
show_fs.lua yl_speak_up.show_what_points_to_this_dialog is now handled by show_fs, and the back button works 2021-07-25 03:42:22 +02:00
staff_based_editing.lua added comment to staff based editing 2021-07-25 23:28:17 +02:00
tools.lua added yl_speak_up.update_nametag and yl_speak_up.set_muted for colored nametags depending on muted state 2021-05-10 14:34:47 +02:00
trade_list.lua show 'Sold out' for the right trade 2021-06-02 01:32:06 +02:00
trade_simple.lua wielded items can now be set using inventory slots 2021-07-26 01:25:29 +02:00
usage.md Add Documentation 2020-11-21 19:15:58 +01:00

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 prerequirement to offer this option.

action An action the player may (or may not) take, i.e. trading, taking an item from the NPC, giving the NPC something, entering the right password etc.

effect/result Further effects (like setting variables, handing out items) that take place after the action was successful.

alternate text Text shown instead of the normal dialog text.

How to configure NPC and add dialogs

There are two ways:

  1. Just talk to them and click on the "I am your owner"-Dialog. This opens up a menu where you can edit most things.
  2. 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.

Hint: The command "/npc_talk_debug <npc_id>" allows you to get debug information regarding preconditions and effects. You can turn it off with "/npc_talk_debug off". The NPC ID can be seen in the setup dialog for preconditions and effects.

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.

Quest items

Quest items can be created to some degree as part of the action of an option through the edit options menu.

MineTest does not allow to create truely new items on a running server on the fly. What can be done is giving specific items (i.e. that one apple, that piece of paper, that stack of wood, ..) a new description that makes it diffrent from all other items of the same type (i.e. all other apples).

A new description alone may also be set by the player with the engraving table (provided that mod is installed): https://forum.minetest.net/viewtopic.php?t=17482

In order to distinguish items created by your NPC and those created through the engraving table or other mods, you can set a special ID. That ID will also contain the name of the player to which the NPC gave the item. Thus, players can't just take the quest items of other players from their bones and solve quests that way.

The actions npc_gives and npc_wants are responsible for handling of quest items. They can of course also handle regular items.

If an NPC creates a special quest item for a player in the npc_gives action, it takes the item out of its inventory from a stack of ordinary items of that type and applies the necessary modifications (change description, set special quest ID, set information which player got it).

If the NPC gets such a quest item in an npc_wants action, it will check the given parameters. If all is correct, it will strip those special parameters from the item, call the action a success and store the item in its inventory without wasting space (the item will likely stack if it is not a quest item).

Entering Passwords

Another useful method for quests is the text_input action. It allows the NPC to ask for a passwort or the answer to a question the NPC just asked. The player's answer is checked against the expected answer that you give when you set up this action.

Custom Preconditions, Actions and Effects

You can define custom actions and provide a parameter. The function yl_speak_up.get_fs_action_custom(player, param) gets called when such a function is executed and ought to return a formspec. Input ought to be sent to the function yl_speak_up.input_fs_action_custom(player, formname, fields) which acts as an example of what you need to take care of in your own implementation of this function.

You can also define custom preconditions and effects. For more information, take a look at custrom_functions_you_can_override.lua In order to add custom functions, you need to be able to edit that file or execute Lua code on the server.

Alternate Text

Sometimes you may encounter a situation where your NPC ought to answer to several questions and the player likely wanting an answer to each. In such a situation, you might create a dialog text for each possible option/answer and add an option to each of these new dialogs like "I have more questions.". That is sometimes impractical. Therefore, you can add alternate texts.

These alternate texts can be shown instead of the normal dialog text when the player selected an option/answer. Further alternate texts can be shown if the action (provided there is one defined for the option) or an effect failed.

The alternate text will override the text of the dialog (what the NPC says) but offer the same options/answers as the dialog normally would.

Alternate texts can be converted to normal dialogs, and normal dialogs can vice versa be converted to alternate texts if only one option/answer points to them.