Galera , depois de muito esforço , consegui fazer um npc que troca O Teddy Bear por Thunder Hammer
Vá na pasta do seu otserv , abre a pasta "npc" e copia qualquer npc , deleta tudo e cola isso !!! Renomeia o Npc como Thunder Hammer , caso queira trocar , coloca O nome e <npc name="Thunder Hammer" troque o Thunder Hammer pelo nick que voce colocou
<?xml version="1.0"?>
<npc name="Thunder Hammer" script="data/npc/scripts/thunder.lua" autowalk="150" floorchange="0" access="3" lookdir="2">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="132" head="78" body="88" legs="0" feet="88" addons="3"/>
</npc>
Depois na mesma pasta vai em scripts
Copia qualquer um ai , deleta tudo !! e cola isso !
Renomei como thunder !!! --- t minusculo
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
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg, 'help') or msgcontains(msg, 'thunder hammer') then
selfSay('Você pode trocar seu Teddy Bear por uma thunder hammer , é so você falar Thunder Hammer , e com o teddy bear + 20k que eu aceito')
elseif msgcontains(msg, 'Thunder Hammer') or msgcontains(msg, 'th') or msgcontains(msg, 'thunder hammer') or msgcontains(msg, 'T hammer') or msgcontains(msg, 'thunder h') then
selfSay('Você gostaria trocar seu teddy bear por uma thunder hammer? custará 20k + o teddy bear')
talk_state = 1
elseif msgcontains(msg, 'yes') and talk_state == 1 then
if getPlayerItemCount(cid,2112) >= 1 and getPlayerItemCount(cid,2112) >= 100 or getPlayerItemCount(cid,2112) >= 1 then
selfSay('Aqui está sua Thunder Hammer!.')
doPlayerTakeItem(cid, 2112, 1)
doPlayerRemoveMoney(cid,20000)
doPlayerAddItem(cid,2421,1)
else
selfSay('Desculpe, você esqueceu de me trazer o teddy bear.')
end
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay('Ok than.')
talk_state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Eskeci , só fazer a quest colocar o Teddy Bear , sumonar o npc , ou adicionar ele fixo no mapa .... e rodar
!! teste e não deu nada !!! 100% Lasanha