onroaker101
New Member
- Joined
- Jul 29, 2009
- Messages
- 9
- Reaction score
- 0
code
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'quest') then
if getPlayerStorageValue(cid, 30120) == -1 then
npcHandler:say('Hello |PLAYERNAME|, I really need your {help}', cid)
talkState[talkUser] = 1
end
elseif talkState[talkUser] == 1 then
if msgcontains(msg, 'help') then
npcHandler:say('My brother went to the {Troll Island} to do some research. It has been one weeks and he has not returned. I am worried deeply. Can you go to Troll Island and find him.', cid)
end
elseif talkState[talkUser] == 1 then
if msgcontains(msg, 'Troll') then
npcHandler:say('Go directly east of here and you will find Sarlom. He is my cousin and he can take you to Troll Island. Also bring me his wedding ring back so that I could know if you found him.', cid)
setPlayerStorageValue(cid,30120,1)
end
elseif talkState[talkUser] == 2 then
if msgcontains(msg, 'Wedding') then
npcHandler:say('Did you bring me back his wedding ring?', cid)
if doPlayerRemoveItem(cid,2121,1) == TRUE then
setPlayerStorageValue(cid,30121,2)
setPlayerStorageValue(cid,60035,1)
doPlayerAddItem(cid,2148,150)
doPlayerAddExp(cid,200)
talkState[talkUser] = 3
else
npcHandler:say('Please bring me his wedding ring so I know that you found him.', cid)
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
what is wrong with it?....? its suposto be a quest npc but it dont work.. HELP PLZ
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'quest') then
if getPlayerStorageValue(cid, 30120) == -1 then
npcHandler:say('Hello |PLAYERNAME|, I really need your {help}', cid)
talkState[talkUser] = 1
end
elseif talkState[talkUser] == 1 then
if msgcontains(msg, 'help') then
npcHandler:say('My brother went to the {Troll Island} to do some research. It has been one weeks and he has not returned. I am worried deeply. Can you go to Troll Island and find him.', cid)
end
elseif talkState[talkUser] == 1 then
if msgcontains(msg, 'Troll') then
npcHandler:say('Go directly east of here and you will find Sarlom. He is my cousin and he can take you to Troll Island. Also bring me his wedding ring back so that I could know if you found him.', cid)
setPlayerStorageValue(cid,30120,1)
end
elseif talkState[talkUser] == 2 then
if msgcontains(msg, 'Wedding') then
npcHandler:say('Did you bring me back his wedding ring?', cid)
if doPlayerRemoveItem(cid,2121,1) == TRUE then
setPlayerStorageValue(cid,30121,2)
setPlayerStorageValue(cid,60035,1)
doPlayerAddItem(cid,2148,150)
doPlayerAddExp(cid,200)
talkState[talkUser] = 3
else
npcHandler:say('Please bring me his wedding ring so I know that you found him.', cid)
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
what is wrong with it?....? its suposto be a quest npc but it dont work.. HELP PLZ