Ir para conteúdo

[Npc] Colocar Nick Nos Pokemon


DevilMoon

Posts Recomendados

Vá em Data>Npc crie um arquivo .xml chamado name

 

 

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

<npc name="Namer" script="nick.lua" walkinterval="350000" floorchange="0" speed="0" lookdir="2">

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

   <look type="178" head="91" body="114" legs="86" feet="0"/>

   <parameters>


   </parameters>

</npc>

 

 

 

Agora Vá em Data>Npcs>Scripts e crie uma pasta chamada nick.lua e coloque isto dentro

 

 

local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
local talkState = {}
local finalname = ""

function onThingMove(creature, thing, oldpos, oldstackpos)
end

function onCreatureAppear(creature)
end

function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye sir!')
focus = 0
talk_start = 0
end
end

function onCreatureTurn(creature)
end

function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end

function onCreatureSay(cid, type, msge)
local msg = string.lower(msge)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if getPlayerStorageValue(cid, ginasios["Brock"].storage) >= 1 then
return true
end

if (msgcontains(msg, 'hi') and (focus == 0) and (focus ~= cid) and (getDistanceToCreature(cid) <= 4)) then
   --if not isPremium(cid) then
   --selfSay("Hello, "..getCreatureName(cid).."! I'm sorry, but I can only give nicknames to pokemons for premium members!")
   --return true
   --end
focus = cid
talkState[talkUser] = 1
selfSay("Hello, "..getCreatureName(cid).."! I can give your pokemon a nickname, would you like it?")
elseif (msgcontains(msg, "no") or msgcontains(msg, "bye")) and focus == cid and talkState[talkUser] ~= 3 then
selfSay("No problem then, sir. Come back when you feel like it!")
focus = 0
elseif msgcontains(msg, "yes") and focus == cid and talkState[talkUser] == 1 then
       if not isInArray({2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216,
2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2227}, getPlayerSlotItem(cid, 8).itemid) then
       selfSay("Sorry, you don't have a pokemon in the main slot!")
       focus = 0
       return true
       end
selfSay("What nickname would you like me to give to your pokemon?")
talkState[talkUser] = 3
elseif talkState[talkUser] == 3 and focus == cid then

local tablee = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "x", "w", "y", "z", ".", ":", "'", '"', "~", "^", "@", "#", "$", "%", "&", "*", "(", ")", "-", "+", "_", "?", ">", "<", "•", ";", "°", "¹", "²", "³", "£", "¢", "¬", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}
local table = {"'", '"', "!", "ã", "õ", "ç", "´", "`", "á", "à", "ó", "ò", "é", "è", "í", "ì", "ú", "ù", "¹", "²", "³", "£", "¢", "¬", "§", "°", "º", "ª", "•", "|"}
   for a = 1, #table do
   if string.find(msg, table[a]) then
   selfSay("Sorry, the nick has invalid symbols.")
   return true
   end
   end
   if string.len(msg) <= 1 or string.len(msg) >= 14 then
   selfSay("Sorry, that nick is too long or too short!")
   return true
   end
local pokename = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")
selfSay("Are you sure that you want to change your's "..pokename.." to \""..msge.."\"? This is going to cost you 10 hundred dollars.")
talkState[talkUser] = 5
finalname = msge
elseif msgcontains(msg, "yes") and focus == cid and talkState[talkUser] == 5 then
   if doPlayerRemoveMoney(cid, 100000) == false then
   selfSay("You don't have enough money to afford this service, come back later.")
   focus = 0
   talkState[talkUser] = 0
   return true
   end
if getPlayerStorageValue(cid, 9912) == -1 then
setPlayerStorageValue(cid, 9912, 0)
end
local newarch = ""..getCreatureName(cid)..""..getPlayerStorageValue(cid, 9912)..""
doCopyPokemon(getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke"), newarch)
doEditName("C:/Users/WAGNER DOS SANTOS/Desktop/ot/Pokemon Dash/data/monster/pokes/nicked/"..newarch..".xml", finalname, getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke"))
local newfile = ""..newarch..".xml"
doAddMonsterInXML(newarch, newfile)
doReloadInfo(RELOAD_MONSTERS)
selfSay("Done! Your pokemon now has a new name, try it!")
doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "nick", newarch)
local newdes = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "fakedesc").."\nIt's nickname is: "..finalname.."."
doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "description", newdes)
doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "nname", finalname)
setPlayerStorageValue(cid, 9912, getPlayerStorageValue(cid, 9912)+1)
focus = 0
talkState[talkUser] = 0
end
end

function onThink()
if focus ~= 0 then
a, b, c = selfGetPosition()
if c ~= getThingPos(focus).z then
focus = 0
end
end

if focus ~= 0 then
if getDistanceToCreature(focus) > 6 then
focus = 0
end
end

return true
end

 

 

 

Bom Funciona, está no meu server e ta funcionando perfeitamente!

 

 

http://fox-pokemon.blogspot.com

Editado por DevilMoon
Link para o comentário
Compartilhar em outros sites

não vai funcionar só com esses 2 arquivos, precisa da lib

esse npc fui eu quem fiz e ele cria um novo xml de monstro a cada vez que você troca o nick

foi a maneira que consegui fazer antes de fazer a função que simplesmente muda o nome do monstro que aparece no cliente

 

pokemon squadium é na verdade um server meu que vazou por falha minha e acabaram postando ele, só que é muito primitivo

eu fiz um novo nick.lua que funcionava com uma função que muda direto o nick do pokemon, sem precisar ficar criando novos xml e dar reload em monsters, sorte que eu fiz um backup do sistema antigo de mudar nome

mas o goback tem que ser compatível com ele

enfim, tem que achar um arquivo que tenha essa funções:

 

doCopyPokemon
doEditName
doAddMonsterInXML

 

ele tá na pasta data/lib, só não lembro o nome

Editado por brun123
Link para o comentário
Compartilhar em outros sites

ele posto com um aceso a uma pasta que seria so no pc dele kkkkk

doEditName("C:/Users/WAGNER DOS SANTOS/Desktop/ot/Pokemon Dash/data/monster/pokes/nicked/"..newarch..".xml", finalname, getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke"))

sausahusasausah

Link para o comentário
Compartilhar em outros sites

  • 4 months later...
×
×
  • Criar Novo...