bem vou te passar um script que funciona assim como vc quer, eu editei ele ele era o npc a sweaty cyclops.
va´em data/npc dentro vc crie um arquivo.xml (coloque o nome que vc kizer) e dentro bote isso:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="nome do seu npc" script="data/npc/scripts/nome do script.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="22" head="0" body="0" legs="0" feet="0"/>
<parameters>
<parameter key="message_greet" value="Hum Humm! Welcume |PLAYERNAME|." />
<parameter key="message_decline" value="Alright then. Come back when you got the neccessary items." />
<parameter key="message_walkaway" value="Farewell, human." />
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="job" />
<parameter key="keyword_reply1" value="I'm an forger." />
</parameters>
</npc>
e depois va em data/npc/scripts e crie um arquivo.lua (com o nome que vc colocou acima ~~>
script="data/npc/scripts/nome do script.lua"
) e dentro dele coloque isso:
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
-- XVX FORGER START --
function crude(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerItemCount(cid,5879) >= 1 then
if doPlayerRemoveItem(cid,5879,1) then
npcHandler:say('Here is your item!', cid)
doPlayerAddItem(cid,5892,1)
end
else
npcHandler:say('You don\'t have these items!', cid)
end
end
-- XVX FORGER END --
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can forge Huge Chunk of Crude Iron "})
local node3 = keywordHandler:addKeyword({'crude'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Giant Spider Silk for a Huge Chunk of Crude Iron?'})
node3:addChildKeyword({'yes'}, crude, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
npcHandler:addModule(FocusModule:new())
altere a gosto!
acima ele troca uma Gs Silk por um Huge Chunk of Crude Iron!
lembrando que esse script e o msmo do a sweat cyclops sendo que eu resumi para fikar de acordo com que vc quer!
se ajudei + rep , se nao poste aki no topico suas duvidas!


info
Grupo: Campones
Registrado: 08/02/11
Posts: 2
Reputação: 0
Eu estou tentando criar um npc que pega um item e entrega outro.
tipo assim ele vai pedir um item o cara vai lá mata o bixo e trás fala com ele, ele pega o item e entrega outro como recompensa mais está dando este erro quando boto on o server.
O .lua que está dando erro é esse
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, item, frompos, item2, topos) npcHandler:onCreatureSay(cid, item, frompos, item2, topos) end function onThink() npcHandler:onThink() end if getPlayerStorageValue(cid,9999) == -1 then (eu botei esse if por que se o cara pegou o item na caixa lá já ele passa direto.) keywordHandler:addKeyword(StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ola. Eu Tenho uma {missao} para você.', reset = true}) else if doPlayerRemoveItem(cid, 2139) == TRUE then doPlayerAddItem(cid, 2472, 1) keywordHandler:addKeyword(StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Muito obrigado bravo guerreiro. Tome está armadura como recompensa.', reset = true}) end keywordHandler:addKeyword({'missao'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'alguns bandidos roubaram a tiara da rainha por favor vá busca-lá rapido eles foram por aqui.', reset = true}) end npcHandler:addModule(FocusModule:new())Editado Junho 5 por Limaoloko