- Introduction
- quests
- Methods
- quests:create
- quests:load
- quests:unload
- quests:cache
- quests:isLoaded
- quests:listAll
- quests:list
- quests:listStates
- quests:getQuest
- quests:getQuestFromSlot
- quests:getOpen
- quests:getCompleted
- quests:getIncomplete
- quests:getRepeatable
- quests:getDescription
- quests:getLevelWarning
- quests:getProgressDetails
- quests:getNPCNamesForUnstartedInRegionForLevel
- quests:getDescriptionForUnstartedInRegionFromNPCName
- Methods
- Classes
Introduction
Adds helper functions for creating & manipulating quests & exposes select public methods of the {@link games.stendhal.server.core.rp.StendhalQuestSystem} class.
quests
Methods
quests:create
quests:create(slotName, name)
- Creates a new quest.
- Parameters:
- slotName: (optional) The string identifier for the quest.
- name: (optional) The human-readable name that can be shown in travel log.
- Returns: New {@link games.stendhal.server.core.scripting.lua.LuaQuestHelper.LuaQuest LuaQuest} instance.
quests:load
quests:load(quest)
- Adds a quest to the world.
- Parameters:
- quest: The {@link games.stendhal.server.maps.quests.IQuest IQuest} instance to be loaded.
quests:unload
quests:unload(questName)
- Removes a quest from the world.
- Parameters:
- questName: String name of the quest to be removed.
quests:cache
quests:cache(quest)
- Caches a quest for loading at server startup.
- Parameters:
- quest: {@link games.stendhal.server.maps.quests.IQuest IQuest} instance to be loaded.
- Aliases:
- quests:register
quests:isLoaded
quests:isLoaded(quest)
- Checks if a quest has been loaded.
- Parameters:
- quest: {@link games.stendhal.server.maps.quests.IQuest IQuest} instance to check.
- Returns:
true
if the instance matches stored quests.
quests:listAll
quests:listAll(player)
- List all quests the player knows about.
- Parameters:
- player: Player to create the report for.
- Returns: String report.
quests:list
quests:list(player, questName)j
- Creates a report on a specified quest for a player.
- Parameters:
- player: Player to create the report for.
- questName: Name of quest to be reported.
- Returns: String report.
quests:listStates
quests:listStates(player)
- Dumps the internal quest states for the specified player. This is used for the {@link games.stendhal.server.action.admin.InspectAction InspectAction}.
- Parameters:
- player: Player to create the report for.
- Returns: String report.
quests:getQuest
quests:getQuest(questName)
- Retrieves the {@link games.stendhal.server.maps.quests.IQuest IQuest} object for a named quest.
- Parameters:
- questName: Name of quest.
- Returns:
IQuest
ornull
if doesn't exist.
quests:getQuestFromSlot
quests:getQuestFromSlot(questSlot)
- Retrieves the {@link games.stendhal.server.maps.quests.IQuest IQuest} object for a quest.
- Parameters:
- questSlot: Quest identifier string.
- Returns:
IQuest
ornull
if doesn't exist.
quests:getOpen
quests:getOpen(player)
- Retrieves a list of open quests from a player.
- Parameters:
- player: {@link games.stendhal.server.entity.player.Player Player} instance to be checked.
- Returns: List of string identifiers for open quests.
quests:getCompleted
quests:getCompleted(player)
- Retrieves a list of completed quests from a player.
- Parameters:
- player: {@link games.stendhal.server.entity.player.Player Player} instance to be checked.
- Returns: List of string identifiers for completed quests.
quests:getIncomplete
quests:getIncomplete(player, region)
- Retrieves a list of incomplete quests in a specified region.
- Parameters:
- player: {@link games.stendhal.server.entity.player.Player Player} instance to be checked.
- region: Region name/identifier.
- Returns: List of string identifiers of incomplete quests in region.
quests:getRepeatable
quests:getRepeatable(player)
- Retrieves a list of quests a player has completed, and can now do again.
- Parameters:
- player: {@link games.stendhal.server.entity.player.Player Player} instance to be checked.
- Returns:
quests:getDescription
quests:getDescription(player, questName)
- Retrieves the description of a quest.
- Parameters:
- player: {@link games.stendhal.server.entity.player.Player Player} instance to be checked.
- questName: Name of the quest.
- Returns:
{@link java.lang.String String}
description.
quests:getLevelWarning
quests:getLevelWarning(player, questName)
- If the quest is too dangerous, add a warning unless the player has already completed it.
- Parameters:
- player: {@link games.stendhal.server.entity.player.Player Player} instance to be checked.
- questName: Name of the quest.
- Returns:
{@link java.lang.String String}
quests:getProgressDetails
quests:getProgressDetails(player, questeName)
- Retrieves details on the progress of the quest.
- Parameters:
- player: {@link games.stendhal.server.entity.player.Player Player} instance to be checked.
- questName: Name of the quest.
- Returns:
{@link java.util.List List}<{@link java.lang.String String}>
quests:getNPCNamesForUnstartedInRegionForLevel
quests:getNPCNamesForUnstartedInRegionForLevel(player, region)
- Retrieves a list of the unique npc names for unstarted quests in a specified region.
- Parameters:
- player: {@link games.stendhal.server.entity.player.Player Player} instance to be checked.
- region: Region to check in.
- Returns:
{@link java.util.List List}<{@link java.lang.String String}>
quests:getDescriptionForUnstartedInRegionFromNPCName
quests:getDescriptionForUnstartedInRegionFromNPCName(player, region, name)
- Retrieves quest descriptions for unstarted quests in a specified region matching a specific NPC name.
- Parameters:
- player: {@link games.stendhal.server.entity.player.Player Player} instance to be checked.
- region: Region to check in.
- name: Name of NPC.
- Returns:
{@link java.util.List List}<{@link java.lang.String String}>
Classes
LuaQuest
See: {@link games.stendhal.server.core.scripting.lua.LuaQuestHelper.LuaQuest LuaQuest}
Public Members
LuaQuest.init
LuaQuest.init
- Called by {@link games.stendhal.server.maps.quests.IQuest#addToWorld}.
- Type: function
Public Methods
Usage
local loadStep1 = function()
...
end
local loadStep2 = function()
...
end
local myQuest = quests:create("my_quest", "My Quest")
myQuest.init = function()
loadStep1()
loadStep2()
end
quests:register(myQuest)
quests.simple
A special class for creating a simple collect single item quest.
Methods:
quests.simple:create
quests.simple:create(slotName, properName, npcName)
- Parameters:
- slotName:
String
identifier to be used for quest. - properName: Human-readable name to be displayed in travel log.
- npcName: The NPC associated with the quest.
- slotName:
- Returns: {@link games.stendhal.server.maps.quests.SimpleQuestCreator} instance.
SimpleQuest Object
{@link games.stendhal.server.maps.quests.SimpleQuestCreator.SimpleQuest}
Methods
setDescription
setDescription(descr)
- Parameters:
- descr: (
String
)
- descr: (
setRepeatable
setRepeatable(delay)
- Parameters:
- delay: (
Integer
)
- delay: (
setItemToCollect
setItemToCollect(itemName, quantity)
- Parameters:
- itemName: (
String
) - quantity: (
int
)
- itemName: (
setXPReward
setXPReward(xp)
- Parameters:
- xp: (
int
)
- xp: (
setKarmaReward
setKarmaReward(karma)
- Parameters:
- karma: (
double
)
- karma: (
setKarmaAcceptReward
setKarmaAcceptReward(karma)
- Parameters:
- karma: (
double
)
- karma: (
setKarmaRejectReward
setKarmaRejectReward(karma)
- Parameters:
- karma: (
double
)
- karma: (
addItemReward
addItemReward(itemName, quantity)
- Parameters:
- itemName: (
String
) - quantity: (
int
) (optional)
- itemName: (
addStatReward
addStatReward(id, amount)
- Parameters:
- id: (
String
) See IDs below. - amount: (
int
)
- id: (
- IDs:
- xp:
- def:
- atk:
- ratk:
setVerboseReward
setVerboseReward(verbose)
- Parameters:
- verbose: (
boolean
)
- verbose: (
setReply
setReply(id, reply)
- Parameters:
- id: (
String
) See IDs below. - reply: (
String
)
- id: (
:; ''IDs:'' :: '''''request:''''' :: '''''accept:''''' :: '''''reject:''''' :: '''''reward:''''' :: '''''verbose_reward_prefix:''''' :: '''''already_active:''''' :: '''''missing:''''' :: '''''no_repeat:''''' :: '''''cooldown_prefix:'''''
setRegion
setRegion(regionName)
- Parameters:
- regionName: (
String
)
- regionName: (
Also inherits methods from {@link games.stendhal.server.maps.quests.AbstractQuest}:
Example:
-- create SimpleQuest instance
local quest = simpleQuest:create("wood_for_lua", "Wood for Lua", "Lua")
quest:setDescription("Lua needs help gathering wood.")
quest:setRequestReply("I need help gathering some wood. Will you help me?")
quest:setAcceptReply("Great!")
quest:setRewardReply("Thank a bunch!")
quest:setRejectReply("Fine! I don't need your help anyway.")
quest:setItemToCollect("wood", 5)
quest:setRepeatable(true)
quest:setRepeatDelay(10)
quest:setXPReward(50)
quest:setKarmaReward(5.0)
quest:addItemReward("rose", 3)
quest:addItemReward("money", 100)
quest:setRegion(Region.SEMOS_CITY)
quests:register(quest)