Stendhal Quest Coding - Part 2: Difference between revisions
Content deleted Content added
imported>Hendrik Brummermann m added section "Quest Documentation " |
imported>Hendrik Brummermann |
||
Line 16:
== Teaching the NPC to ask the players whether they will do the quest ==
Now we want Hayunn to ask the player whether he is going to help:
* ''quest'': My mouth is dry, but I can't be seen to abandon this teaching room! Could you bring me some beer from the tavern?
** ''yes'': Thanks! I'll be right here, waiting. And guarding, of course.
** ''no'': Oh, well forget it then. I guess I'll just hope for it to start raining, and then stand with my mouth open.
As a little exercise you can code this part to check whether you understood the [Stendhal Quest Coding|first part of this tutorial].
There is, however, a small problem with the current solution: There can only be one reply for "yes" and "no". So the NPC can only ask one single question in order to be able to process the answers.
Fortunately there is a solution: The NPCs needs to remember the state of the conversation:
[[Image:npc simple.png]]▼
Currently our NPC knows two states: IDLE for walking around and ATTENDING for talking to a player. You can change between states by talking to the NPC. So if the NPC is IDLE, it will accept "hi" and move on to the ATTENING state. If you say "hi" again, nothing will happen because "hi" is unknown in this state. The NPC, however, will now reply to "job" and "help". You can end the conversation with "bye" which will cause the NPC to return to IDLE (and start walking around again).
{{TODO|
Line 22 ⟶ 36:
* very basic introduction to FSM
}}
▲[[Image:npc simple.png]]
[[Image:npc with quest question.png]]
| |||