Stendhal Quest Coding - Part 2: Difference between revisions
Content deleted Content added
imported>Hendrik Brummermann |
imported>Hendrik Brummermann |
||
Line 29:
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).
So, lets return to our example. We want the NPC to reply to "yes" and "no" but only after the quest question was asked. So we add a third state called QUEST_OFFERED. When the player says "quest", the NPC goes to that state. On "yes" or "no" it returns to ATTENDING.
{{TODO|▼
}}▼
[[Image:npc with quest question.png]]
You may have noticed in the above diagram that there is something called "ANY". This is a special "state" which allows the triggers associated with the outgoing arrows to be triggered in any state. You should not use this except for "bye" which should always work.
▲{{TODO|
* code
* point to ConverstationStates
* View Transitions with Graphviz
▲}}
== Teaching the NPC to remember the player ==
| |||