LUA Quest Information
Moderator: Team Members
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
-
LethalEncounter
- Team: Zombie
- Posts: 2717
- Joined: Wed Jul 25, 2007 10:10 pm
BTW, a heads up. I changed the way the quest system works to make more logical sense and to be like live.
Changes:
1. Instead of making you add a new step to turn a quest it, you simply tell it which NPC you will turn it in to.
2. Completed Quests should be properly displayed.
3. Added a few new LUA functions:
QuestIsComplete(Spawn, Quest ID) - returns true if the player has the quest, has not turned it in, and it is completed
GetQuest(Spawn, Quest ID) - Retrieves the existing active quest for the player. Returns 0 if the player doesn't have the current quest or it is completed.
QuestReturnNPC(Quest, Spawn ID) - Sets the spawn id of the spawn that the player needs to turn the quest into.
SetQuestCompleteAction(Quest, Function Name) - Sets the LUA function name that should be called once the player completes all steps.
4. Instead of turning it in right away as soon as you talked to the NPC, you can turn it in after talking to it via the conversation system.
5. Fixed some visual bugs with the system.
The New Murrar Shar.lua file (it looks more complicated that it actually is):
The new KillCrabs.lua:
Screenshots:
http://eq2emulator.net/ScreenShots/QuestSystem22.jpg
http://eq2emulator.net/ScreenShots/QuestSystem23.jpg
http://eq2emulator.net/ScreenShots/QuestSystem24.jpg
http://eq2emulator.net/ScreenShots/QuestSystem25.jpg
Changes:
1. Instead of making you add a new step to turn a quest it, you simply tell it which NPC you will turn it in to.
2. Completed Quests should be properly displayed.
3. Added a few new LUA functions:
QuestIsComplete(Spawn, Quest ID) - returns true if the player has the quest, has not turned it in, and it is completed
GetQuest(Spawn, Quest ID) - Retrieves the existing active quest for the player. Returns 0 if the player doesn't have the current quest or it is completed.
QuestReturnNPC(Quest, Spawn ID) - Sets the spawn id of the spawn that the player needs to turn the quest into.
SetQuestCompleteAction(Quest, Function Name) - Sets the LUA function name that should be called once the player completes all steps.
4. Instead of turning it in right away as soon as you talked to the NPC, you can turn it in after talking to it via the conversation system.
5. Fixed some visual bugs with the system.
The New Murrar Shar.lua file (it looks more complicated that it actually is):
Code: Select all
function spawn(NPC)
ProvidesQuest(NPC, 1)
end
function hailed(NPC, Spawn)
FaceTarget(NPC, Spawn)
conversation = CreateConversation()
if HasQuest(Spawn, 1) then
if QuestIsComplete(Spawn, 1) then
AddConversationOption(conversation, "Yup. Got my money, or am I gonna have to get physical with you?", "QuestComplete")
StartConversation(conversation, NPC, Spawn, "Hello again " .. GetName(Spawn) .. ". Did you kill all the crabs as I requested?")
else
AddConversationOption(conversation, "No problem")
StartConversation(conversation, NPC, Spawn, "Hello again " .. GetName(Spawn) .. ". Thank you for accepting my task.")
end
else
if HasCompletedQuest(Spawn, 1) then
AddConversationOption(conversation, "Anytime")
StartConversation(conversation, NPC, Spawn, "Hello again " .. GetName(Spawn) .. ". Thank you for killing those crabs.")
else
AddConversationOption(conversation, "Why can't you kill them?", "KillThemYourself")
AddConversationOption(conversation, "Why should I help you?", "WhyHelpYou")
StartConversation(conversation, NPC, Spawn, "Greetings " .. GetName(Spawn) .. "! Thank you for coming. Could you please kill some of the crabs on the shore for me? I haven't liked them ever since I was pinched as a child.")
end
end
end
function KillThemYourself(NPC, Spawn)
conversation = CreateConversation()
AddConversationOption(conversation, "A dragon? Right.... Anyways, I want a good pair of leggings for this favor.", "GiveMeQuest")
AddConversationOption(conversation, "I'll need 12 bottles of Rum, 3 pints of Ale, and 12 gold pieces. I'm not risking my life for nothing!", "TooGreedy")
StartConversation(conversation, NPC, Spawn, "I could kill them myself, but my sword was recently damaged while I was battling a dragon.")
end
function TooGreedy(NPC, Spawn)
conversation = CreateConversation()
AddConversationOption(conversation, "Have Fun.")
StartConversation(conversation, NPC, Spawn, "Forget it, you are too greedy. I'll get another adventurer to do it for me.")
Emote(NPC, " makes a rude gesture at you.", Spawn)
end
function GiveMeQuest(NPC, Spawn)
OfferQuest(NPC, Spawn, 1)
conversation = CreateConversation()
AddConversationOption(conversation, "Bye")
StartConversation(conversation, NPC, Spawn, "Well you drive a hard bargain, but very well. I agree to your terms.")
end
function WhyHelpYou(NPC, Spawn)
conversation = CreateConversation()
AddConversationOption(conversation, "Give me some coins and some of those leggings the merchant is selling.", "GiveMeQuest")
AddConversationOption(conversation, "Hmm, how much do you have? I don't know if you have enough to pay me what I want...", "TooGreedy")
StartConversation(conversation, NPC, Spawn, "I will pay you if you are that greedy...")
end
function QuestComplete(NPC, Spawn)
conversation = CreateConversation()
AddConversationOption(conversation, "I'll let it go... THIS TIME.")
StartConversation(conversation, NPC, Spawn, "I have it right here, please don't hurt me.")
Quest = GetQuest(Spawn, 1)
if Quest ~= nil then
GiveQuestReward(Quest, Spawn)
end
endCode: Select all
--[[
This is the EQ2Emu example LUA Quest.
These functions are shared, so don't save any character data in them.
If you have any questions be sure to read the Quest Functions.txt in the Quests directory or the wiki site location on the eq2emulator.net website.
--]]
function Init(Quest)
RegisterQuest(Quest, "Kill Crabs", "Hallmark", "Queen's Colony", 1, "Murrar Shar is deathly afraid of crabs and wants you to kill some of them for him.")
AddQuestRewardItem(Quest, 1001)
AddQuestRewardCoin(Quest, 78)
SetQuestRewardExp(Quest, 200)
SetQuestPrereqLevel(Quest, 1)
AddQuestStepKill(Quest, 1, "Kill 5 of the crabs on the nearby shore", 5, "Kill Crabs for Murrar Shar", 28, 546, 568, 569)
AddQuestStepCompleteAction(Quest, 1, "KilledAllCrabs")
SetCompletedDescription(Quest, "This is the description that is displayed when the quest is completed and shown in the completed quest list.")
QuestReturnNPC(Quest, 547)
end
function Accepted(Quest, QuestGiver, Player)
if QuestGiver ~= nil then
if GetDistance(Player, QuestGiver) < 30 then
FaceTarget(QuestGiver, Player)
Say(QuestGiver, "Thank you for accepting this task " .. GetName(Player) .. ". Please return to me when you have completed it.")
Emote(QuestGiver, " thanks you warmly.", Player)
end
end
end
function Declined(Quest, QuestGiver, Player)
if QuestGiver ~= nil then
if GetDistance(Player, QuestGiver) < 30 then
FaceTarget(QuestGiver, Player)
Say(QuestGiver, "If you change your mind " .. GetName(Player) .. ", you know where to find me.")
Emote(QuestGiver, " glares at you.", Player)
end
end
end
function KilledAllCrabs(Quest, QuestGiver, Player)
UpdateQuestStepDescription(Quest, 1, "I killed the crabs as Murrar requested.")
UpdateQuestDescription(Quest, "I killed some of the crabs on the beach. Return to Murrar Shar for your reward.")
end
http://eq2emulator.net/ScreenShots/QuestSystem22.jpg
http://eq2emulator.net/ScreenShots/QuestSystem23.jpg
http://eq2emulator.net/ScreenShots/QuestSystem24.jpg
http://eq2emulator.net/ScreenShots/QuestSystem25.jpg
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
I retract my earlier statement that I would discontinue to ask stupid questions. 
Aside from Windows, will there be any problems with special characters (apostrophes, commas, spaces, etc) in NPC names for our scripts? I am getting "Murrar Shar.lua" to load properly, as I can accept his quest.
However, "KillCrabs.lua" is either not loading, or I have again configured something wrong. I do not see the Quest ID 1 inserting into my character_quests table. I think that is why I cannot complete the quest as I saw in your screen shots... so forgive me if the screenies are a preview, and I still need to sit the hell still a while longer.
Aside from Windows, will there be any problems with special characters (apostrophes, commas, spaces, etc) in NPC names for our scripts? I am getting "Murrar Shar.lua" to load properly, as I can accept his quest.
However, "KillCrabs.lua" is either not loading, or I have again configured something wrong. I do not see the Quest ID 1 inserting into my character_quests table. I think that is why I cannot complete the quest as I saw in your screen shots... so forgive me if the screenies are a preview, and I still need to sit the hell still a while longer.
-
LethalEncounter
- Team: Zombie
- Posts: 2717
- Joined: Wed Jul 25, 2007 10:10 pm
Don't forget that you have to give the path to the lua script file in the quests table. Since mine is in the Quests directory by quests tables is:
quest_id, lua_script
1, Quests/KillCrabs.lua
The character_quests table is not currently used. I haven't added in the saving/loading of quests. I'll probably get that added in the next few days.
quest_id, lua_script
1, Quests/KillCrabs.lua
The character_quests table is not currently used. I haven't added in the saving/loading of quests. I'll probably get that added in the next few days.
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
Ah ok, so the current quest completion is just held in active memory then? I gotcha.
As for my path, it's the same as yours. From C:\eq2emu, I have a Quests dir, with KillCrabs.lua under it. C:\eq2emu\Quests\KillCrabs.lua.
In Quest ID 1 record, I just have "Quests\KillCrabs.lua"
Is my slash wrong? hehe.
As for my path, it's the same as yours. From C:\eq2emu, I have a Quests dir, with KillCrabs.lua under it. C:\eq2emu\Quests\KillCrabs.lua.
In Quest ID 1 record, I just have "Quests\KillCrabs.lua"
Is my slash wrong? hehe.
-
LethalEncounter
- Team: Zombie
- Posts: 2717
- Joined: Wed Jul 25, 2007 10:10 pm
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
-
Jabantiz
- Lead Developer
- Posts: 2912
- Joined: Wed Jul 25, 2007 2:52 pm
- Location: California
I might be missing something here so if I am I apologize.
While scripting a few quests on the island I noticed the task group text changes on live and I can't figure out how to script that, I saw an update for the step description as well as the quest description. Is there no way to update the task group text as of now?
This may be getting ahead of myself right now but some quests are given by walking over a certain location, and others have client side spawns only where only the person on the right step can see the spawns. Is this stuff supported yet or should I ignore those quests for now?
While scripting a few quests on the island I noticed the task group text changes on live and I can't figure out how to script that, I saw an update for the step description as well as the quest description. Is there no way to update the task group text as of now?
This may be getting ahead of myself right now but some quests are given by walking over a certain location, and others have client side spawns only where only the person on the right step can see the spawns. Is this stuff supported yet or should I ignore those quests for now?
-
LethalEncounter
- Team: Zombie
- Posts: 2717
- Joined: Wed Jul 25, 2007 10:10 pm
Make sure that your console window displays:John Adams wrote:That didn't work either... tried it right after, and resolved to just stop asking about it and maybe like magic it will just start working for me.
I am about 2 mins from giving you an RDP connection to my server (LOL)
[Status] Loading Quests..
[Status] Loaded 1 Quest(s)
[Status] Loading EQ time of day..
If it doesn't load the quest, then you have a problem with the script or the quests table. If it does load the script then the problem is the spawn script or the npc you are assigning it to. Maybe you assigned it to the wrong one?
Let me know.
-
LethalEncounter
- Team: Zombie
- Posts: 2717
- Joined: Wed Jul 25, 2007 10:10 pm
I'll get this stuff added the next time I update quests.Jabantiz wrote:I might be missing something here so if I am I apologize.
While scripting a few quests on the island I noticed the task group text changes on live and I can't figure out how to script that, I saw an update for the step description as well as the quest description. Is there no way to update the task group text as of now?
This may be getting ahead of myself right now but some quests are given by walking over a certain location, and others have client side spawns only where only the person on the right step can see the spawns. Is this stuff supported yet or should I ignore those quests for now?
-
bobbydole
- Posts: 32
- Joined: Mon Jul 28, 2008 1:10 pm
And how about book quests, or other quests spawned from drops within a zone? I hope you guys didn't forget about those =DJabantiz wrote: This may be getting ahead of myself right now but some quests are given by walking over a certain location, and others have client side spawns only where only the person on the right step can see the spawns. Is this stuff supported yet or should I ignore those quests for now?
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
-
LethalEncounter
- Team: Zombie
- Posts: 2717
- Joined: Wed Jul 25, 2007 10:10 pm
Who is online
Users browsing this forum: No registered users and 0 guests