Multi-Step Quest Taskgroup Example

Tutorials on setting up a server, configuring your client, and connecting to an EQ2Emulator server.
Only moderators can start new topics here
Forum rules
Most information about EQ2Emulator and Tutorials can be found at the Project Wiki. Look there for the most current information.
Locked
User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Multi-Step Quest Taskgroup Example

Post by thefoof » Wed May 15, 2013 8:42 pm

For a quest with multiple steps within a single taskgroup at once, here's one way to handle it. First add all the steps in the taskgroup at once, like this:

Code: Select all

function Init(Quest)
    AddQuestRewardCoin(Quest, math.random(6,70), math.random(1,3), 0, 0)
	AddQuestStepObtainItem(Quest, 1, "Harvest some elm lumber.", 3, 100, "I must harvest some crafting supplies in a nearby low-risk adventure area. Harvest nodes can generally be found on the ground in most outdoor adventure regions.", 826, 12098)
    AddQuestStepObtainItem(Quest, 2, "Harvest some roots.", 3, 100, "I must harvest some crafting supplies in a nearby low-risk adventure area. Harvest nodes can generally be found on the ground in most outdoor adventure regions.", 200, 11637)
    AddQuestStepObtainItem(Quest, 3, "Mine some tin clusters.", 3, 100, "I must harvest some crafting supplies in a nearby low-risk adventure area. Harvest nodes can generally be found on the ground in most outdoor adventure regions.", 3391, 14463) 
	AddQuestStepObtainItem(Quest, 4, "Mine some lead clusters.", 3, 100, "I must harvest some crafting supplies in a nearby low-risk adventure area. Harvest nodes can generally be found on the ground in most outdoor adventure regions.", 1086, 8808)
	AddQuestStepObtainItem(Quest, 5, "Fish up some sunfish.", 3, 100, "I must harvest some crafting supplies in a nearby low-risk adventure area. Harvest nodes can generally be found on the ground in most outdoor adventure regions.", 2540, 13586)
	AddQuestStepObtainItem(Quest, 6, "Harvest jumjum from a shrub or garden.", 3, 100, "I must harvest some crafting supplies in a nearby low-risk adventure area. Harvest nodes can generally be found on the ground in most outdoor adventure regions.", 816, 8486)
	AddQuestStepObtainItem(Quest, 7, "Trap some rawhide pelts from an animal den.", 3, 100, "I must harvest some crafting supplies in a nearby low-risk adventure area. Harvest nodes can generally be found on the ground in most outdoor adventure regions.", 125 , 11271)
    AddQuestStepCompleteAction(Quest, 1, "Lumber")
	AddQuestStepCompleteAction(Quest, 2, "Root")
	AddQuestStepCompleteAction(Quest, 3, "TinCluster")
	AddQuestStepCompleteAction(Quest, 4, "LeadCluster")
	AddQuestStepCompleteAction(Quest, 5, "Sunfish")
	AddQuestStepCompleteAction(Quest, 6, "Jumjum")
	AddQuestStepCompleteAction(Quest, 7, "RawhidePelt")
end
For each complete action, use whatever complete action you would use for that step normally, and add a line to run a function for a progress check. Here's an example complete function from this script:

Code: Select all

function Lumber(Quest, QuestGiver, Player)
    UpdateQuestStepDescription(Quest, 1, "I have harvested some elm lumber.")
    CheckProgress(Quest, QuestGiver, Player)
end
And here's the progress check referenced:

Code: Select all

function CheckProgress(Quest, QuestGiver, Player)
    if QuestStepIsComplete(Player, HarvestTutorial, 1) and QuestStepIsComplete(Player, HarvestTutorial, 2) and QuestStepIsComplete(Player, HarvestTutorial, 3) and QuestStepIsComplete(Player, HarvestTutorial, 4) and QuestStepIsComplete(Player, HarvestTutorial, 5) and QuestStepIsComplete(Player, HarvestTutorial, 6) and QuestStepIsComplete(Player, HarvestTutorial, 7) then
        UpdateQuestTaskGroupDescription(Quest, 1, "I harvested some crafting supplies.")
		AddQuestStepChat(Quest, 8, "I must return to the trainer with the harvested items.", 1, "I must return to the trainer who sent me out harvesting.", 0, 4700016)
		AddQuestStepCompleteAction(Quest, 8, "CompleteQuest")
	end
end
This script is found in "Quests\FrostfangSea\tutorial_learning_to_harvest.lua" for further reference.

Locked

Who is online

Users browsing this forum: No registered users and 0 guests