Hey I've been trying to get my quest log to work but so far no luck, i was hoping that someone could take a look at my code and see if i missed something:
Here is my quests.xml document
Here is the npc script
Setting the player storage value is working, because you can complete the whole quest and the npcs talk stages work, it just won't show up in the quest log.
thanks,
Jester
Here is my quests.xml document
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<quests>
<quest name="Rebellion beer run" startstorageid="25000" startstoragevalue="1">
<mission name="Dabeers Ale" storageid="25001" startvalue="0" endvalue="3">
<missionstate id="0" description="Speak to Dabeers."/>
<missionstate id="1" description="Dabeers asked you to kill Amorfo, and retrieve his beer."/>
<missionstate id="2" description="You obtained the beer, you should collect your reward from Dabeers."/>
<missionstate id="3" description="Dabeers rewarded you for your noble act."/>
</mission>
</quest>
</quests>
Here is the npc script
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local storage = 25001
if(msgcontains(msg, 'quest') or msgcontains(msg, 'beer')) then
if(getPlayerStorageValue(cid, storage) < 1) then
npcHandler:say("The damn cyclops stole my beer. Kill Amorfo, their behemoth general, and bring it to me.", cid)
setPlayerStorageValue(cid, storage, 1)
elseif(getPlayerStorageValue(cid, storage) == 1) then
npcHandler:say("Do you have my beer?", cid)
talkState[talkUser] = 1
elseif(getPlayerStorageValue(cid, storage) == 2) then
npcHandler:say("I love this beer.", cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, 7706, 1) == TRUE) then
npcHandler:say("Thanks! Take this dwarven armor!", cid)
doPlayerAddItem(cid, 2503, 1)
doPlayerAddItem(cid, 2504, 1)
setPlayerStorageValue(cid, storage, 2)
talkState[talkUser] = 0
else
npcHandler:say("You do not have my beer", cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
npcHandler:say("damn", cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Setting the player storage value is working, because you can complete the whole quest and the npcs talk stages work, it just won't show up in the quest log.
thanks,
Jester