You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mathieu edited this page Jun 30, 2022
·
5 revisions
client/js/npc.js defines the Npc class, which uses the NpcTalk array that stores for each character the sequence of sentences it is supposed to produce to players.
NpcTalk: Each talking npc is associated to a cell in the array, its content is an array with the sentences to produce in the order in which they are to utter them.
Methods
init: initialises the npc;
talk: displays the next sentence associated to the character in the NpcTalk table.
Each object (except the first, default discussion) has a "condition" property (function(game) → boolean) which decides when to use this discussion and a "text" property, which contain the array of lines of the conversation ([/*sentences*/]).
name as the name of the user in npc dialogs
Potential improvements
It could also be modified to provide multilingual support.