Ir para conteúdo

Featured Replies

Postado

Fala ai galera do TK, hoje eu estaria precisando ae da ajudinha de algum de vcs, eu estou querendo um npc que pede algum item pra teleportar o jogador, então tipo, a parte do scripit que decide ta aqui:

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 1000000, destination = {x=933, y=1066, z=10} })
travelNode:addChildKeyword({'sim'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 1000000, destination = {x=933, y=1066, z=10} })

só que tipo, no "cost" ali, ele só aceita dinheiro, e eu não sei como eu faço pra mudar pra pedir item, quem souber por favor me falar ai,

Resolvido por L3K0T

Ir para solução
  • Respostas 5
  • Visualizações 987
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local pos = {x=152,y=58,z=7} --Pos para ond

Postado

 

Fala ai galera do TK, hoje eu estaria precisando ae da ajudinha de algum de vcs, eu estou querendo um npc que pede algum item pra teleportar o jogador, então tipo, a parte do scripit que decide ta aqui:

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 1000000, destination = {x=933, y=1066, z=10} })
travelNode:addChildKeyword({'sim'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 1000000, destination = {x=933, y=1066, z=10} })

só que tipo, no "cost" ali, ele só aceita dinheiro, e eu não sei como eu faço pra mudar pra pedir item, quem souber por favor me falar ai,

 

amigo posta o script inteiro e o ID do item que vc quer que o npc aceite!

wq3bBzt.png
Pokémon Dust Evolution
 
É aonde começa sua nova aventura!! 

 

Facebook

 
Verifique Atualizações

 

Postado
  • Autor

Ta ai o scripit todo:

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
        
        
-- OTServ event handling functions start
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
-- OTServ event handling functions end
   
 
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'marte'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você deseja ir para o trono do Deus Marte por 1kk?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 1000000, destination = {x=933, y=1066, z=10} })
travelNode:addChildKeyword({'sim'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 1000000, destination = {x=933, y=1066, z=10} })
 
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())

 
E o id do item é: 11321
Postado
  • Diretor
  • Solução

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local pos = {x=152,y=58,z=7} --Pos para onde o player sera levado--
local itemid = 2468 --Id do item que vai ser removido do player--
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
if msgcontains(msg, "offer") or msgcontains(msg, "help") then
selfSay("Eu posso te levar a TAL lugar por um "..getItemNameById(itemid).." item, fale {travel} se quizer viajar.", cid)
talkState[cid] = 0
elseif msgcontains(msg, 'travel') then
if doPlayerRemoveItem(cid, itemid, 1) then
selfSay("Boa viagem.", cid)
doTeleportThing(cid, pos)
else
selfSay("Voce nao tem o item nescessario.", cid)
end
end
return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

Postado
  • Autor

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

local pos = {x=152,y=58,z=7} --Pos para onde o player sera levado--

local itemid = 2468 --Id do item que vai ser removido do player--

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

if msgcontains(msg, "offer") or msgcontains(msg, "help") then

selfSay("Eu posso te levar a TAL lugar por um "..getItemNameById(itemid).." item, fale {travel} se quizer viajar.", cid)

talkState[cid] = 0

elseif msgcontains(msg, 'travel') then

if doPlayerRemoveItem(cid, itemid, 1) then

selfSay("Boa viagem.", cid)

doTeleportThing(cid, pos)

else

selfSay("Voce nao tem o item nescessario.", cid)

end

end

return TRUE

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

Ae mano valeu, funcionou certinho, brigadao ai :D 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo