[Crossfire-wiki] [Crossfire DokuWiki] page changed: user:cavesomething:guide_to_quest_dialogs
no-reply_wiki at metalforge.org
no-reply_wiki at metalforge.org
Thu Mar 25 11:41:16 CDT 2010
A page in your DokuWiki was added or changed. Here are the details:
Date : 2010/03/25 11:41
User : cavehippo
Edit Summary:
@@ -1,5 +1,5 @@
- ====== Dialog-Driven Quests ======
+ ======= Dialog-Driven Quests =======
The following is a guide to creating your own dialog-driven quest.
@@ -8,13 +8,13 @@
Dialogues can be used without having any associated quests at all, likewise you can create a quest without having any dialog, but you will find it much easier if you use dialogue to drive a narrative forward.
The first section of this guide covers dialogues.
- ===== Dialogs =====
+ ====== Dialogs ======
Dialogs are specified using a JSON syntax, we'll have a simple example first, followed by a general explanation of all the options:
- ==== Example ====
+ ===== Example =====
<code>
{
"location" : "friendlypeep",
@@ -37,19 +37,21 @@
}
]}
</code>
- ==== Taking it apart ====
+ ===== Taking it apart =====
Each potential line of dialog forms a 'rule' these rules are checked in sequence, from the top of the file down.
* The first part of each rule is the 'match' - This is what the player has said to the NPC - These ones are all * so will match on anything the player might say.
* Next are the 'pre' conditions, in order to match a rule, **all** of the pre-conditions must be true.
- * After that we have 'post' actions, these are things that happen after
+ * After that we have 'post' actions, these are things that happen after
+ * Then we have the 'msg' which is what the NPC will say.
+ * Finally, there is an optional last part, which can have two forms, 'suggests' or 'requires' - these hold responses that the client can give.
Because we check from the top down, the most restrictive rule goes first.
- === Rule 1 ===
+ ==== Rule 1 ====
We'll look at the topmost rule first.
<code>
@@ -86,13 +88,13 @@
</code>
This is the text that the NPC will say to the player. //$you// is replaced by the name of the player
- ===Rule 2===
+ ====Rule 2====
Rule 2 is similar to rule 1, except that the item condition is missing, as such it will trigger when the token is present, but the amount of money held by the player is less than 100
- ===Rule 3===
+ ====Rule 3====
<code>
{
"match" : ["*"],
@@ -109,13 +111,13 @@
Tokens are stored in the player file, under the "location" which was specified at the top of the file. Any dialog files which point to the same location have access to the same tokens (and can affect the values they hold). Two tokens with the same name but in different locations are treated separately.
Finally there is the message block where //$me// is replaced by the name of the NPC.
- ==== Full List of options ====
+ ===== Full List of options =====
The options that can be used vary in the different blocks:
- === The Match Block ===
+ ==== The Match Block ====
This holds the text that the player should say before we check if the rule applies.
There can be one or multiple words specified, or "*" which matches anything.
@@ -125,9 +127,9 @@
</code>
This will match any out of "gork", "hoard", "yes" or "want"
- === The Pre Block ===
+ ==== The Pre Block ====
In the Pre Block, the following checks are supported:
* Quest
@@ -135,9 +137,9 @@
* Token
* Level
* Age
- == Quest ==
+ === Quest ===
Quest is followed by two fields, the name of the quest, and the step that the player must be at or past.
eg
<code>
@@ -146,9 +148,9 @@
Checks that the player has reached at least step 5 of the quest 'testquest'
Have a look at the 'Quest' Section for an explanation of the 'steps'
- == Item ==
+ === Item ===
Item is followed by the name of the item to check for, and optionally the number that are required.
eg
@@ -163,9 +165,9 @@
The number of items required may be omitted, if so it will look for '1' of the item.
The number may also be set to '0', this checks that the player does **not** have the item.
- == Token ==
+ === Token ===
Checks for Token to have a value from the list of values provided.
eg
<code>
@@ -176,9 +178,9 @@
There can be more than 1 value provided.
Tokens are stored in the player file, under the "location" which was specified at the top of the file. Any dialog files which point to the same location have access to the same tokens (and can affect the values they hold). Two tokens with the same name but in different locations are treated separately.
- == Level ==
+ === Level ===
Checks if the player is at or above the specified level,
<code>
"pre" : [["level", "10"]],
@@ -186,9 +188,9 @@
Will trigger if the player is at least at level 10, and will not trigger if they are below it.
While you can use this to block of entire quest lines until certain levels, it is probably better in general to use this test to bypass a warning about being too weak.
- == Age ==
+ === Age ===
This checks if the date of a time marker is older than the specified age.
there are 6 things you will want to set.
@@ -225,9 +227,9 @@
</code>
Although it would be better to use the second version because it is easier to compare to other age checks.
- === The Post Block ===
+ ==== The Post Block ====
After the Pre block is used to decide whether a message should trigger, the post block holds the consequences.
There are 5 different options here:
@@ -238,9 +240,9 @@
* takeitem
* settoken
* connection
- == quest ==
+ === quest ===
This sets the named quest to the stage which is specified.
eg:
@@ -270,9 +272,9 @@
</code>
The first rule triggers when we are already at stage 5, the second rule when we are at stage 4, and then moves us to stage 5
- == giveitem ==
+ === giveitem ===
Gives the player an item or items from the NPCs inventory.
eg
@@ -291,9 +293,9 @@
If you **don't** want to be able to acquire these items through killing the NPC, then you should create an 'NPC_Gift_Box' item in the NPCs inventory, and put the items in there. This is checked before the rest of the NPCs inventory is, so if you want to give an item that is similar to one that might be generated from the NPCs treasure list, then it is probably better to put that in their also.
You will particularly want to use the NPC_Gift_Box if you have any easily accessible NPCs who are rewarding inaccessible quests. (eg, someone in a town who asks you to fetch something from a very deep dungeon).
- == givecontents ==
+ === givecontents ===
This is like giveitem, except that it gives whatever is in the container specified, rather than the container.
You should use this when:
@@ -301,9 +303,9 @@
* You want to use a treasure list to create an item, you won't know what items will be generated exactly, but by putting it in a container, you can give the player whatever is in there.
**Warning:** You probably //Don't// want to use a treasure list that contains monsters, it'll sort of work, but don't do it.
- == takeitem ==
+ === takeitem ===
Removes the given number of an item from the inventory of the player.
eg
@@ -327,17 +329,17 @@
</code>
That is to say, having a matching item check before removing the item.
- == settoken ==
+ === settoken ===
Sets the specified token to the specified value, other rules can query this value using 'token' in the pre block.
Tokens are stored in the player file, under the "location" which was specified at the top of the file. Any dialog files which point to the same location have access to the same tokens (and can affect the values they hold). Two tokens with the same name but in different locations are treated separately.
NB: Tokens and time markers are actually the same thing, so if you need to reset a timemarker, then you can use settoken, and set it to 0, if you do, all age checks against the marker will fail until it is set again.
- == connection ==
+ === connection ===
Triggers the specified connection on the map
eg
@@ -359,9 +361,9 @@
</code>
will give the impression the NPC has opened a door as long as there is a door with connection 4 set in the map editor.
- == marktime ==
+ === marktime ===
Stores the current server time in a time token with the name specified.
eg
@@ -372,18 +374,30 @@
Stores the current time in "mymarker", you can then check this with 'age' in a 'pre' block to check how long has passed since that point.
This can be used for putting time limits on parts of dialog/quests etc.
- === The msg Block ===
+ ==== The msg Block ====
This is send directly to the player, if the pre conditions are matched, with the following exceptions:
//$you// is replaced by the name of the player
//$me// is replaced by the name of the NPC
+ //\n// is replaced by a new line character.
Obviously, it probably doesn't make sense to use $you on the first line of dialogue that will be spoken, unless there is a story-based reason for the NPC to know who the player is.
+ Note also that you can expect clients to wrap message text for you, the reason to use \n is if you use
- ==== Quest Definition ====
+
+
+ some blank space
+
+
+
+
+ for emphasis.
+
+
+ ===== Quest Definition =====
Quests are defined in a text file, in a similar way to archetypes. There are a collection of fields that may be used to express different properties of the quest.
The following is an example of a quest definition.
@@ -425,9 +439,9 @@
</code>
Again, I'll take this apart step by step:
- === The header ===
+ ==== The header ====
quest scorn/GorksTreasure
title Gorks Treasure Hoard
description
@@ -437,41 +451,41 @@
restart 1
There are a number of entries here, I'll cover them in the order they appear, then explain the other options this quest doesn't use.
- == quest ==
+ === quest ===
The start of any quest is the 'quest' line, which gives the name the quest is known by internally. This is a mandatory entry
Good practice is to set up quests as region/questname -
- == title ==
+ === title ===
The title provides the name that the players will know the quest by - This is optional (but recommended)
- ==description==
+ ===description===
'description' appears on a line on its own on a line on its own, everything that follows until a line containing 'end_description' is a summary of the purpose of the quest overall. - This is optional (but recommended for non-hidden quests)
- ==stopstep==
+ ===stopstep===
This is the step after which the quest will be consider 'complete'
you need to specify a stopstep if you want your quest to be able to end.
- ==restart==
+ ===restart===
either 0 or 1.
Whether it is permitted for a player to play through this quest multiple times. 1 indicates a restartable quest, 0 a non-restartable one. If constructing a quest which is restartable, then you should be careful of items like keys, which might be able to be kept between attempts allowing parts of the quest to be bypassed. consider also the use of a marktime/age combination in a conversation to stop the quest restarting immediately.
Other options:
- ==hidden==
+ ===hidden===
**TODO**: Indicates that the quest is tracked, but that updates are not sent to the player. You can use this to create convenience quests which silently track progress in other quests.
- ==party==
+ ===party===
**TODO**: define how the quest should interact with party membership, options are:
* solo - No members of the player's party can assist with this quest at all.
* assist - members of the player's party can choose to assist with this quest, and can trigger updates for the player if they are on the same map.
* team - members of the player's party can choose to work with the player on this quest, and any updates triggered act for all players if they are on the same map. (regardless of what the state was for non-triggering players)
* globalteam - members of the player's party can choose to work with the player on this quest, and any updates triggered act for all players regardless of where they are in the world. (regardless of what the state was for non-triggering players)
Members of a party can find quests to help their party members with by using the 'party quest' command **TODO ** Not implemented yet.
- ===The Quest Steps===
+ ====The Quest Steps====
A quest step is a single 'state' within a quest. Any given player may only be in one state in a quest at any one time.
A quest step looks like this:
@@ -484,21 +498,21 @@
</code>
entries are as follows:
- == step ==
+ === step ===
Followed by a number, this marks the start of the step definition, which continues until you reach the next end_step
The step numbers are what you will need to use to refer to this quest in dialogs and other events. It is good practice (though not required) to number steps 10,20,30, etc, that way if it is necessary to add additional steps at a later date, it will not be necessary to hunt through maps and dialogs for existing step numbers to change.
- == description ==
+ === description ===
descriptions act the same as the description for the quest overall, but have a slightly different meaning. The description of a step should be thought of as a 'what just happened/what should I be doing now' type of text, whereas the quest description is more abstract.
- == solo ==
+ === solo ===
** TODO **
may appear on its own, and indicates that an update **to** this step should not apply to other members of the team, this can be used for steps where items are given out so that all players in a team can get the item(s) in question.
- ====Interacting with quests outside of Dialog ====
+ =====Interacting with quests outside of Dialog =====
We have covered how to handle quest updates in Dialog, and how to define the quests that are updated, but what about updating a quest in response to picking up an object, killing a particular monster or reaching a certain place?
In the map editor there is the option to bind events to objects, you will already have used this to bind event_say to an NPC.
@@ -513,9 +527,9 @@
When you bind events to objects, you need to pick a script to use, so far you will have been using python/dialog/npc_dialog.py, but you can use any script you want.
For general-purpose quest updating the first place to look will be QuestAdvance.py
- == QuestAdvance.py ==
+ ==== QuestAdvance.py ====
QuestAdvance.py should be used as in the following example:
{{user:cavesomething:questadvance.png|}}
@@ -532,25 +546,25 @@
if the player were not at either step 0 or 1 in this example, then nothing would happen when the event triggered.
NB: Be careful about binding to event_pickup for items that are not taken away as part of a quest soon afterwards, especially for restartable quests, an event_pickup will return
- ==== How Do I? ====
+ ===== How Do I? =====
The following are common things to want to do, and how to go about doing them.
- == Make an object either be given in a dialogue, or be found on the corpse of the NPC when killed, but not both? ==
+ === Make an object either be given in a dialogue, or be found on the corpse of the NPC when killed, but not both? ===
* First of all, put one copy of the item in an NPC_Gift_Box (this is the copy that will be tied to the dialog), and one on the NPC directly.
* Make sure that the same messages that cause the item(s) to be given to the player, also set a quest step (if you have no suitable quest, then you can create a simple one-step quest which is hidden ** TODO **)
* Next, put an event_death listener on the NPC
* Use the script **Script not written yet** with the options **TODO** to remove the copy of the object from the monster's inventory if they are killed by a player who is past a certain stage in the given quest.
Now the player can either kill the NPC and claim the item, or he can talk to him and claim the item, but can not talk to the NPC, get the item, then kill the NPC and get another copy of the item.
- == Make a quest update on a player reaching a certain point on a map?==
+ === Make a quest update on a player reaching a certain point on a map?===
Put a small button under the floor, add to the small button's inventory a 'trigger' event. point the event at python/dialog/QuestAdvance.py and give the appropriate stage update rules.
- == Do something really complex that no one has considered before? ==
+ === Do something really complex that no one has considered before? ===
Hop on IRC and and ask for advice.
- == Make the outcome of a quest determine which map an exit leads to (ie, define aftermath maps for quests that players can return to) ==
+ === Make the outcome of a quest determine which map an exit leads to (ie, define aftermath maps for quests that players can return to) ===
I don't know yet, working on it.
IP-Address : 81.141.60.247
Old Revision: http://wiki.metalforge.net/doku.php/user:cavesomething:guide_to_quest_dialogs?rev=1269497358
New Revision: http://wiki.metalforge.net/doku.php/user:cavesomething:guide_to_quest_dialogs
--
This mail was generated by DokuWiki at
http://wiki.metalforge.net/
More information about the crossfire-wiki
mailing list