Hello have an issue with a quest i have done with an npc that you can do it serval of times just want you to be able to do it once!
General Bison.xml
Quest2.lua
General Bison.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="General Bison " script="data/npc/scripts/Quest2.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look type="134" head="114" body="132" legs="114" feet="76" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hey you Solider I have a {quest} for you" />
<parameter key="module_keywords" value="1" />
</parameters>
</npc>
Quest2.lua
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
item = 'You do not have the required items.'
done = 'Here you are.'
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'quest') then
selfSay('I have Your first quest here! Go down to the south east house and grab my girls wooden {doll} from the chest', cid)
elseif msgcontains(msg, 'doll') then
if getPlayerItemCount(cid,2108) >= 1 then
selfSay('Great I see that you have the doll! Can I have it?', cid)
talk_state = 2
else
selfSay('Ehh... are you trying to fool me?', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerItemCount(cid,2108) >= 1 then
if doPlayerRemoveItem(cid,2108, 1) == TRUE then
selfSay('Thank you so much Now that I can trust you I have a bigger task for you but wait your weapon looks awful please go to Ian and he will help you get a better weapon and here is some money for your help.', cid)
doPlayerAddItem(cid, 2152, 40)
doPlayerAddExp(cid, 1000)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay('Fool! Stop wasting my time then!')
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

