Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 8 and Version 9 of code/doc/Questsystem


Ignore:
Timestamp:
Dec 8, 2008, 2:53:12 PM (16 years ago)
Author:
dafrick
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • code/doc/Questsystem

    v8 v9  
    103103As you may see, the difference between a GlobalQuest also lies in the fact of the GlobalQuest having RewardEffects. RewardEffects are only executed on the completing player, while CompleteEffects are executed on all player having obtained the Quest before it is completed, when it is completed.
    104104
    105 === QuestHint ==
     105==== QuestHint ====
    106106QuestHints can be used to give a player useful (or just funnily unuseful) information for Quests he is working on completing. The cannot have any sideeffects but also have an identifier which follows the same form as in the Quests.
    107107
     
    112112    <QuestDesctription title="" description="" />
    113113</QuestHint>
    114 }}}}
    115 
    116 === QuestDescription ===
     114}}}
     115
     116==== QuestDescription ====
    117117Each Quest (and also each QuestHint) mus have a QuestDescription consisting of a title and description, and for Quests also messages for the event the Quest is either failed or completed. Of course these are (as is the title and the description) optional.
    118118
     
    122122}}}
    123123
     124=== Creating Sideeffects ===
     125Quests can have sideeffects, this means that they can have an influence on the game world. Quests can do that through two distinct devices, QuestEffects and QuestListeners (active and passive).
     126
     127==== QuestEffect ====
     128A QuestEffect is the first (and probably most important) divice for Quests to have sideeffects. There are two entities that can have QuestEffects: Quests and QuestEffectBeacons (which will be explained later on).
     129QuestEffects and for example start a Quest for a player, complete/fail Quests for a player, add a QuestHint or a Reward to a player.
     130
     131These QuestEffects are implemented so far, but feel free to [wiki:DamianFrick contact me] if you have suggestions for new QuestEffects or if you need help implementing a new one yourself.
     132
     133===== AddQuest =====
     134This QuestEffect adds (respectively starts) a Quest (identified by the given questId) to the player.
     135
     136{{{
     137<AddQuest questId="id" />  //Where id is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information, and identifies the Quest that should be added.
     138}}}
     139
     140===== FailQuest =====
     141This QuestEffect fails a Quest (identified by the given questId) for the player.
     142
     143{{{
     144<FailQuest questId="id" />  //Where id is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information, and identifies the Quest that should be added.
     145}}}
     146
     147===== CompleteQuest =====
     148This QuestEffect completes a Quest (identified by the given questId) for the player.
     149
     150{{{
     151<CompleteQuest questId="id" />  //Where id is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information, and identifies the Quest that should be added.
     152}}}
     153
     154===== AddQuestHint =====
     155This QuestEffect adds a QuestHint to a Quest (identified by the given questId) of a player.
     156
     157{{{
     158<AddQuestHint hintId="id" />  //Where id is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information, and identifies the QuestHint that should be added.
     159}}}
     160
     161==== AddReward =====
     162This QuestEffect adds a Rewardable (Rewardable is an Interface which can be implemented by and object that its creator thinks schould be able to be rewarded a player for completing (or failing for that matter) a Quest) to the player. Pickups for example wold be good Rewardables (this is not implemented though).
     163
     164{{{
     165<AddReward>
     166    <Rewardable /> //A list of Rewardable objects to be rewarded the player, see the specific Rewardables for their respective XML representations.
     167    ...
     168    <Rewardable />
     169</AddReward>
     170}}}
     171
     172==== QuestListener ====
     173The QuestListener is the second device you can use to create sideeffects. But other than QuestEffects (that are executed (or invoked) eighter as a result of failing or completing a Quest or by a QuestEffectBeacon) QuestListeners are passive. QuestListeners have a certain mode (all, start, complete or fail) and a Quest to which they belong to (resp. to which they react). You then can use QuestListeners to make basically any object aware of when the status of the given Quest changes (the way you defined through the mode) and take any action you may think of.
     174
     175{{{
     176<BaseObject> // The object that should react to the status change of a Quest.
     177    <events>
     178        <function> // Where function is the method of the object that schould be executed. Normally this would be visibility or activity.
     179            <QuestListener questId="someQuestId" mode="someMode" /> // Where someQuestId is the identifier for the Quest the QuestListener is reacting to, and someMode is the kind of status change the QUestListener reacts to (all, start, complete or fail).
     180        </function>
     181    </events>
     182</BaseObject>
     183}}}
     184
     185I hope this example has made the QuestListener a little clearer. The QuestListener actually reacts exactly as any Trigger or EventListener would (allthough the QuestListener is really neighter the one nor the other) whcih means you can use it in exactly the same as you would use one of the above, it just reacts to a different thing. Namely to the change ina Quests status.
     186
     187=== Putting the Quests in the game world ===
     188As of now we have a way for Quests to initiate new Quests of even complete/fail other Quests. We also have a way of reacting to a status change in Quest. But our Quests have no bound (well, not really at least) to the game world as of yet. For this we have QuestEffectBeacons.
     189
     190==== QuestEffectBeacon ====
     191The QuestEffectBeacon is a PositionableEntity (so you can position it anywhere in the game world) and it has the ability to (when triggered trough some circumstance) invoke a specified list of QuestEffects on the player triggering the QuestEffectBeacon.
     192
     193Creating a QuestEffectBeacon in XML goes as follows:
     194{{{
     195<QuestEffectBeacon times=n> //Where 'n' is eighter a number >= 0, which means the QuestEffectBeacon can be executed n times. Or n = -1, which means the QuestEffectBeacon can be executed an infinite number of times.
     196    <effects>
     197        <QuestEffect /> //A list of QuestEffects, invoked when the QuestEffectBeacon is executed, see QuestEffect for the full XML representation.
     198        ...
     199        <QuestEffect />
     200    </effects>
     201    <events>
     202        <execute>
     203            <EventListener event=eventIdString />
     204        </execute>
     205    </events>
     206    <attached>
     207        <PlayerTrigger name=eventIdString /> //A PlayerTrigger triggering the execution of the QuestEffectBeacon.
     208    </attached>
     209</QuestEffectBeacon>
     210}}}
     211
     212The QuestEffectBeacon can only be executed a defined number of times (where -1 times stands for an infinite number of times) and the QuestEffects are invoked whenever the method 'execute' is called, which is (indirectly through an EventListener, because I wanted to attach the PlayerTrigger so that his position is always relative to the QuestEffectBeacons position) done by the PlayerTrigger.
     213A PlayerTrigger is a special sort of Trigger that knows the player that triggered the Trigger and therefore can be asked who triggered him and that way allows theQuestEffects to be executed on the right player. So far only DistanceTrigger is a PlayerTrigger and the target of the DistanceTrigger is a ControllableEntity (or an object that is derived form the ControllableEntity).