Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Dae galera, seguinte: tou fazendo outro npc, o UZGOD do tibia RL. Tenho o seguinte script:

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

storage1 = 171717


if (msgcontains(msg,'Piece of Draconian Steel')) then

if getPlayerStorageValue(cid,storage1) >= 1 then

  selfSay("I can\'t help you anymore, you already got your obsidian knife", cid)

  talkState[talkUser] = 0

end

if getPlayerStorageValue(cid,storage1) < 1 then

  selfSay("You bringing me draconian steel and obsidian lance in exchange for obsidian knife?",cid)

  talkState[talkUser] = 1

  if (msgcontains(msg,'yes') and talkState[talkUser] == 1) then

	if (doPlayerRemoveItem(cid,5889,1) == TRUE and doPlayerRemoveItem(cid,2425,1) == TRUE) then

	 doPlayerAddItem(cid,5908,1)

	 setPlayerStorageValue(cid,storage1,1)

	 selfSay("You have it.",cid)

	 talkState[talkUser] = 0

	else

	 selSay("You need to bring me a Piece of Draconian Steel and a Obsidian Lance.",cid)

	talkState[talkUser] = 0

  end

end

end

end


end


npcHandler:setMessage(MESSAGE_GREET, "Hiho Player! Wanna weapon, eh?")

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

E o meu problema é que quando vc fala piece of draconian steel e depois YES, ele não remove os itens de ID 5889 e 2425, nem adiciona o item de id 5908

Quem aí pode me ajudar?

Valeu

Editado por diAreia (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Respostas 5
  • Created
  • Última resposta

Top Posters In This Topic

Popular Days

Top Posters In This Topic

tenta assim oh:

elseif (msgcontains(msg,'yes') and talkState[talkUser] == 1) then

	  if(getPlayerItemCount(cid,2425) >= 1) and (getPlayerItemCount(cid,5889) >= 1) then

doPlayerRemoveItem(cid, 2425, 1)

doPlayerRemoveItem(cid, 5889, 1)

doPlayerAddItem(cid,5908,1)

		 setPlayerStorageValue(cid,storage1,1)

		 selfSay("You have it.",cid)

		 talkState[talkUser] = 0

	    else

		 selSay("You need to bring me a Piece of Draconian Steel and a Obsidian Lance.",cid)

	    talkState[talkUser] = 0

muda essa parte ai e testa por favor.

Link para o post
Compartilhar em outros sites

eu fiz isso, agora tá assim:

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

storage1 = 171717

if (msgcontains(msg,'Piece of Draconian Steel')) then

if getPlayerStorageValue(cid,storage1) >= 1 then

  selfSay("I can\'t help you anymore, you already got your obsidian knife", cid)

  talkState[talkUser] = 0

end

if getPlayerStorageValue(cid,storage1) < 1 then

  selfSay("You bringing me draconian steel and obsidian lance in exchange for obsidian knife?",cid)

  talkState[talkUser] = 1

elseif (msgcontains(msg,'yes') and talkState[talkUser] == 1) then

		  if(getPlayerItemCount(cid,2425) >= 1) and (getPlayerItemCount(cid,5889) >= 1) then

  doPlayerRemoveItem(cid, 2425, 1)

  doPlayerRemoveItem(cid, 5889, 1)

  doPlayerAddItem(cid,5908,1)

			    setPlayerStorageValue(cid,storage1,1)

			    selfSay("You have it.",cid)

			    talkState[talkUser] = 0

		   else

			    selSay("You need to bring me a Piece of Draconian Steel and a Obsidian Lance.",cid)

			 talkState[talkUser] = 0

   end

end

end

return true

end

npcHandler:setMessage(MESSAGE_GREET, "Hiho Player! Wanna weapon, eh?")

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

e tá dando o seguinte erro:

Hidden Content

    Give reaction to this post to see the hidden content.

Uploaded with

Hidden Content

    Give reaction to this post to see the hidden content.

Link para o post
Compartilhar em outros sites

Tenta:

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}


local storage1 = 171717 -------------- Storagevalue


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, "quest") or msgcontains(msg, "mission") then

	    selfSay("Para voce sair eu preciso de 1 "..getItemNameById(itemid)..", You bringing me draconian steel and obsidian lance in exchange for obsidian knife?", cid)

	    talkState[cid] = 0

    elseif msgcontains(msg, 'yes') then

	   getPlayerStorageValue(cid,storage1) < 1 then

	   if (doPlayerRemoveItem(cid,5889,1) == TRUE and doPlayerRemoveItem(cid,2425,1) == TRUE) then

				  doPlayerAddItem(cid,5908,1)

       setPlayerStorageValue(cid,storage1,1)

	    selfSay("Adeus.", cid)

	 doTeleportThing(cid, pos)

	 else

	 selfSay("Voce nao possui o item que eu preciso.", cid)

	 end

	 end

     end

	 return TRUE   

	 end



npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Estatísticas dos Fóruns

    96846
    Tópicos
    519603
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo