Postado Julho 14, 2012 12 anos 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 Julho 14, 2012 12 anos por diAreia (veja o histórico de edições)
Postado Julho 14, 2012 12 anos 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.
Postado Julho 14, 2012 12 anos Autor 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: Uploaded with ImageShack.us
Postado Julho 14, 2012 12 anos 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())
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.