Stendhal Quest Coding: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Hendrik Brummermann
decreased indent
imported>Hendrik Brummermann
blue trigger words
Line 116: Line 116:
npc.addReply(ConversationPhrases.QUEST_MESSAGES,
npc.addReply(ConversationPhrases.QUEST_MESSAGES,
"My mouth is dry, but I can't be seen to abandon this teaching room!");
"My mouth is dry, but I can't be seen to abandon this teaching room!");
}
}
</source>
</source>


Line 123: Line 123:
== Blue trigger words ==
== Blue trigger words ==


As you probably know NPCs can say words in blue, words that they expect to be repeated by the player. We want to add such words for "beer" and "tavern". As we have done before, we will add npc.addReply lines for those words.
{{TODO|

As you probably know NPCs can say words in blue, words that they expect to be repeated by the player.
So, how do we get the words colored blue? Simple, add a "#" in front of them. If you actually want to include a #-character, you need to repeat it.
* #beer

}}
<source lang="java">
public void prepareQuestStep() {

// get a reference to the Hayunn npc
SpeakerNPC npc = npcs.get("Hayunn Naratha");

// ask for a beer and explain it
npc.addReply(ConversationPhrases.QUEST_MESSAGES,
"Please bring me a #beer.");

// explain blue words
npc.addReply("beer", "Margaret sells beers in the #tavern.");
npc.addReply("tavern", "If you don't know where the inn is, you could ask old Monogenes.");

// an example for escaping #
npc.addReply("trading", "http://stendhal.game-host.org/wiki/index.php/StendhalFAQ##Trading");
}
</source>

You know the drill: Compile, restart and try it out.


== Second Part of this Tutorial ==
== Second Part of this Tutorial ==