Code: Select all
--[[
Testing Spawn Script
By Durge
--]]
local quest1 = 1337 --Creates a local variable 'quest1' that uses the DB quest id of '1337'
local quest2 = 1338 --Same as above, just a different quest
function spawn(NPC) --When the npc is spawned
ProvidesQuest(NPC, quest1) --This npc will provide the quest as declared in the local variable quest1
ProvidesQuest(NPC, quest2) --Same as above, just adds quest2 to this npc as well
end --Ends the function
function respawn(NPC) --When the npc respawns
spawn(NPC) --Spawn the npc again
end
function hailed(NPC, Player) --When the 'Player' hails the 'NPC'
FaceTarget(NPC, Player) --Makes the 'NPC' face the 'Player'
conversation = CreateConversation() --Starts a conversation called 'conversation'
--[[
This quest will have the player talk to the npc, recieve a contract
to kill a mob and retrieve an item from them, then find the gem and kill the goblin for that
--]]
if HasCompletedQuest(Player, quest1) then --If quest1 has been completed, moves on to check quest2
if HasCompletedQuest(Player, quest2) then --If quest2 is completed, then do
Say(Player, "Thank you so much, I will remember this friend.") --Text to display once player has finished all quests
elseif HasQuest(Player, quest2) then --Else if the player has quest2
OnQuest2(NPC, Player, conversation) --Leads to the conversation that describes quest
else --Else
StartQuest2(NPC, Player, conversation) --Leads to the conversation to start the quest
end --End the quest2 functions
elseif HasQuest(Player, quest1) then --Else if the player has the first quest
OnQuest1(NPC, Player, conversation) --Leads to the conversation that describes quest
else --Else
StartQuest1(NPC, Player, conversation) --Leads to conversation to start the first quest
end
end
--[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
Quest 1
--]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
function StartQuest1(NPC, Player, conversation) --Function to start the first quest
FaceTarget(NPC, Player) --Faces the player
AddConversationOption(conversation, "I'm listening, what is it you need me to find?", Dialog_1_1) --A dialog option for player
AddConversationOption(conversation, "What are you talking about you old crone.") --A dialog option for player
StartConversation(conversation, NPC, Player, "Welcome " .. GetName(Player) .. ", this is my humble abode, would you like to find a lost item for me?") --Starts the conversation with player
end
function Dialog_1_1(NPC, Player) --Function for the second dialog of quest
FaceTarget(NPC, Player) --Faces the player
conversation = CreateConversation() --Creates a new conversation for this dialog
OfferQuest(NPC, Player, quest1) --Offers the quest to the player
AddConversationOption(conversation, "Of course, just point me in the right direction", Dialog_1_2) --A dialog option for player
AddConversationOption(conversation, "I'm sorry, I do not have the time to spare.", Dialog_2_1) --A dialog option for player
StartConversation(conversation, NPC, Player, "Yes, a goblin seems to have snuck his way into my abode and stolen my precious amulet, I will reward you well if you recover this item.",) --Starts the conversation with player
end
function Dialog_1_2(NPC, Player) --Function for the the third part of dialog
FaceTarget(NPC, Player) --Faces the player
Say(Player, "Thank you " .. GetName(Player) .. " this was a family heirloom.") --Has the npc say something
end
function Dialog_2_1(NPC, Player) --Function for the first decline part of dialog
FaceTarget(NPC, Player) --Faces the player
Say(Player, "Think nothing of it, I'm sure you are a busy adventurer.") --Has the npc say something
end
function OnQuest1(NPC, Player, conversation) --If the player is already on this quest
if GetQuestStep(Player, quest1) == 1 then --Checks to see what step the player is on
Say(Player, "You still need to travel to the goblin's resting place.") --Hasn't found the goblin's resting area yet
elseif GetQuestStep(Player, quest1) == 2 then --Checks to see what step the player is on
Say(Player, "Where is my amulet? Have you killed the goblin yet?") --Hasn't killed the goblin yet
else --Else
AddConversationOption(conversation, "Here is your amulet, the goblin proved to be of little trouble.", Dialog_1_3) --A dialog option for player
AddConversationOption(conversation, "That goblin proved to be much more difficult than you lead on.", Dialog_1_3) --A dialog option for player
StartConversation(conversation, NPC, Player, "You have my amulet, yes?") --Starts the conversation with player
end
end
function Dialog_1_3(NPC, Player) --Function for fourth part of dialog
FaceTarget(NPC, Player) --Faces the player
conversation = CreateConversation() --Creates a new conversation for this dialog
SetStepComplete(Player, Quest1, 3) --Completes the first quest
AddConversationOption(conversation, "What is it you had in mind?", Dialog_1_4) --A dialog option for player
AddConversationOption(conversation, "Maybe another time.", Dialog_2_2) --A dialog option for player
StartConversation(conversation, NPC, Player, "I am most grateful, however, if you are up to the task, I have something else that might interest you.") --Starts the conversation with player
end
function Dialog_2_2(NPC, Player) --Function for the second leaving dialog
FaceTarget(NPC, Player) --Faces the player
Say(Player, "Very well, have a good day.") --Has the npc say something
end
--[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
Quest 2
--]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
function StartQuest2(NPC, Player, conversation) --Function to start the second quest
FaceTarget(NPC, Player) --Faces the player
AddConversationOption(conversation, "Where do you think the goblin may have lost it?", Dialog_1_3) --A dialog option for player
AddConversationOption(conversation, "This is a mighty expensive amulet you seem to have.", Dialog_2_3) --A dialog option for player
StartConversation(conversation, NPC, Player, "Back for more are we? Very well, in the process of stealing my amulet, the goblin seemed to have lost my gem, can you find it") --Starts the conversation with player
end
function Dialog_2_3(NPC, Player) --Function for the first leaving dialog of quest 2
FaceTarget(NPC, Player) --Faces the player
Say(Player, "Yes it is, it has been with my family for years, and it will stay that way.") --Has the npc say something
end
function Dialog_1_3(NPC, Player) --Function for the first dialog part of quest 2
FaceTarget(NPC, Player) --Faces the player
conversation = CreateConversation() --Creates a new conversation for this dialog
OfferQuest(NPC, Player, quest2) --Offers the second quest to the player
AddConversationOption(conversation, "Here we go again...", Dialog_1_4) --A dialog option for player
StartConversation(conversation, NPC, Player, "I think he may have lost it somewhere around his, camp, maybe another goblin picked it up.") --Starts the conversation with player
end
function Dialog_1_4(NPC, Player) --Function for the third dialog part of quest 2
FaceTarget(NPC, Player) --Faces the player
Say(Player, "I am glad that you are so intrigued by my task.") --Has the npc say something
end
function OnQuest2(NPC, Player, conversation) --If the player is already on the quest
if GetQuestStep(Player, quest2) == 1 then --Checks to see what step the player is on
Say(Player, "Have you found the goblin?") --Hasn't found the second goblin yet
elseif GetQuestStep(Player, quest2) == 2 then --Checks to see what step the player is on
Say(Player, "I suppose the goblin just handed it over now, did he?") --Hasn't killed the second goblin yet
else
AddConversationOption(conversation, "It was my pleasure, I am glad to see you happy once again.", Dialog_1_5) --A dialog option for player
AddConversationOption(conversation, "That goblin was downright nasty, I hope it was worth it", Dialog_1_5) --A dialog option for player
StartConversation(conversation, NPC, Player, "I am overjoyed! It is wonderful that my amulet can finally be fully restored.") --Starts the conversation with player
end
end
function Dialog_1_5(NPC, Player)
FaceTarget(NPC, Player) --Faces the player
SetStepComplete(Player, quest2, 3) --Completes the second quest
Say(Player, "I thank you deeply for your time, and are forever indebted to you.") --Has the npc say something
end
