Code: Select all
--[[
Script Name : Quests/Ruins/pawns_in_the_game.lua
Script Purpose : Handles the quest, "Pawns in the Game"
Script Author : Scatman
Script Date : 2009.07.28
Zone : The Ruins
Quest Giver: Captain Arellius
Preceded by: Reporting for Duty (reporting_for_duty.lua)
Followed by: Pounding the Enemy (pounding_the_enemy.lua)
--]]
function Init(Quest)
AddQuestStepKill(Quest, 1, "I must defeat ten Brokentusk pawns to prove my value to the Militia.", 10, 100, "I must aid Freeport by defeating the Brokentusk pawns.", 2489, 1270130, 1270027, 1270039, 1270022, 1270019, 1270087)
AddQuestStepCompleteAction(Quest, 1, "Step1_Complete_KilledOrcs")
end
function Accepted(Quest, QuestGiver, Player)
FaceTarget(QuestGiver, Player)
conversation = CreateConversation()
PlayFlavor(QuestGiver, "voiceover/english/tutorial_revamp/lieutenant_argosian/fprt_adv04_ruins/revamp/lieutenant_argosian009b.mp3", "", "", 3351588566, 3135177671, Player)
AddConversationOption(conversation, "I will do so.")
StartConversation(conversation, QuestGiver, Player, "Get to work, citizen. You have your orders, now carry them out.")
end
function Declined(Quest, QuestGiver, Player)
end
function Step1_Complete_KilledOrcs(Quest, QuestGiver, Player)
UpdateQuestStepDescription(Quest, 1, "I defeated 10 Brokentusk pawns and proved my worth.")
UpdateQuestTaskGroupDescription(Quest, 1, "I crushed the Brokentusk pawns as ordered.")
AddQuestStepChat(Quest, 2, "I should report back to Lieutenant Argosian at the first outpost.", 1, "I should return to the lieutenant and tell him of my victory.", 0, 1270031)
AddQuestStepCompleteAction(Quest, 2, "Quest_Complete")
end
function Quest_Complete(Quest, QuestGiver, Player)
UpdateQuestStepDescription(Quest, 2, "I have reported back to Lieutenant Argosian.")
UpdateQuestTaskGroupDescription(Quest, 2, "I have returned to the lieutenant.")
GiveQuestReward(Quest, Player)
UpdateQuestDescription(Quest, "Following the orders of Lieutenant Argosian, I defeated a number of the Brokentusk pawns. They were relatively easy prey, so I will ask Argosian for a more challenging assignment.")
end
function Reload(Quest, QuestGiver, Player, Step)
if Step == 1 then
Step1_Complete_KilledOrcs(Quest, QuestGiver, Player)
end
endSo let's break this down into pieces.
Code: Select all
function Init(Quest)
AddQuestStepKill(Quest, 1, "I must defeat ten Brokentusk pawns to prove my value to the Militia.", 10, 100, "I must aid Freeport by defeating the Brokentusk pawns.", 2489, 1270130, 1270027, 1270039, 1270022, 1270019, 1270087)
AddQuestStepCompleteAction(Quest, 1, "Step1_Complete_KilledOrcs")
endThe next function we run is AddQuestStepCompleteAction. This function tells LUA the name of a user-defined function to run once the given step is completed. You need one of these for every step in the quest. The first parameter is of course the reference to the quest. The second is the quest step we want to run this function for. So here we are saying that once step 1 is complete, run the function called "Step1_Complete_KilledOrcs".
Code: Select all
function Accepted(Quest, QuestGiver, Player)
FaceTarget(QuestGiver, Player)
conversation = CreateConversation()
PlayFlavor(QuestGiver, "voiceover/english/tutorial_revamp/lieutenant_argosian/fprt_adv04_ruins/revamp/lieutenant_argosian009b.mp3", "", "", 3351588566, 3135177671, Player)
AddConversationOption(conversation, "I will do so.")
StartConversation(conversation, QuestGiver, Player, "Get to work, citizen. You have your orders, now carry them out.")
end
function Declined(Quest, QuestGiver, Player)
endCode: Select all
function Step1_Complete_KilledOrcs(Quest, QuestGiver, Player)
UpdateQuestStepDescription(Quest, 1, "I defeated 10 Brokentusk pawns and proved my worth.")
UpdateQuestTaskGroupDescription(Quest, 1, "I crushed the Brokentusk pawns as ordered.")
AddQuestStepChat(Quest, 2, "I should report back to Lieutenant Argosian at the first outpost.", 1, "I should return to the lieutenant and tell him of my victory.", 0, 1270031)
AddQuestStepCompleteAction(Quest, 2, "Quest_Complete")
endNext, we want a second step defined. This is a chat step and this must be used if you want the little red floating book to appear over your quest NPC's head. The parameters are exactly the same as the kill step except we do not specify the % chance to update the quest step. This is because chat steps MUST be updated via spawnscript. So somewhere in the quest NPC's spawnscript, you will need some logic to determine if you have the quest. If the player has the quest and is on step 2, say this and update the step (check out the LUA functions HasQuest, GetQuestStep, and SetStepComplete). Notice the step icon is 0, meaning there will be no icon, just a square bullet. The last parameter is of course the spawn ID that we want the red floating book to appear over.
After that, we once again tell LUA we want to run the function "Quest_Complete" once step 2 is completed.
Code: Select all
function Quest_Complete(Quest, QuestGiver, Player)
UpdateQuestStepDescription(Quest, 2, "I have reported back to Lieutenant Argosian.")
UpdateQuestTaskGroupDescription(Quest, 2, "I have returned to the lieutenant.")
GiveQuestReward(Quest, Player)
UpdateQuestDescription(Quest, "Following the orders of Lieutenant Argosian, I defeated a number of the Brokentusk pawns. They were relatively easy prey, so I will ask Argosian for a more challenging assignment.")
endWe then tell LUA to give the player the quest rewards for this quest. Quest rewards are defined in the `quest_details` database table.
Finally, we want to update the quest description to whatever we want it to say when the quest reward dialog box comes up where you accept your rewards.
Code: Select all
function Reload(Quest, QuestGiver, Player, Step)
if Step == 1 then
Step1_Complete_KilledOrcs(Quest, QuestGiver, Player)
end
endWhat happens when our quest has more than two steps? Let's say our quest has four steps instead of two. The player finishes step 1, 2, and 3 so the player is on the final step, 4. Our Reload function would look something LIKE this:
Code: Select all
function Reload(Quest, QuestGiver, Player, Step)
if Step == 1 then
Step1_Complete_KilledOrcs(Quest, QuestGiver, Player)
elseif Step == 2 then
Step2_Complete(Quest, QuestGiver, Player)
elseif Step == 3 then
Step3_Complete(Quest, QuestGiver, Player)
end
endThat's about it for a very simple quest like this. Remember, a spawnscript is absolutely needed for this quest since there is a chat step. As stated before, chat steps can only be updated via the SetStepComplete function. Let me know if you have any questions or something that I did not address.


