Ir para conteúdo

Featured Replies

Postado

Queria um npc que o player trocasse os itens pela vocaçao e teletransportasse o player para x,y,z

Tipo:

player vocation y

player: hi

npc: Hello |PLAYERNAME|. Do you want to be promoted to "vocation"?

player: vocaçao

npc: Bring me a "xx" a "xxx" and a "x"!. Do you sure? it will be irreversible! Yes or no?

player: yes

npc: You changed your vocation to vocation of the Vocation

se ele n for da vocaçao y

npc :You have ever vocation is the Angel or do not have the necessary items

Por exemplo, o player da 10k + um tal item e ganha em troca a vocação.

Editado por Thiago Duarte (veja o histórico de edições)

  • Respostas 15
  • Visualizações 1.6k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Perdão, eu que tô me apressando muito e tô fazendo o bang sem cuidado, erros bestas esses que estão dando. local item1 = 107 local quant1 = 1 local vocation13 = 4 local pos = {x=1024, y

  • Testa aí, substituí a função que ele dizia não existir. local item1 = 107 local quant1 = 1 local vocation13 = 4 local pos = {x=1024, y=1027, z=7} local keywordHandler = KeywordHandler:n

  • Dúvida sanada, tópico movido.

Postado
  • Autor

Tonyplyson tento fazer pra mim o npc mais deu erro alguem concerta?

Script npc

local item1 = 107

local quant1 = 1

local vocation13 = 4

local pos = {x=1024, y=1027, z=7}

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 santaNPC(cid, message, keywords, parameters, node)

if(not npcHandler:isFocused(cid)) then

return false

end

if(parameters.present == true) then

if(doPlayerRemoveItem(cid,item1,quant1) == true) then

doSetPlayerVocation(cid, 4)

doTeleportThing(cid, pos)

npcHandler:say('You changed your vocation to vocation of the Angel.',cid)

else

npcHandler:say('You have ever vocation is the Angel or do not have the necessary items .',cid)

end

npcHandler:resetNpc()

return true

end

end

npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|. Do you want to be promoted to {angel}?.")

local noNode = KeywordNode:new({'no'}, santaNPC, {present = false})

local yesNode = KeywordNode:new({'yes'}, santaNPC, {present = true})

local node = keywordHandler:addKeyword({'angel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Bring me an enchanted wing !. Do you sure? it will be irreversible! {yes}'})

node:addChildKeywordNode(yesNode)

node:addChildKeywordNode(noNode)

npcHandler:addModule(FocusModule:new())

NPC

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Angel Promotion" script="data/npc/scripts/mone.lua" walkinterval="2000" floorchange="0">

<mana now="800" max="800"/>

<health now="200" max="200"/>

<look type="57" head="0" body="0" legs="0" feet="0" addons="0"/>

</npc>

o erro que da é assim o npc pega os itens mais n manda o player pro local {x=1024, y=1027, z=7} e n da a vocaçao

Na console da isso

[11/12/2012 12:59:50] [Error - Npc interface]

[11/12/2012 12:59:50] data/npc/scripts/mone.lua:onCreatureSay

[11/12/2012 12:59:50] Description:

[11/12/2012 12:59:50] data/npc/scripts/mone.lua:23: attempt to call global 'doSetPlayerVocation' (a nil value)

[11/12/2012 12:59:50] stack traceback:

[11/12/2012 12:59:50] data/npc/scripts/mone.lua:23: in function 'callback'

[11/12/2012 12:59:50] data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'processMessage'

[11/12/2012 12:59:50] data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'processNodeMessage'

[11/12/2012 12:59:50] data/npc/lib/npcsystem/keywordhandler.lua:122: in function 'processMessage'

[11/12/2012 12:59:50] data/npc/lib/npcsystem/npchandler.lua:380: in function 'onCreatureSay'

[11/12/2012 12:59:50] data/npc/scripts/mone.lua:14: in function <data/npc/scripts/mone.lua:14>

Editado por Thiago Duarte (veja o histórico de edições)

Postado

Testa aí, substituí a função que ele dizia não existir.




local item1 = 107

local quant1 = 1


local vocation13 = 4

local pos = {x=1024, y=1027, z=7}


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 santaNPC(cid, message, keywords, parameters, node)

if(not npcHandler:isFocused(cid)) then

return false

end

if(parameters.present == true) then

if(doPlayerRemoveItem(cid,item1,quant1) == true) then

doPlayerSetVocation(cid, 4)

doTeleportThing(cid, pos)

npcHandler:say('You changed your vocation to vocation of the Angel.',cid)

else

npcHandler:say('You have ever vocation is the Angel or do not have the necessary items .',cid)

end

npcHandler:resetNpc()

return true

end

end


npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|. Do you want to be promoted to {angel}?.")


local noNode = KeywordNode:new({'no'}, santaNPC, {present = false})

local yesNode = KeywordNode:new({'yes'}, santaNPC, {present = true})


local node = keywordHandler:addKeyword({'angel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Bring me an enchanted wing !. Do you sure? it will be irreversible! {yes}'})

node:addChildKeywordNode(yesNode)

node:addChildKeywordNode(noNode)

npcHandler:addModule(FocusModule:new())


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