Vá em data/npc/script crie um arquivo chamado staff,lua e cole isso:
local umaVez = sim -- Aqui você bota sim, para que o player faça só uma vez
local level = sim -- Se precisa de level pra fazer
local checaLevel = 8 -- Level nessesarion
local idStaff1 = 1511 -- id dos itens que precisa pra fazer a staff
local idStaff2 = 1511
local idStaff3 = 1511
local staff = 5262 -- Aqui a staff que o npc vai dar
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)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
-- Conversa Jogador/NPC
if umaVez == "sim" and getStor(cid, 148) >= 1 then selfSay('Você já me entregou os itens.') return true end
if(msgcontains(msg, 'hi') and getStor(cid, 770) <= 0) then
if level == "sim" and getPlayerLevel(cid) >= 8 then else return selfSay('Você precisa de level '..checaLevel..', para pegar a staff.') end
setStor(cid, 770, 1)
selfSay('O que desejas aqui |PLAYERNAME|?')
elseif(msgcontains(msg, 'staff')and getStor(cid, 770) == 1) then
selfSay('Então, você tem as 3 partes para completar a staff?.')
setStor(cid, 770, 2)
elseif(msgcontains(msg, 'yes')and getStor(cid, 770) == 3) then
if(doPlayerRemoveItem(cid, idStaff1,1)) then else return selfSay('Você não tem todos os itens para fazer a staff.') end
if(doPlayerRemoveItem(cid, idStaff2,1)) then else return selfSay('Você não tem todos os itens para fazer a staff.') end
if(doPlayerRemoveItem(cid, idStaff3,1)) then else return selfSay('Você não tem todos os itens para fazer a staff.') end
doPlayerAddItem(cid, staff, 1)
setStor(cid, 148, 1)
selfSay('Aqui está a sua staff!')
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
function setStor(cid, sto, value)
return setPlayerStorageValue(cid, sto, value)
end
function getStor(cid, value)
return getPlayerStorageValue(cid, value)
end
Depois crie um arquivo em data/npc chamado staff e cole isso:
<?xml version="1.0" encoding="UTF-8"?> <npc name="Chuck Norris" script="staff.lua" walkinterval="350000" floorchange="0" speed="0" lookdir="2"> <health now="150" max="150"/> <look type="502" head="92" body="113" legs="87" feet="87"/> <parameters> </parameters> </npc>






info
Grupo: Campones
Registrado: 03/07/11
Posts: 33
Reputação: 0
Gostaria de saber se é possível, um npc que troque itens.
Exemplo: Tenho 3 itens separados (No caso IDS: 12285, 12286, 12287). E quando eu falar com o "NPC" Ele juntará os 3 itens e formará uma staff. (No caso ID: 12288).
Bom, creio que isso seja um script.
Protocolo: TFS 0.4.
Versão: 8.6.
Obrigado a todos!
Editado Julho 10 por lokitobr12