Quest
Moderator: Team Members
- Ememjr
- Team Member
- Posts: 975
- Joined: Wed Mar 15, 2017 9:41 am
- EQ2Emu Server: Perseverance
Re: Quest
i have game logs going back to mar 2005, that i get most of my NPC dialogs from, and either Jab or John has a dialog parser in svn that will read the logs and can create the npc script with those dialogs, although it does it a little modifications, sue to the log style changing over the years
-
Plague
- Posts: 68
- Joined: Mon Jun 29, 2015 3:17 pm
- EQ2Emu Server: WiP
Re: Quest
Result of my first quest attempt are umm so-so. Quest giver gives the quest alright right away with no conversation. It is meant to be a 2 part quest, pick up a weapon from the rack (not yet assigned an item id just left it as 1 for now), Kill a Grunttooth invader, and return to the quest giver to complete. As I'm just learning lua I figured Id start with give quest and pick up weapon. A lot was taken from https://eq2emulator.net/wiki/index.php/ ... ntentQuest tho a little out of date was not bad, and other lua I have read.
NPC that gives quest.
NPC that updates.
and of coarse the quest.lua
Already ran the query in sql to register the quest, and under the quests table everything looks good. I suspect its lack of knowledge of lua here despite reading a lot of posts, how to do, and a number of other lua.
NPC that gives quest.
Code: Select all
--[[
Script Name : Quests/IsleRefuge/GarvenTralk.lua
Script Purpose : Garven Tralk
Script Author : Plague
Script Date : 2018.02.07
--]]
function spawn(NPC)
ProvidesQuest(NPC, 249)
end
function hailed(NPC, Spawn)
FaceTarget(NPC, Spawn)
PlayFlavor(NPC, "voiceover/english/voice_emotes/greetings/greetings_1_1002.mp3", "", "", 0, 0, Spawn)
conversation = CreateConversation()
if HasQuest(Spawn, 249) then
if QuestIsComplete(Spawn, 249) then
AddConversationOption(conversation, "Hello.")
StartConversation(conversation, NPC, Spawn, "Hello " .. GetName(Spawn) .. ", thank you so much for helping me.")
else
AddConversationOption(conversation, "Not yet!")
StartConversation(conversation, NPC, Spawn, "Hello again " .. GetName(Spawn) .. ". did you find an appropriate weapon yet?")
end
else
if HasCompletedQuest(Spawn, 249) then
AddConversationOption(conversation, "Hello again.")
StartConversation(conversation, NPC, Spawn, "Hello again " .. GetName(Spawn) )
else
AddConversationOption(conversation, "Sure!", "HelpGarven")
StartConversation(conversation, NPC, Spawn, "Impressive choice there, now that you have chosen the class you will learn will you help defend the island?")
end
OfferQuest(NPC, Spawn, 249)
conversation = CreateConversation()
StartConversation(conversation, NPC, Spawn, "That's wonderful, please hurry.")
end
endCode: Select all
--[[
Script Name : SpawnScripts/IsleRefuge1/GarvensWeaponRack.lua
Script Author : Plague
Script Date : 2018.02.07
Script Purpose : Gruttooth Invasion Weapons Rack
:
--]]
function spawn(NPC)
end
function casted_on(NPC, Spawn, Message)
if HasQuest(Spawn, 249) then
SummonItem(Spawn, 1, 1)
Quest = GetQuest(Spawn, 249)
if Quest ~= nil then
SetStepComplete(Spawn, Quest, 1)
UpdateQuestStepDescription(Quest, 1, "I have selected a weapon.")
UpdateQuestTaskGroupDescription(Quest, 1, "I have selected a weapon.")
UpdateQuestDescription(Quest, "I have selected a weapon.")
end
end
else
if HasCompletedQuest(Spawn, 249) then
StartConversation(conversation, NPC, Spawn, "I already choose my weapon and can not choose again.)
else
StartConversation(conversation, NPC, Spawn, "I should speak to Garven befor taking a weapon.")
end
end
endCode: Select all
--[[
Script Name : Quests/IsleRefuge/Gruttooth_Invasion.lua
Script Purpose : Handles the quest, "Gruttooth Invasion"
Script Author : Plague
Script Date : 2018.02.07
Zone : Isle of Refuge
Quest Giver: Garven Tralk
Preceded by: Archetype Selection
Followed by: Speaking with...
--]]
function Init(Quest)
SetQuestRewardExp(Quest, 200)
SetQuestPrereqLevel(Quest, 1)
AddQuestStepChat(Quest, 1, "I should select a weapon from Garven's weapon rack", 1, "", 10, 3250013)
SetCompletedDescription(Quest, "I have selected an appropriate weapon.")
end
function Accepted(Quest, QuestGiver, Player)
end
function Declined(Quest, QuestGiver, Player)
if QuestGiver ~= nil then
if GetDistance(Player, QuestGiver) < 30 then
FaceTarget(QuestGiver, Player)
Say(QuestGiver, "Please help us " .. GetName(Player) .. ", The island is in danger.")
end
end
end-
tyrbo
- Team Member
- Posts: 271
- Joined: Thu Feb 18, 2016 12:33 pm
Re: Quest
I would highly recommend indenting your code consistently. It helps readability a lot, and it's a good habit to have.
A text editor like Atom, Visual Studio Code, or Sublime Text (and the list goes on) should all indent code automatically for you. Notepad++ doesn't seem to do it automatically out of the box.
I went ahead and added a bit of spacing to your first file:
Your issue is in the else block of your first conditional.
Let me know if the spacing fix and the hint helps.
By all means, if you need more than hints, happy to help out more.
A text editor like Atom, Visual Studio Code, or Sublime Text (and the list goes on) should all indent code automatically for you. Notepad++ doesn't seem to do it automatically out of the box.
I went ahead and added a bit of spacing to your first file:
Code: Select all
--[[
Script Name : Quests/IsleRefuge/GarvenTralk.lua
Script Purpose : Garven Tralk
Script Author : Plague
Script Date : 2018.02.07
--]]
function spawn(NPC)
ProvidesQuest(NPC, 249)
end
function hailed(NPC, Spawn)
FaceTarget(NPC, Spawn)
PlayFlavor(NPC, "voiceover/english/voice_emotes/greetings/greetings_1_1002.mp3", "", "", 0, 0, Spawn)
conversation = CreateConversation()
if HasQuest(Spawn, 249) then
if QuestIsComplete(Spawn, 249) then
AddConversationOption(conversation, "Hello.")
StartConversation(conversation, NPC, Spawn, "Hello " .. GetName(Spawn) .. ", thank you so much for helping me.")
else
AddConversationOption(conversation, "Not yet!")
StartConversation(conversation, NPC, Spawn, "Hello again " .. GetName(Spawn) .. ". did you find an appropriate weapon yet?")
end
else
if HasCompletedQuest(Spawn, 249) then
AddConversationOption(conversation, "Hello again.")
StartConversation(conversation, NPC, Spawn, "Hello again " .. GetName(Spawn) )
else
AddConversationOption(conversation, "Sure!", "HelpGarven")
StartConversation(conversation, NPC, Spawn, "Impressive choice there, now that you have chosen the class you will learn will you help defend the island?")
end
OfferQuest(NPC, Spawn, 249)
conversation = CreateConversation()
StartConversation(conversation, NPC, Spawn, "That's wonderful, please hurry.")
end
end
Let me know if the spacing fix and the hint helps.
By all means, if you need more than hints, happy to help out more.
- Ememjr
- Team Member
- Posts: 975
- Joined: Wed Mar 15, 2017 9:41 am
- EQ2Emu Server: Perseverance
Re: Quest
here is my quest for that ( there is a little testing code in there to ignore though) this is a spawn script though and not the actual quest
and since this particualar server is custom spawn id's etc may not match
and since this particualar server is custom spawn id's etc may not match
Code: Select all
--[[
Script Name: SpawnScripts/IsleRefuge1/GarvenTralk.lua
Spawn ID: 3250000
Spawn Group ID: 0
Spawn Entry ID: 0
Author:
Date: 2017.11.04
--]]
function spawn(NPC)
SetPlayerProximityFunction(NPC, 20, "InRange10", "LeaveRange")
ProvidesQuest(NPC, 15000)
ProvidesQuest(NPC,15002)
end
function InRange10(NPC)
PlayFlavor(NPC, "voiceover/english/garven_tralk/tutorial_island02/garventralk001.mp3", "You there! Stop standing around like a drunken sailor and get over here!", "", 0, 0, Spawn)
end
function respawn(NPC)
spawn(NPC)
end
function hailed(NPC, Spawn)
if HasQuest(Spawn, 15000) then
Say(Spawn, "I have quest 15000")
if GetClass(Spawn) == 0 then
getarch(NPC,Spawn)
end
end
if HasQuest(Spawn, 15001) then
Say(Spawn, "I have quest 15001 with step 1 complete" )
conversation = CreateConversation()
if GetClass(Spawn) == 11 then
AddConversationOption(conversation, "Thanks.", "thanksP")
StartConversation(conversation, NPC, Spawn, "Well done, you might make it off this island after all. I'll tell you what. Take this pair of gloves for your help, you're sure to need all the protection you can get for the duration of your stay here. Now if you actually want to get off this island and see one of the big cities one day, I suggest you talk to Nathinia Sparklebright. She's in charge of all the new priests and can usually be found meditating by the fountain in town. Good luck to you.")
end
if GetClass(Spawn) == 21 then
AddConversationOption(conversation, "Thanks.", "thanksM")
StartConversation(conversation, NPC, Spawn, "Well done, you might make it off this island after all. I'll tell you what. Take this pair of gloves for your help, you're sure to need all the protection you can get for the duration of your stay here. Now if you actually want to get off this island and see one of the big cities one day, I suggest you talk to Mizan Vaeoulin. He's in charge of all the new mages and can be found inside the wizard tower in town. Good luck to you.")
end
if GetClass(Spawn) == 1 then
AddConversationOption(conversation, "Thanks.", "thanksF")
StartConversation(conversation, NPC, Spawn, "Well done, you might make it off this island after all. I'll tell you what. Take this pair of gloves for your help, you're sure to need all the protection you can get for the duration of your stay here. Now if you actually want to get off this island and see one of the big cities one day, I suggest you talk to Braksan Steelforge. He's in charge of all the new fighters and can be found at the forge in town. Good luck to you.")
end
if GetClass(Spawn) == 31 then
AddConversationOption(conversation, "Thanks.", "thanksS")
StartConversation(conversation, NPC, Spawn, "Well done, you might make it off this island after all. I'll tell you what. Take this pair of gloves for your help, you're sure to need all the protection you can get for the duration of your stay here. Now if you actually want to get off this island and see one of the big cities one day, I suggest you talk to Vladiminn. That wily ratonga is in charge of all the new scouts and can usually be found at the archery range in town. Good luck to you.")
end
end
Say(Spawn, "checking now for quest 15002" )
if HasQuest(Spawn,15002) == false and HasCompletedQuest(Spawn, 15001) ==true then
if GetClass(Spawn) == 1 then
OfferQuest(NPC, Spawn,15002)
elseif GetClass(Spawn) == 31 then
OfferQuest(NPC, Spawn,15005)
elseif GetClass(Spawn) == 21 then
OfferQuest(NPC, Spawn,15003)
elseif GetClass(Spawn) == 11 then
OfferQuest(NPC, Spawn,15004)
end
end
end
function thanksF(NPC,Spawn)
SetStepComplete(Spawn, 15001, 3)
OfferQuest(NPC, Spawn,15002)
end
function thanksM(NPC,Spawn)
SetStepComplete(Spawn, 15001, 3)
OfferQuest(NPC, Spawn,15003)
end
function thanksP(NPC,Spawn)
SetStepComplete(Spawn, 15001, 3)
OfferQuest(NPC, Spawn,15004)
end
function thanksS(NPC,Spawn)
SetStepComplete(Spawn, 15001, 3)
OfferQuest(NPC, Spawn,15005)
end
function getarch(NPC,Spawn)
FaceTarget(NPC, Spawn)
conversation = CreateConversation()
AddConversationOption(conversation, "My name is "..GetName(Spawn)..". I am a Scout.", "Scout")
AddConversationOption(conversation, "My name is "..GetName(Spawn)..". I am a Priest.", "Priest")
AddConversationOption(conversation, "My name is "..GetName(Spawn)..". I am a Mage.", "Mage")
AddConversationOption(conversation, "My name is "..GetName(Spawn)..". I am a Fighter.", "Fighter")
StartConversation(conversation, NPC, Spawn, "I'll make this quick because we have no time for pleasantries. Welcome to the Isle of Refuge. Name and profession please?")
end
function Scout(NPC, Spawn)
conversation = CreateConversation()
AddConversationOption(conversation, "Yes.", "YesS")
AddConversationOption(conversation, "No, I don't think I'm a scout after all. ", "No")
StartConversation(conversation, NPC, Spawn, "A scout, eh? Good. We can use someone with a cool head and a keen eye with all the goblins causing trouble around here. As a scout, you'll use your stealth and speed to sneak up on opponents and take them out quickly. Watch yourself though, because if you're not quick enough, a good strong blow will certainly take its toll on you. You think you can handle that?")
end
function YesS(NPC, Spawn)
SetAdventureClass(Spawn,31)
conversation = CreateConversation()
AddConversationOption(conversation, "Very well.", "VeryWell")
StartConversation(conversation, NPC, Spawn, "All right then. Quickly now, grab a weapon from the rack here and go to the west gate. Our scouts have reported that another group of goblins is going to charge the barricade at any moment now -- if they haven't already. I know you may think this is none of your affair, but trust me, if you want to get off this island alive and well you have no choice. Come back to me after you've defeated at least one Gruttooth invader and maybe I can help you out.")
end
function Priest(NPC, Spawn)
conversation = CreateConversation()
AddConversationOption(conversation, "Continue. ", "Continue")
StartConversation(conversation, NPC, Spawn, "A priest, eh? Well, I'm not a religious man myself, but it can't hurt to have a little divine wrath on our side with all these goblins about. As a priest, your first duty should be healing and blessing your comrades using divine power. ")
end
function Continue(NPC, Spawn)
conversation = CreateConversation()
AddConversationOption(conversation, "Yes.", "YesP")
AddConversationOption(conversation, "No, I don't think I'm a priest after all. ", "No")
StartConversation(conversation, NPC, Spawn, "Though, most priests I've seen are no strangers to combat, and you should be able to take a pretty good beating and walk away. You think you can handle that?")
end
function YesP(NPC, Spawn)
SetAdventureClass(Spawn,11)
conversation = CreateConversation()
AddConversationOption(conversation, "Continue.", "Continue2")
StartConversation(conversation, NPC, Spawn, "All right then. Quickly now, grab a weapon from the rack here and go to the west gate. Our scouts have reported that another group of goblins is going to charge the barricade at any moment now -- if they haven't already. I know you may think this is none of your affair, but trust me, if you want to get off this island alive and well you have no choice. Come back to me after you've defeated at least one Gruttooth invader and maybe I can help you out.")
end
function Continue2(NPC, Spawn)
conversation = CreateConversation()
AddConversationOption(conversation, "Very well.", "VeryWellP")
StartConversation(conversation, NPC, Spawn, "I know you may think this is none of your affair, but trust me, if you want to get off this island alive and well you have no choice. Come back to me after you've defeated at least one Gruttooth invader and maybe I can help you out.")
end
function Mage(NPC, Spawn)
conversation = CreateConversation()
AddConversationOption(conversation, "Yes.", "YesM")
AddConversationOption(conversation, "No, I don't think I'm a mage after all. ", "No")
StartConversation(conversation, NPC, Spawn, "A mage, eh? Well, I suppose we can use another finger wiggler to blast those goblins. As a mage, you'll want to keep out of harm's way, casting spells at your opponents from afar while using your skills to bolster the strengths of your comrades. You think you can handle that?")
end
function YesM(NPC, Spawn)
SetAdventureClass(Spawn,21)
conversation = CreateConversation()
AddConversationOption(conversation, "Very well.", "VeryWell")
StartConversation(conversation, NPC, Spawn, "All right then. Quickly now, grab a weapon from the rack here and go to the west gate. Our scouts have reported that another group of goblins is gonna charge the barricade at any moment now -- if they haven't already. I know you may think this is none of your affair, but trust me, if you want to get off this island alive and well you have no choice. Come back to me after you've defeated at least one Gruttooth invader and maybe I can help you out.")
end
function Fighter(NPC, Spawn)
conversation = CreateConversation()
AddConversationOption(conversation, "Yes.", "YesF")
AddConversationOption(conversation, "No, I don't think I'm a Fighter after all. ", "No")
StartConversation(conversation, NPC, Spawn, "A fighter, eh? Good. We could always use another blade to stick it to them goblins. As a fighter, you'll be in the thick of battle most of the time protecting your comrades from harm and relying on your equipment and combat skills to see you through it. Are you sure you can handle that?")
end
function YesF(NPC, Spawn)
SetAdventureClass(Spawn,1)
conversation = CreateConversation()
AddConversationOption(conversation, "Very well.", "VeryWell")
StartConversation(conversation, NPC, Spawn, "All right then. Quickly now, grab a weapon from the rack here and go to the west gate. Our scouts have reported that another group of goblins is gonna charge the barricade at any moment now -- if they haven't already. I know you may think this is none of your affair, but trust me, if you want to get off this island alive and well you have no choice. Come back to me after you've defeated at least one Gruttooth invader and maybe I can help you out.")
end
function No(NPC, Spawn)
conversation = CreateConversation()
AddConversationOption(conversation, "I am a Scout.", "Scout")
AddConversationOption(conversation, "I am a Priest.", "Priest")
AddConversationOption(conversation, "I am a Mage.", "Mage")
AddConversationOption(conversation, "I am a Fighter.", "Fighter")
StartConversation(conversation, NPC, Spawn, "Yes, I didn't think you looked the type. So what is your profession?")
end
function VeryWell(NPC, Spawn)
SetStepComplete(Spawn, 15000, 1)
OfferQuest(NPC, Spawn, 15001)
end-
Plague
- Posts: 68
- Joined: Mon Jun 29, 2015 3:17 pm
- EQ2Emu Server: WiP
Re: Quest
Thanks Tyrbo with the proper spacing was easy to read and I found the extra space.I would highly recommend indenting your code consistently. It helps readability a lot, and it's a good habit to have.
Seems Ememjr is making a server same as I am, and a lot more progressed into it as well. Maybe ill just wait until his server is finished. Untill then learning curve I suppose to learn more .lua.
- Cynnar
- Project Leader
- Posts: 738
- Joined: Sat Sep 27, 2014 1:22 am
- EQ2Emu Server: Eq2emulator
- Characters: Vlash
Veinlash
Taragak
Cynnar
Re: Quest
Just a suggestion, but he might want some help on his. If not you can do scripts on EQ2Emulator that will benefit both projects plus others as well.Plague wrote: Wed Feb 07, 2018 3:18 pm Seems Ememjr is making a server same as I am, and a lot more progressed into it as well. Maybe ill just wait until his server is finished. Untill then learning curve I suppose to learn more .lua.
[ 01000011 01111001 01101110 01101110 01100001 01110010 ]
Follow on:
Twitter Facebook
Contact me:
PM Discord chat email
Hardware: the parts of a computer that can be kicked
Follow on:
Twitter Facebook
Contact me:
PM Discord chat email
Hardware: the parts of a computer that can be kicked
Who is online
Users browsing this forum: No registered users and 1 guest