Postado Abril 8, 2015 10 anos Autor Ainda não funcionou. O jeito que a Caronte disse 2 post a cima também não deu, ainda ocorre o erro na distro.
Postado Abril 8, 2015 10 anos Autor Testei o npc deste link http://www.tibiaking.com/forum/topic/38037-npc-que-muda-nome/ nem sei onde mudar isto que esta no link a cima: item = {9971, 100}, -- itemid, itemcount botei script assim Mostrar conteúdo oculto local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talk = {}local name = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) endfunction onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) endfunction creatureGreetCallback(cid)talk[cid] = 0name[cid] = ''return trueendlocal chars = {' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}RET_VALID = 1RET_EXISTS = 2RET_INVALID = 3local function validName(name)if getPlayerGUIDByName(name) ~= nil thenreturn RET_EXISTSendfor i = 1, name:len() doif not(isInArray(chars, name:sub(i,i))) thenreturn RET_INVALIDendendreturn RET_VALIDendlocal function getValid(name, opt)local function tchelper(first, rest)return first:upper()..rest:lower()endreturn opt and name:gsub("(%a)([%w_]*)", tchelper) or name:gsub("^%l", string.upper)endlocal config = {type = 'item', -- or 'item'money = 0, -- = 1cceveryFirstLetterCapital = false}function messageDefaultCallback(cid, type, msg)if not(npcHandler:isFocused(cid)) thenreturn falseendif msgcontains(msg, "nome") and talk[cid] == 0 thenselfSay("Qual deve ser o seu novo nome?", cid)talk[cid] = 1elseif talk[cid] == 1 thenlocal v = getValid(msg:lower(), config.everyFirstLetterCapital)local ret = validName(v)if ret == RET_VALID thenselfSay("Então você quer '" .. v .. "' Para ser seu novo nome por " .. (config.type == "money" and (config.money .. " gold") or (config.item[2] .. ' ' .. (config.item[2] > 1 and getItemPluralNameById(config.item[1]) or getItemNameById(config.item[1])))) .. "?", cid)talk[cid], name[cid] = 2, velseif ret == RET_INVALID thenselfSay(msg .. " não é um nome válido. Qual deve ser o seu novo nome?", cid)elseif ret == RET_EXISTS thenselfSay(msg .. " já existe. Qual deve ser o seu novo nome?", cid)endendelseif talk[cid] == 2 thenif msgcontains(msg, "yes") thenif (config.type == 'money' and doPlayerRemoveMoney(cid, config.money)) or (config.type ~= 'money' and doPlayerRemoveItem(cid, config.item[1], config.item[2])) thenlocal curName = getPlayerName(cid)doRemoveCreature(cid)db.executeQuery("UPDATE players SET name = '"..name[cid].."' WHERE name = '"..curName.."';")elseselfSay("Você não tem " .. (config.type == "money" and (config.money .. " gold") or (config.item[2] .. ' ' .. (config.item[2] > 1 and getItemPluralNameById(config.item[1]) or getItemNameById(config.item[1])))) .. "!", cid)talk[cid] = 0endelseselfSay("Não estou disponível no momento, talvez mais tarde.", cid)talk[cid] = 0endendreturn trueendnpcHandler:setMessage(MESSAGE_FAREWELL, "tchau.")npcHandler:setMessage(MESSAGE_WALKAWAY, "Vá embora")npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, messageDefaultCallback)npcHandler:setCallback(CALLBACK_FAREWELL, creatureFarewell)npcHandler:setCallback(CALLBACK_CREATURE_DISAPPEAR, creatureFarewell)npcHandler:setCallback(CALLBACK_GREET, creatureGreetCallback)npcHandler:addModule(FocusModule:new()) Não funcionou, deu erro. erro no distro: erro apos falar com npc dentro do jogo: Realmente o erro ainda ta la. Será que pode ser erro do script renamer? Por que acontece o erro no jogo apos o npc dizer "qual nome novo? Apos eu digitar o novo nome ele da o erro na distro. Editado Abril 8, 2015 10 anos por acesso123 (veja o histórico de edições)
Postado Abril 8, 2015 10 anos Qual é o item que ira utilizar ? Editado Abril 8, 2015 10 anos por igorcbc (veja o histórico de edições)
Postado Abril 8, 2015 10 anos Autor Deu erro denovo, não sei se configurei certo o script do npc, no meu post a cima, citei onde foi o erro. tem como me da uma ajuda com isso por favor?
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.