Skip to content
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.

The Npc class extends class Character

Properties

  • 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.

Potential improvements

  • The class can be modified with a condition for each sequence so that the message of the character changes depending on who asks when (depending on achievements, the worn armor, etc.)

  • It could also be modified to provide multilingual support.

Clone this wiki locally