Skip to content
User Avatar
#2643
Auto-translated
How to create dialogue messages like those found on the "Path of the Hero" map, for example.
Here is a quote from one of the Nival forums, where one of the developers discussed the changes in patch 3.1:
TalkBoxForPlayers( playersFilter, iconRef, iconTooltipRef, textRef, addTextRef, callback, mode, titleTextRef, selectTextRef, defaultOption, optionTextRef [, optionTextRef, ...] )
- opens a dialog with multiple answer options (from 1 to 5) for the selected players (playersFilter)
- the function does not output error messages because if the parameters are incorrect, default values are used
- iconRef - a reference to the icon texture
- iconTooltipRef - the path to the icon tooltip text
- textRef - the path to the dialog text
- addTextRef - the path to the dialog text (additional)
- callback - a string with the name of a Lua function, where the first parameter is the player's answer (number: 0 - cancel, -1 - closed by the game, 1.. - the number of the answer selected by the player)
- mode - mode: 0 - with an OK button, 1 - OK/Close
- titleTextRef - the path to the text of the window title
- selectTextRef - the path to the text of the title before the selection options
- defaultOption - the number of the answer that is highlighted by default (number: 0 - none, 1.. - the number of the answer)
- optionTextRef - the path to the text of answer #1
- ... - the path to the text of answer #...

Example:
s = 'Text/Chest/Choose.txt'
TalkBoxForPlayers( PLAYERFLT_1, nil,s, s,s, 'test1', 0, s,s, 0, s,s,s )

Attention! In localized versions of the patch, one necessary text file is missing, which is required for the correct operation of TalkBoxForPlayers. You can simply create it:

File: UI/CommonBoxes/TalkBox/Text.txt
Content: (h5)(color_bright)(value=text) (use angle brackets instead of regular parentheses)
File format: plain Unicode text (save as Unicode in NOTEPAD)

This file is recommended to be distributed as part of map archives that use TalkBoxForPlayers.

The second option is to create a special mod that contains this file and require the presence of the mod for the map to work (distribute it together).