Contents


Introduction

Object instance: quests


Description

Adds helper functions for creating & manipulating quests & exposes select public methods of the StendhalQuestSystem class.

Methods


quests:cache

quests:cache quest

quests:create

quests:create
quests:create slotName
quests:create slotName, name
quests:create slotName, name, desc

quests:createBuilder

quests:createBuilder task

quests:createManuscript

quests:createManuscript builder

quests:getCompleted

quests:getCompleted player

quests:getDescription

quests:getDescription player, questName

quests:getDescriptionForUnstartedInRegionFromNPCName

quests:getDescriptionForUnstartedInRegionFromNPCName player, region, name

quests:getIncomplete

quests:getIncomplete player, region

quests:getLevelWarning

quests:getLevelWarning player, questName

quests:getNPCNamesForUnstartedInRegionForLevel

quests:getNPCNamesForUnstartedInRegionForLevel player, region

quests:getOpen

quests:getOpen player

quests:getProgressDetails

quests:getProgressDetails player, questeName

quests:getQuest

quests:getQuest questName

quests:getQuestFromSlot

quests:getQuestFromSlot questSlot

quests:getRepeatable

quests:getRepeatable player

quests:isLoaded

quests:isLoaded quest

quests:list

quests:list player, questName

quests:listAll

quests:listAll player

quests:listStates

quests:listStates player

quests:load

quests:load quest

quests:register

quests:register quest

quests:unload

quests:unload questName

Classes


LuaQuest

See: LuaQuest


Public Members


LuaQuest.completedCheck

LuaQuest.completedCheck

LuaQuest.formattedHistory

LuaQuest.formattedHistory

LuaQuest.history

LuaQuest.history

LuaQuest.init

LuaQuest.init

LuaQuest.remove

LuaQuest.remove

LuaQuest.repeatableCheck

LuaQuest.repeatableCheck

LuaQuest.startedCheck

LuaQuest.startedCheck

Public Methods


LuaQuest:addToWorld

LuaQuest:addToWorld

LuaQuest:getFormattedHistory

LuaQuest:getFormattedHistory player

LuaQuest:getHistory

LuaQuest:getHistory player

LuaQuest:getMinLevel

LuaQuest:getMinLevel

LuaQuest:getNPCName

LuaQuest:getNPCName

LuaQuest:getName

LuaQuest:getName

LuaQuest:getOriginalName

LuaQuest:getOriginalName

LuaQuest:getRegion

LuaQuest:getRegion

LuaQuest:getSlotName

LuaQuest:getSlotName

LuaQuest:isCompleted

LuaQuest:isCompleted player

LuaQuest:isRepeatable

LuaQuest:isRepeatable

LuaQuest:isStarted

LuaQuest:isStarted player

LuaQuest:isVisibleOnQuestStatus

LuaQuest:isVisibleOnQuestStatus

LuaQuest:register

LuaQuest:register
LuaQuest:register func

LuaQuest:removeFromWorld

LuaQuest:removeFromWorld

LuaQuest:setAddFunction

LuaQuest:setAddFunction func

LuaQuest:setCompletedCheckFunction

LuaQuest:setCompletedCheckFunction func

LuaQuest:setDescription

LuaQuest:setDescription desc

LuaQuest:setFormattedHistoryFunction

LuaQuest:setFormattedHistoryFunction func

LuaQuest:setHistoryFunction

LuaQuest:setHistoryFunction func

LuaQuest:setMinLevel

LuaQuest:setMinLevel level

LuaQuest:setNPCName

LuaQuest:setNPCName name

LuaQuest:setName

LuaQuest:setName name

LuaQuest:setRegion

LuaQuest:setRegion region

LuaQuest:setRemoveFunction

LuaQuest:setRemoveFunction func

LuaQuest:setRepeatable

LuaQuest:setRepeatable

LuaQuest:setRepeatableCheckFunction

LuaQuest:setRepeatableCheckFunction func

LuaQuest:setSlotName

LuaQuest:setSlotName slot

LuaQuest:setStartedCheckFunction

LuaQuest:setStartedCheckFunction func

LuaQuest:setVisibleOnQuestStatus

LuaQuest:setVisibleOnQuestStatus visible

Usage Examples

Standard quest example:

local loadStep1 = function()
    ...
end

local loadStep2 = function()
    ...
end

local myQuest = quests:create("my_quest", "My Quest")
myQuest:register(function()
    loadStep1()
    loadStep2()
end)

Example of CoalForHaunchy quest manuscript converted to Lua:

local itemBuilder = quests:createBuilder("BringItemTask")

itemBuilder:info()
    :name("Coal for Haunchy")
    :description("Haunchy Meatoch is afraid of his BBQ grillfire. Will his coal last till the steaks are ready or will he need some more?")
    :internalName("coal_for_haunchy")
    :repeatableAfterMinutes(2 * 24 * 60)
    :minLevel(0)
    :region(Region.ADOS_CITY)
    :questGiverNpc("Haunchy Meatoch")

itemBuilder:history()
    :whenNpcWasMet("Haunchy Meatoch welcomed me to the Ados market.")
    :whenQuestWasRejected("He asked me to fetch him some pieces of coal but I don't have time to collect some.")
    :whenQuestWasAccepted("The BBQ grill-heat is low and I promised Haunchy to help him out with 25 pieces of coal.")
    :whenTaskWasCompleted("I found 25 pieces of coal for the Haunchy and think he will be happy.")
    :whenQuestWasCompleted("Haunchy Meatoch was really happy when I gave him the coal, he has enough for now. He gave me some of the best steaks which I ever ate!")
    :whenQuestCanBeRepeated("But I'd bet his amount is low again and needs more. Maybe I'll get more grilled tasty steaks.")

itemBuilder:offer()
    :respondToRequest("I cannot use wood for this huge BBQ. To keep the heat I need some really old stone coal but there isn't much left. The problem is, that I can't fetch it myself because my steaks would burn then so I have to stay here. Can you bring me 25 pieces of #coal for my BBQ please?")
    :respondToUnrepeatableRequest("The coal amount behind my counter is still high enough. I will not need more for some time.")
    :respondToRepeatedRequest("The last coal you brought me is mostly gone again. Will you bring me some more?")
    :respondToAccept("Thank you! I'll be sure to give you a nice and tasty reward.")
    :respondTo({"coal"}):saying("Coal isn't easy to find. You normally can find it somewhere in the ground but perhaps you are lucky and find some in the old Semos Mine tunnels... Will you help me?")
    :respondToReject("Oh, never mind. I thought you love BBQs like I do. Bye then.")
    :rejectionKarmaPenalty(10.0)
    :remind("Luckily my BBQ is still going. But please hurry up to bring me 25 coal as you promised.")

entities:getNPC("Haunchy Meatoch"):addReply("coal", "Sometime you could do me a #favor ...")

itemBuilder:task()
    :requestItem(25, "coal")

itemBuilder:complete()
    :greet("Ah, I see, you have enough coal to keep my BBQ on! Is it for me?")
    :respondToReject("Well then, hopefully someone else will help me before my BBQ goes out.")
    :respondToAccept(nil)
    :rewardWith(actions:create("IncreaseXPAction", {200}))
    :rewardWith(actions:create("IncreaseKarmaAction", {20}))
    :rewardWith(actions:create("EquipRandomAmountOfItemAction", {"grilled steak", 1, 4, 1,
        "Thank you! Take [this_these] [number_item] from my grill!"}))

quests:register(quests:createManuscript(itemBuilder))