Stendhal Quest Coding - Part 3: Difference between revisions
Content deleted Content added
imported>Hendrik Brummermann splitted out of Stendhal Quest Coding - Part 2 |
imported>Hendrik Brummermann No edit summary |
||
Line 17:
== Rewarding the player ==
In the last section of this tutorial we taught Hayunn to only accept one beer per player. We did neither care about taking the beer from the player nor did we reward the player. We want to add this functionality now.
We have to do several things at once:
{{TODO|▼
* take the beer from the player
* provide some money as refund
}}▼
* increase the xp and karmy
* and finally remember that the quest was completed
But don't worry, that sounds more complicated than it actually is. There are already actions for all of these task that can be combined using a MultiAction:
<source lang="java">
final List<ChatAction> reward = new LinkedList<ChatAction>();
reward.add(new DropItemAction("beer"));
reward.add(new EquipItemAction("money", 20));
reward.add(new IncreaseXPAction(50));
reward.add(new IncreaseKarmaAction(10));
reward.add(new SetQuestAction(QUEST_SLOT, "done"));
npc.add(
ConversationStates.QUEST_ITEM_BROUGHT,
ConversationPhrases.YES_MESSAGES,
new PlayerHasItemWithHimCondition("beer"),
ConversationStates.ATTENDING,
"*glug glug* Ah! That hit the spot. Let me know if you need anything, ok?",
new MultipleActions(reward));
</source>
== Quest Documentation ==
Line 27 ⟶ 48:
* should be done much earlier usually
* content should be done earlier (see contributor's guide
▲}}
== Advanced Techniques ==
▲{{TODO|
* AlwaysTrueCondition
}}
| |||