Stendhal Quest Coding - Part 3: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
imported>Kymara |
imported>Kribbel m replace 2 old links |
||
| (19 intermediate revisions by one other user not shown) | |||
| Line 168: | Line 168: | ||
There are a few ways to check the states. Some developers use ChatConditions like we did when setting the NPC conversation. Others use more direct checks on the quest state. If using ChatConditions, these have been written to work with the add method for the NPC. If you just want to use them to get a true/false value directly, , you need to get at the 'fire', for example <code>(new() QuestCompletedCondition(QUEST_SLOT).fire(player, null, null)</code>. |
There are a few ways to check the states. Some developers use ChatConditions like we did when setting the NPC conversation. Others use more direct checks on the quest state. If using ChatConditions, these have been written to work with the add method for the NPC. If you just want to use them to get a true/false value directly, , you need to get at the 'fire', for example <code>(new() QuestCompletedCondition(QUEST_SLOT).fire(player, null, null)</code>. |
||
=== getQuestInfo === |
=== getQuestInfo / fillQuestInfo === |
||
{{TODO|populate with an example from BeerForHayunn and explanation}} |
{{TODO|populate with an example from BeerForHayunn and explanation}} |
||
=== getMinLevel === |
=== getMinLevel === |
||
This piece of meta information suggests the minimum level of player who may be expected to completed the quest. It's not a hard requirement - ChatConditions on the level should be used if you really want to add a level restriction, when the NPC offers the quest. |
|||
{{TODO|populate with an example from BeerForHayunn and explanation}} |
|||
This value is used in the travel log and for other NPCs who might hint that you start unstarted quests - they won't hint at unstarted quests beyond your level. If the value is 0, i.e. any player can do it, you don't need to add this method, as this is the default (though, BeerForHayunn does explicitly set the value to 0 and there is no harm in this.) |
|||
<source lang="java"> |
|||
@Override |
|||
public int getMinLevel() { |
|||
return 10; |
|||
} |
|||
</source> |
|||
=== getRegion === |
=== getRegion === |
||
If there is a specific region matching one of the Stendhal regions, as defined in [ |
If there is a specific region matching one of the Stendhal regions, as defined in [https://github.com/arianne/stendhal/blob/master/src/games/stendhal/server/maps/Region.java Region.java], then you can set this here and any achievements or NPCs referring to quests from that region will notice the quest. You can leave this method out if you have no region to set (e.g. global quests) because the default is null. |
||
<source lang = "java"> |
<source lang = "java"> |
||
| Line 200: | Line 209: | ||
== Further Reading and Complete Code == |
== Further Reading and Complete Code == |
||
You can have a look at the [ |
You can have a look at the [https://github.com/arianne/stendhal/blob/master/src/games/stendhal/server/maps/quests/BeerForHayunn.java complete source code for this quest]. |
||
The pages might be of interest to you: |
The pages might be of interest to you: |
||
| Line 206: | Line 215: | ||
* [[HowToAddMapsServerStendhal|How to add new maps to server]] |
* [[HowToAddMapsServerStendhal|How to add new maps to server]] |
||
* [[HowToAddMapsServerStendhal#Adding_NPC|How to create NPC]] |
* [[HowToAddMapsServerStendhal#Adding_NPC|How to create NPC]] |
||
* [[How to test NPC Parser]] - ''this can help with trouble shooting'' |
* [[How to test NPC Parser]] - ''this can help with trouble shooting if an NPC isn't understanding a response'' |
||
[[Category:Stendhal]] |
[[Category:Stendhal]] |
||