Updating Quests

Discussions on development of both the EQ2Emulator LUA Script Engine and Script specifications

Moderator: Team Members

Post Reply
JCL
Posts: 212
Joined: Tue Oct 16, 2007 4:54 pm
EQ2Emu Server: World of Tyrania

Updating Quests

Post by JCL » Tue Dec 30, 2008 2:54 pm

I've been testing npc's and made a couple to test quests. Here is some code: (Built off crab quest)

Code: Select all

    [function Init(Quest)
       RegisterQuest(Quest, "Kill Roots", "Hallmark", "Queen's Colony", 1, "Rayvor is deathly afraid of roots and wants you to kill some of them for him.")

       AddQuestRewardCoin(Quest, 25)

       SetQuestRewardExp(Quest, 200)

       SetQuestPrereqLevel(Quest, 1)
          
       AddQuestStepKill(Quest, 1, "Kill 1 of the roots nearby.", 1, "Kill roots for Sir Rayvor", "Kill roots for

    Sir Rayvor", 65)

       AddQuestStepCompleteAction(Quest, 1, "KilledAllRoots")

       SetCompletedDescription(Quest, "I have killed all of the roots.")

       QuestReturnNPC(Quest, 64)
    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, "waves goodbye.", Player)
          end
       end
    end

    function KilledAllRoots(Quest, QuestGiver, Player)
       UpdateQuestStepDescription(Quest, 1, "I killed the roots as Rayvor requested.")
       UpdateQuestDescription(Quest, "I killed some of the roots on the beach.  Return to Rayvor for your

    reward.")
    end
To shorten that up I have this that is not working right:

Code: Select all

AddQuestStepKill(Quest, 1, "Kill 1 of the roots nearby.", 1, "Kill roots for Sir Rayvor", "Kill roots for Sir Rayvor", 65)
Everything works, but I get "You did not find any quest items" when I kill the quest npc.

Edit: Found the problem. I was using this format:

Code: Select all

AddQuestStepKill(Quest, Step ID, Description, Quantity, TaskGroupText, NPC ID(s))
Should have been using this format: (The PercentChance)

Code: Select all

AddQuestStepKill(Quest, Step ID, Description, Quantity, PercentChance,TaskGroupText, NPC ID(s)
Last edited by JCL on Tue Dec 30, 2008 3:08 pm, edited 1 time in total.

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: Updating Quests

Post by LethalEncounter » Tue Dec 30, 2008 3:07 pm

The syntax for AddQuestStepKill and AddQuestStepObtainItem have been changed since that was created. Sorry about the trouble, I forgot to update those examples. The new format is:

Code: Select all

AddQuestStepObtainItem(Quest, Step (int), description (string), quantity (int), percentage (float), taskgroup (string), item_id (int), ...)

AddQuestStepKill(Quest, Step (int), description (string), quantity (int), percentage (float), taskgroup (string), npc_id (int), ...)
Note that the ... at the end of the functions means you can use multiple item_ids (or npc_ids) separated by commas.

JCL
Posts: 212
Joined: Tue Oct 16, 2007 4:54 pm
EQ2Emu Server: World of Tyrania

Re: Updating Quests

Post by JCL » Tue Dec 30, 2008 3:13 pm

Yeah, I finally figured that out after reading the other LUA Functions txt file I had.

Thanks for the updates though. I didn't have the AddQuestStepObtainItem updated like that.

Edit: I did notice this posted in KillCrabs.lua: "These functions are shared, so don't save any character data in them."

So will my quests not be saved to the character after completed?

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: Updating Quests

Post by Scatman » Tue Dec 30, 2008 3:30 pm

They will be saved into the database table character_quests upon completion. I think what he means by a shard function is that anytime a player runs that quest, the same function is used for every player.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests