LUA Quest scripts problems.

General support forum. If you require assistance and your problem doesnt fall in any of the other categories, this is the forum for you!

Moderator: Team Members

Forum rules
READ THE FORUM STICKY THREADS BEFORE ASKING FOR HELP!
Most information can be found there, and if not, the posts will help you determine the information required to get assistance from the development team.
Incomplete Help Requests will be locked or deleted.
Post Reply
User avatar
Astal
Posts: 96
Joined: Tue Dec 09, 2008 1:35 pm

LUA Quest scripts problems.

Post by Astal » Sat Nov 21, 2009 7:40 pm

So far its working decent except. The text on the top of my screen doesnt update past the first quest step.

Also on the 3rd step it wont allow me to talk to my quest npc to complete the step, it shows the quest completed over the guys head but when i speak to him it says you havent finished your quest

Code: 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, "Orc Mischief", "Hallmark", "New Tunaria", 5, "Lord Elrond has asked you to investigate a nearby grotto. He has intelligence that leads him to believe the orcs are up to somthing evil.")
   AddQuestRewardCoin(Quest, 1000)
   SetQuestRewardExp(Quest, 1000)
   AddQuestStepLocation(Quest, 1, "Investigate the activities of the orcs in the nearby grotto and report back to lord elrond", 30, "", 1, -2497, 15, -61)
   AddQuestStepCompleteAction(Quest, 1, "step1orcmischiefcomplete")
end


function step1orcmischiefcomplete(Quest, QuestGiver, Player)
   UpdateQuestStepDescription(Quest, 1, "I have investigated the grotto as instructed. It seems Lord Elrond is right there is evil afoot!")
   AddQuestStepKill(Quest, 2, "Kill the orc mystics and the foul demon they have summoned", 1, 100, "", 0, 23)
   AddQuestStepCompleteAction(Quest, 2, "step2orcmischiefcomplete")
end


function step2orcmischiefcomplete(Quest, QuestGiver, Player)
   UpdateQuestStepDescription(Quest, 2, "I need to return to Lord Elrond and inform him of what I have found!")
   AddQuestStepChat(Quest, 3, "I need to inform Lord Elrond of what has transpired here!", 1, "", 0, 28)
   AddQuestStepCompleteAction(Quest, 3, "step3orcmischiefcomplete")
end

function step3orcmischiefcomplete(Quest, QuestGiver, Player)
   -- tidy up step
   UpdateQuestStepDescription(Quest, 3, "I spoke to Lord Elrond")

   -- tidy up quest
   SetCompletedDescription(Quest, "I spoke to Lord Elrond")
   UpdateQuestDescription(Quest, "I spoke to Lord Elrond")

   -- give reward
   GiveQuestReward(Quest, Player)
end

  

function Reload(Quest, QuestGiver, Player, Step)
   if Step == 1 then
      step1orcmischiefcomplete(Quest, QuestGiver, Player)
   end
   if Step == 2 then
      step2orcmischiefcomplete(Quest, QuestGiver, Player)
   end
   -- 3 only gets triggered when 2 is complete so not needed to be reloaded
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, "Perhaps another time, ")
      end
   end
end
Last edited by Astal on Sat Nov 21, 2009 11:05 pm, edited 1 time in total.
I DIE FREE!!

User avatar
Astal
Posts: 96
Joined: Tue Dec 09, 2008 1:35 pm

Re: LUA Quest scripts problems.

Post by Astal » Sat Nov 21, 2009 11:05 pm

After countless hours of help from bolly and slaving over it my self i figured it out

Here is the working code to make it work the way i wanted it to.

Code: 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, "Orc Mischief", "Hallmark", "New Tunaria", 5, "Lord Elrond has asked you to investigate a nearby grotto. He has intelligence that leads him to believe the orcs are up to somthing evil.")
   AddQuestRewardCoin(Quest, 1000)
   SetQuestRewardExp(Quest, 1000)
   AddQuestStepLocation(Quest, 1, "Investigate the activities of the orcs in the nearby grotto and report back to lord elrond", 30, "", 1, -2497, 15, -61)
   AddQuestStepCompleteAction(Quest, 1, "step1orcmischiefcomplete")
end


function step1orcmischiefcomplete(Quest, QuestGiver, Player)
   UpdateQuestStepDescription(Quest, 1, "I have investigated the grotto as instructed. It seems Lord Elrond is right there is evil afoot!")
   AddQuestStepKill(Quest, 2, "Kill the orc mystics and the foul demon they have summoned", 1, 100, "", 0, 23)
   AddQuestStepCompleteAction(Quest, 2, "step2orcmischiefcomplete")
end


function step2orcmischiefcomplete(Quest, QuestGiver, Player)
   UpdateQuestStepDescription(Quest, 2, "I need to return to Lord Elrond and inform him of what I have found!")
   -- tidy up step
   UpdateQuestStepDescription(Quest, 3, "I spoke to Lord Elrond")

   -- tidy up quest
   SetCompletedDescription(Quest, "I spoke to Lord Elrond")
   UpdateQuestDescription(Quest, "I spoke to Lord Elrond")

   -- give reward
   QuestReturnNPC(Quest, 28)
end

function Reload(Quest, QuestGiver, Player, Step)
   if Step == 1 then
      step1orcmischiefcomplete(Quest, QuestGiver, Player)
   end
   if Step == 2 then
      step2orcmischiefcomplete(Quest, QuestGiver, Player)
   end
   -- 3 only gets triggered when 2 is complete so not needed to be reloaded
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, "Perhaps another time, ")
      end
   end
end
I DIE FREE!!

bolly
Retired
Posts: 389
Joined: Mon Sep 21, 2009 3:03 pm
Location: Leeds, UK

Re: LUA Quest scripts problems.

Post by bolly » Sat Nov 21, 2009 11:21 pm

Grats man!

I couldn't get that function to work either but i did notice I'd put a similar quest on the wiki a while back at: http://www.eq2emulator.net/wiki/index.p ... ntentQuest

How i'd done it then was to use SetStepComplete(Spawn, Quest, 1) on hail as a work around so looks like
AddQuestStepChat(Quest, 1, "I need to speak to Dunehunter Dale", 1, "", 75, 184)

Doesn't seem to trigger for whatever reason or we're missing docs to say how it should be done

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: LUA Quest scripts problems.

Post by Scatman » Sat Nov 21, 2009 11:35 pm

Astal, it looks like you are using SetCompletedDescription in multiple steps. I'm not sure if this is how you intended to write the quest but this actually changes what the description of the quest says only after you've completed it. Using just UpdateQuestStepDescription to update each step will do what you are trying to do. UpdateQuestDescription and SetCompletedDescription should generally be used after the last step is complete.

The chat steps originally updated the quest step on the initial hail, however it was changed it due to the fact that most quests on live don't update on the initial hail. Sometimes you need to go through a whole lot of dialog before the step actually updates. So using SetStepComplete is the correct way of updating a chat step.

bolly
Retired
Posts: 389
Joined: Mon Sep 21, 2009 3:03 pm
Location: Leeds, UK

Re: LUA Quest scripts problems.

Post by bolly » Sun Nov 22, 2009 6:53 am

What you are saying there is coming back to me, this is probably why I put it in the wiki but it should be repeated in several places I think to make it more obvious - i'll get cracking on that today

*Done*

User avatar
Astal
Posts: 96
Joined: Tue Dec 09, 2008 1:35 pm

Re: LUA Quest scripts problems.

Post by Astal » Sun Nov 22, 2009 8:18 am

Scatman wrote:Astal, it looks like you are using SetCompletedDescription in multiple steps. I'm not sure if this is how you intended to write the quest but this actually changes what the description of the quest says only after you've completed it. Using just UpdateQuestStepDescription to update each step will do what you are trying to do. UpdateQuestDescription and SetCompletedDescription should generally be used after the last step is complete.

The chat steps originally updated the quest step on the initial hail, however it was changed it due to the fact that most quests on live don't update on the initial hail. Sometimes you need to go through a whole lot of dialog before the step actually updates. So using SetStepComplete is the correct way of updating a chat step.
Thanks for clearin that up scat and i see what your saying with the Chat step, i didnt notice it last night cause i was burnt out from all the work on the quest that day
I DIE FREE!!

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests