Stendhal Quest Coding - Part 3: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Hendrik Brummermann
No edit summary
imported>Kymara
typos
Line 12: Line 12:
== Rewarding the player ==
== 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.
In the last section of this tutorial we taught Hayunn to only accept one beer per player. We didn't actually take 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:
We have to do several things at once:
* take the beer from the player
* take the beer from the player
* provide some money as refund
* provide some money as refund
* increase the xp and karmy
* increase the xp and karma
* and finally remember that the quest was completed
* 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 tasks that can be combined using a MultiAction:
But don't worry, that sounds more complicated than it actually is. There are already actions for all of these tasks that can be combined using a MultipleAction:


<source lang="java">
<source lang="java">
Line 42: Line 42:
Let's make it a bit easier for player to remember that they bought a beer in order to give it to Hayunn. Hayunn will notice the beer as soon as the player says "hi" and actively asks for it.
Let's make it a bit easier for player to remember that they bought a beer in order to give it to Hayunn. Hayunn will notice the beer as soon as the player says "hi" and actively asks for it.


Therefore we add a new trigger for the GREETING_MESSAGE. There is an internal rule that transitions which have a condition (that is true) are preferred over equal transitions without one. So our greeting transition is used instead of the normal one if the player has the item and the quest is active. Similar to the MultiAction there is an AndCondition which combines multiple elementary ones.
Therefore we add a new trigger for the GREETING_MESSAGE. There is an internal rule that transitions which have a condition (that is true) are preferred over equal transitions without one. So our greeting transition is used instead of the normal one if the player has the item and the quest is active. Similar to the MultipleAction, there is an AndCondition which combines multiple elementary ones.


<source lang="java">
<source lang="java">
Line 97: Line 97:
== Quest Documentation ==
== Quest Documentation ==


We are almost done now. Almost? Yes, a very important thing is still missing. And we should have done it as the first thing. But well, better late than never
We are almost done now. Almost? Yes, a very important thing is still missing. And we should have done it as the first thing. But well, better late than never.


<source lang="java">
<source lang="java">