É o seguinte eu estou com um NPC aqui mais nao funciona direito .. .
Eu quero um npc chamado Gin Bester que troque:
Por:
__
• Somente irá a recompensa se tiver os itens pedido acima, caso não tenha não pegue a recompensa.
Eu tenho esse script aqui, mais parece que não da certo ... vê se ajuda vocês ..
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
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'help') then
selfSay('You can here change some items for mission.')
elseif msgcontains(msg, 'mission') then
if getPlayerItemCount(cid,5944) >= 100 and getPlayerItemCount(cid,6500) >= 100 and
getPlayerItemCount(cid,5905) >= 50 and getPlayerItemCount(cid,5879) >= 50 and getPlayerItemCount(cid,2193)
>= 5 then
selfSay('Did you bring me the 100 soul orb, 100 demonic essence, 50 giant spider silk, 50 vampire dust and 5 ankh?')
talk_state = 15
else
selfSay('I need 100 soul orb, 100 demonic essence, 50 giant spider silk, 50 vampire dust and 5 ankh to give you the
recompesation. Come back when you have them.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,5944) >= 100 and getPlayerItemCount(cid,6500) >= 100 and
getPlayerItemCount(cid,5905) >= 50 and getPlayerItemCount(cid,5879) >= 50 and getPlayerItemCount(cid,2193)
>= 5 then
if doPlayerRemoveItem(cid,5944,100) == 1 and doPlayerRemoveItem(cid,6500,100) == 1 and
doPlayerRemoveItem(cid,5905,50) == 1 and doPlayerRemoveItem(cid,5879,50) == 1 and
doPlayerRemoveItem(cid,2193,5) == 1 then
doPlayerAddItem(cid,2160,100)
doPlayerAddItem(cid,10518,1)
else
end
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay('Ok than.')
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
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Desde Já, Agradeço !!