Daimonin
Members login
Sign Up!      problems?
N F
* Daimonin Forum
Home Help Search Calendar

Welcome Guest, you have to register to post here.
Search

News

Stats
75655 Posts in 6829 Topics by 8142 Members
Latest Member: mattj
Daimonin Forum  |  Development  |  Maps  |  Topic: quests « previous next »
Pages: [1] Go Down Print
Topic: quests  (Read 221 times)
_people_
Hobgoblin


Karma: +1/-0
Posts: 41



View Profile
« on: November 29, 2008, 04:42:54 am »

I think i have the quest scripting down, but i can't test it because when I talk to the quest giver, he doesn't say anything, and i don't get a quest. I tried to use the say and talk options, but neither works. What am I supposed to do to make the NPC talk?
Logged

----------------------_person_----------------------
----------------------Human Male--------------------

Happy Bday to me!! December 30
smacky
Administrator
*
*
*
*


Karma: +120/-101
Posts: 5381



View Profile
« Reply #1 on: November 29, 2008, 01:30:21 pm »

??? Need more information.

I can't tell if this is your map object (the NPC) not being defined properly (eg, not having the correct event) or your script not working.

One thing to do is have a look at the NPCs in the sourceforge maps -- these work.

Another thing is to have a look at the logs for your local server. When you /talk to your NPC,is there a block of log like this:
Code:
LUA - triggerEvent:: eventcode 13
LUA - HandleEvent:: start script file >guildhall/guild_merc.lua<
LUA - call data:: o1:>Supersonic< o2:>Mercenary Master Cashin< o3:>>NULL PTR<< text:>hello< i1:0 i2:0 i3:0 i4:2
LUA: normalized script path: /planes/human_plane/castle/guildhall/guild_merc.lua
LUA - Script not in cache, loading '../maps//planes/human_plane/castle/guildhall/guild_merc.lua' from file
LUA - Script not in cache, loading '../maps/lua/topic_list.lua' from file
LUA - Script not in cache, loading '../maps/lua/quest_manager.lua' from file
LUA - Script not in cache, loading '../maps/lua/interface_builder.lua' from file
fixing. LUA - Terminating context (/planes/human_plane/castle/guildhall/guild_merc.lua)
done (returned: 0)!

If there is nothing, your script is not even being called. If it exists, but the block is substantially different, your script is probably broken. Post the script maybe?
Logged

_people_
Hobgoblin


Karma: +1/-0
Posts: 41



View Profile
« Reply #2 on: November 29, 2008, 11:13:53 pm »

Code:
-- Merc Guild Script
require("topic_list")
require("quest_manager")
require("interface_builder")

local pl        = event.activator
local me        = event.me
local msg       = string.lower(event.message)
local q_iname1 = "Lost Brother"
local q_mgr_1   = QuestManager(pl,"Lost Brother")

local ib = InterfaceBuilder()
ib:SetHeader(me, me.name)

local function topicDefault()
    if q_mgr_1:GetStatus() < game.QSTAT_DONE then
        if q_mgr_1:GetStatus() == game.QSTAT_NO then
            ib:SetTitle("Distressed Peasant")
            ib:AddMsg("Hi.\nI am really distressed.\n")
            ib:AddLink("What happened?", "startq1")
        else
            ib:SetTitle("Found brother?")
            ib:AddMsg("You have done the task?\n\nShow me the helm and you can join our guild.")
            ib:AddLink("Give the peasant the corpse", "checkq1")
        end
    else

        end
        ib:AddMsg("Good to see you back. How are you?\n\nNice that you have joined our ^troops^.")
    end
    pl:Interface(1, ib:Build())
end

-- quest body (added to player quest obj for quest list)
local function quest_icons1()
    ib:AddIcon("Lost Brother", "Peasant", "")
end

local function quest_body1()
    ib:AddMsg("\nMy brother was out hunting the local bears and he hadn't come back in three days.")
    ib:AddMsg("\nI went out to investigate and discovered a cave which had his spear on the outside. ")
    ib:AddMsg("I would appreciate it if you would go and search for him.\n")
    ib:AddMsg("\nWill you go find him?")
    ib:SetDesc("Hurry and find my brother.", 0, 0, 0, 0)
end

-- start: accept or decline the quest
local function topStartQ1()
    if q_mgr_1:GetStatus() ~= game.QSTAT_NO then
        topicDefault()
    else
    ib:SetTitle(q_mgr_1.name)
    quest_body1()
    quest_icons1()
    ib:SetAccept(nil, "acceptq1")
    ib:SetDecline(nil, "hi")
    pl:Interface(1, ib:Build())
    end
end

-- accepted: start the quest
local function topAcceptQ1()
    if q_mgr_1:GetStatus() ~= game.QSTAT_NO then
        topicDefault()
        return
    end
    quest_body1()
    quest_icons1()
    if q_mgr_1:RegisterQuest(game.QUEST_ITEM, ib) then
        q_mgr_1:AddQuestItem(1, "Brother's Corpse", "corpse_human.101", q_iname1)
        pl:Sound(0, 0, 2, 0)
        pl:Write("You take the quest '".. q_mgr_1.name .."'.", game.COLOR_NAVY)
    end
    pl:Interface(-1, ib:Build())
end
-- try to finish: check the quest
local function topCheckQ1()
    if q_mgr_1:GetStatus() == game.QSTAT_NO then
        topicDefault()
        return
    end
    ib:SetTitle("Found my brother?")
    ib:SetMsg("The quest status is: ".. q_mgr_1:GetStatus() .."\n\n")
    if q_mgr_1:GetStatus() ~= game.QSTAT_SOLVED then
        ib:AddMsg("Where is my brother?\n\nCome back if you find him.\n")
        ib:AddQuestChecklist(q_mgr_1)
        ib:SetButton("Back", "hi")
    else
        ib:AddMsg("My.....\n")
        ib:AddMsg("\nMy brother's.... Dead?/\n")
        ib:AddMsg("'Tis a great shame, he was a good man.... \n")
        ib:SetDesc("Here, take this.", 0, 0, 0, 0)
        quest_icons1()
        ib:AddQuestChecklist(q_mgr_1)
        ib:SetAccept(nil, "finishq1")
        ib:SetDecline(nil, "hi")
    end
    pl:Interface(1, ib:Build())
end
-- done: finish quest and give reward
local function topFinishQ1()
    if q_mgr_1:GetStatus() ~= game.QSTAT_SOLVED then
        topicDefault()
        return
    else
        q_mgr_1:RemoveQuestItems()
        q_mgr_1:Finish()
        pl:Sound(0, 0, 2, 0)
        local q_i1 = pl:CreateObjectInside("legs_leather", 1,1)
        q_i1.name = q_iname1
        pl:Write("You got ".. q_iname1.."Soft leather pants!!", game.COLOR_WHITE)
        ib:SetTitle("Hello")
        ib:SetMsg("Thank you for finding my brother.\n")
        ib:SetButton("Ok", "hi")
        pl:Interface(1, ib:Build())
    end
end

local function topTroops()
    ib:SetMsg("\nAfter Moroch's took the Demon Plane,\n")
    ib:AddMsg("\ndemons moved into the animal's homes.\n")
    ib:AddMsg("\nThose animals were forced to attack humans to survive, and the demons stole their food.\n")
    ib:AddMsg("\nI don't believe that the demons killed my brother. I think that they just stole his body from the animals.")
    ib:AddMsg("I don't blame those bears for trying to eat him, the way the demons are treating them.")
    ib:AddMsg("\n\nAnyway, I've talked too much. ")
    ib:AddMsg("You should go now.\n")
    ib:SetButton("Bye", "hi")
    pl:Interface(1, ib:Build())
end

tl = TopicList()
tl:AddGreeting(nil, topicDefault)
tl:SetDefault(topicDefault)
if q_mgr_1:GetStatus() < game.QSTAT_DONE then
    tl:AddTopics("startq1", topStartQ1)
    tl:AddTopics("acceptq1", topAcceptQ1)
    tl:AddTopics("checkq1", topCheckQ1)
    tl:AddTopics("finishq1", topFinishQ1)
end

tl:CheckMessage(event)



That's just a quick edit of the guild hall mercenary script.... it's not done, but i just tried to get a script working.

EDIT:  Please use [ code ] and [ /code ] for such posts  thanks
« Last Edit: November 30, 2008, 12:46:42 am by longir » Logged

----------------------_person_----------------------
----------------------Human Male--------------------

Happy Bday to me!! December 30
smacky
Administrator
*
*
*
*


Karma: +120/-101
Posts: 5381



View Profile
« Reply #3 on: November 29, 2008, 11:41:59 pm »

So what about the logs? They're actually more important as they'll tell you if the script is being run at all (eg, as above) and quite possibly if it is failing and where and why it is failing (ie, without me having to hunt through your script for a bug which might not even exist Wink).

Do you test in DM mode on local (look in server/data/gmaster_file for instructions on how to enable this for all characters -- you uncomment one line then restart the server). Then ingame type /dm.

Now when a script fails (if you're the activator) it spits out a load of output in the chat window (this is the same output that's in the server logs).

EDIT: This will only tell you if the script is broken, not if it isn't run at all -- so you still need to consult the server logs for this.
« Last Edit: November 29, 2008, 11:44:10 pm by smacky » Logged

Pages: [1] Go Up Print 
Daimonin Forum  |  Development  |  Maps  |  Topic: quests « previous next »
Jump to:  

Page created in 0.105 seconds with 17 queries.
Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks
Copyright 2008 Daimonin MMORPG  •  Terms of Service  •  XHTML  •  Daimonin sourceforge open source project