vakacjus
Lua & C++ Study.
- Joined
- Oct 23, 2008
- Messages
- 255
- Solutions
- 1
- Reaction score
- 26
Hi guys!,
I'm trying to make quest log for every quest on my server but I stop at first
This is quest
How to make it right :x. Please help!
I'm trying to make quest log for every quest on my server but I stop at first
This is quest
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)
local talkState = {}
local quest = 80865
local start_storage = 34247
local str1 = 14136
local kill = 15
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
if getPlayerStorageValue(cid,str1) == 1 and getPlayerStorageValue(cid,quest) == 2 then
setPlayerStorageValue(cid,quest,3)
end
if(not npcHandler:isFocused(cid)) then
return false
elseif msgcontains(msg, "yes") and getPlayerStorageValue(cid,quest) == 1 then
npcHandler:say("Okay good! go kill " ..kill.. " Rats!", cid)
setPlayerStorageValue(cid,start_storage,1)
setPlayerStorageValue(cid,quest,2)
talkState[talkUser] = 0
elseif msgcontains(msg, "mission") then
local str = getPlayerStorageValue(cid,quest)
if(str <= 0) then
npcHandler:say("You have to kill " ..kill.. " rats for us, would you do it?", cid)
setPlayerStorageValue(cid,quest,1)
elseif(str == 2) then
npcHandler:say("Please come back with " ..kill.. " killed rat slains for a reward.", cid)
elseif(str == 3) then
npcHandler:say("You've killed " ..kill.. " rats for me, here is your reward. Thanks alot young warrior!", cid)
setPlayerStorageValue(cid,quest,4)
doPlayerAddExp(cid, 200)
doSendMagicEffect(getThingPos(cid),49)
doCreatureSay(cid, 'You have earned +200 experience, right now.', TALKTYPE_ORANGE_1, false, cid)
doPlayerAddItem(cid, 2148, 30)
elseif(str == 4) then
npcHandler:say("Bye.", cid)
end
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Code:
<?xml version="1.0" encoding="UTF-8"?>
<quests>
<quest name="Begginer challenge" startstorageid="34247" startstoragevalue="1">
<mission name="The Rats Problem" storageid="14136" startvalue="0" endvalue="4">
<missionstate id="0" description="Enter a description here."/>
<missionstate id="1" description="Enter a description here.!"/>
<missionstate id="2" description="Enter a description here.!!"/>
<missionstate id="3" description="Enter a description here.!!!"/>
</mission>
</quest>
</quests>
How to make it right :x. Please help!