GMRaphael 34 Postado Junho 9, 2011 Share Postado Junho 9, 2011 (editado) Primeiramente se já ouver o NPC GYM Misty Aqui no Forum Podem Fechar o Tópico. Eae Galera Do XTibia Vou ensinar como Fazer o NPC GYM Misty. No Final Explicarei Aonde Adcionar Mas Pokes. Então Vamos lá: Primeiro Passo: Vá em DATA/LIB/ e Crie Um Arquivo Chamado gymlib.lua (LUA) e Coloque isto Dentro. funcpokemon = {2531, 2652, 2653, 2654, 2195} -- ID das pokebolas (o pokemon tem que estar vivo nessas IDs) bpslot = CONST_SLOT_BACKPACK --em outros servers, pode ser que seja CONST_SLOT_AMMO o lugar onde fica a backpack no inventory ginasios = { ["Misty"] = { storage = 992, msgdefeat = "You lost! You aren't strong enough yet, don't come back until you get stronger!", msgafk = "Go away if you don't have any pokemons!", msgwin = "Congratulations, you were strong enough to win this battle fairly! Take this Water Badge as reward.", [1] = { msggo = "Lets fight then! I choose you, Starmie!", msgba = "That's enough, Starmie!", pokem = "Misty Starmie", nextp = "Misty Poliwrath"}, [2] = { msggo = "It's your turn, Poliwrath!", msgba = "Come back, Poliwrath!", pokem = "Misty Poliwrath", nextp = "Misty Gyarados"}, [3] = { msggo = "Crush'em, Gyarados!", msgba = "You did well, Gyarados!", pokem = "Misty Gyarados", nextp = "Misty Blastoise"}, [4] = { msggo = "Crush'em, Blastoise!", msgba = "You did well, Blastoise!", pokem = "Misty Blastoise", nextp = "finish"} } } function noPokeAtAll(cid, gympoke, npcname, msgafk) if not isCreature(cid) then return false end if not isCreature(gympoke) then return false end if #getCreatureSummons(cid) == 0 and getPlayerStorageValue(cid, 992) == 0 and getPlayerStorageValue(cid, ginasios[npcname].storage) ~= 2 then setPlayerStorageValue(cid, 992, -1) doCreatureSay(getCreatureByName(npcname), msgafk, 1) doSendMagicEffect(getThingPos(gympoke), 10) setPlayerStorageValue(cid, ginasios[npcname].storage, 0) doRemoveCreature(gympoke) return true end end function gymChecker(cid, duel, nb, npcname) if not isCreature(cid) then return true end if not isCreature(duel) then doSendMagicEffect(getThingPos(cid), 10) doRemoveCreature(cid) return true end if getDistanceBetween(getThingPos(getCreatureByName(npcname)), getThingPos(duel)) >= 8 then doSendMagicEffect(getThingPos(cid), 10) doRemoveCreature(cid) setPlayerStorageValue(duel, ginasios[npcname].storage, 0) return true end if isCreature(duel) and getPlayerStorageValue(duel, 992) == 0 then addEvent(noPokeAtAll, 6000, duel, cid, npcname, ginasios[npcname].msgafk) end if isCreature(duel) and getPlayerStorageValue(duel, 992) == -1 then doSendMagicEffect(getThingPos(cid), 10) doRemoveCreature(cid) setPlayerStorageValue(duel, ginasios[npcname].storage, 0) doCreatureSay(getCreatureByName(npcname), ginasios[npcname].msgdefeat, 1) return true end if isCreature(duel) and not hasPokemon(duel) then setPlayerStorageValue(duel, 992, -1) end if not isCreature(getCreatureTarget(cid)) then if nb == 0 then addEvent(gymChecker, 200, cid, duel, 1, npcname) else doSendMagicEffect(getThingPos(cid), 10) doRemoveCreature(cid) if isCreature(duel) then setPlayerStorageValue(duel, ginasios[npcname].storage, 0) end end return true end addEvent(gymChecker, 1000, cid, duel, 0, npcname) end function hasPokemon(cid) if #getCreatureSummons(cid) >= 1 then return true end if isInArray(funcpokemon, getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid) then return true end local bp = getPlayerSlotItem(cid, bpslot) for cc = 1, #funcpokemon do if #getItemsInContainerById(bp.uid, funcpokemon[cc]) >= 1 then return true end end return false end function doGymBattle(npcname, gympoke, cid, turn) doCreatureSay(getCreatureByName(npcname), ginasios[npcname][turn].msggo, 1) local x = doSummonCreature(gympoke, getThingPos(getCreatureByName(npcname))) registerCreatureEvent(x, "Gym1") registerCreatureEvent(x, "Gym2") registerCreatureEvent(x, "Gym3") registerCreatureEvent(x, "Gym4") setPlayerStorageValue(x, 201, ".") setPlayerStorageValue(x, 201, npcname) setPlayerStorageValue(x, 202, turn) doSendMagicEffect(getThingPos(x), 10) setPlayerStorageValue(x, ginasios[npcname].storage, 1) addEvent(gymChecker, 1000, x, cid, 0, npcname) end --ex: doGymBattle("Misty", "Misty Starmie", cid, 1) Segundo Passo:Vá em DATA/CREATURESCRIPTS/SCRIPTS e Crie Um Arquivo Chamado gym.lua (LUA) e Coloque isto Dentro: function onDeath(cid, corpse) doSendMagicEffect(getThingPos(cid), 10) local npc = ""..getPlayerStorageValue(cid, 201).."" local turn = getPlayerStorageValue(cid, 202) local nturn = ((turn) + 1) local nxt = ginasios[npc][turn].nextp doCreatureSay(getCreatureByName(npc), ginasios[npc][turn].msgba, 1) if nxt == "finish" then local killer = getItemAttribute(corpse.uid, "corpseowner") addEvent(doCreatureSay, 1200, getCreatureByName(npc), ginasios[npc].msgwin, 1) setPlayerStorageValue(getCreatureMaster(killer), ginasios[npc].storage, 2) --local item = getPlayerItemById(killer, true, 2307) --doTransformItem(item.uid, 5924,1) --doTransformItem(item.uid, 2160,100) --doTransformItem(item.uid, 2160,100) doRemoveCreature(cid) return false end local function summonNext(poke, pos, gym, msg, cid) local x = doSummonCreature(poke, pos) addEvent(gymChecker, 1000, x, cid, 0) doSendMagicEffect(getThingPos(x), 10) doCreatureSay(getCreatureByName(gym), msg, 1) end local killer = getItemAttribute(corpse.uid, "corpseowner") addEvent(doGymBattle, 1200, npc, ginasios[npc][turn].nextp, killer, nturn) doRemoveCreature(cid) return false end local fightconditionnn = createConditionObject(CONDITION_INFIGHT) setConditionParam(fightconditionnn, CONDITION_PARAM_TICKS, 18 * 1000) function onAttack(cid, target) if getPlayerStorageValue(getCreatureMaster(target), ginasios[getPlayerStorageValue(cid, 201)].storage) ~= 1 then doMonsterChangeTarget(cid) doChangeSpeed(cid, -getCreatureSpeed(cid)) return true end if isPlayer(target) then if #getCreatureSummons(target) == 0 then doMonsterChangeTarget(cid) doChangeSpeed(cid, -getCreatureSpeed(cid)) return true end if #getCreatureSummons(target) >= 1 then doMonsterSetTarget(cid, getCreatureSummons(target)[1]) end end if getCreatureSpeed(cid) == 0 then doChangeSpeed(cid, -getCreatureSpeed(cid)) doChangeSpeed(cid, 200) end doAddCondition(getCreatureMaster(target), fightconditionnn) return true end function onCast(cid, target) if isPlayer(target) then return false end local targete = getCreatureTarget(cid) if isPlayer(getCreatureMaster(targete)) and getPlayerStorageValue(getCreatureMaster(targete), ginasios[getPlayerStorageValue(cid, 201)].storage) ~= 1 then return false end return true end function onDirection(cid, old, current) if isCreature(getCreatureTarget(cid)) and not isPlayer(getCreatureTarget(cid)) and getPlayerStorageValue(getCreatureMaster(getCreatureTarget(cid)), ginasios[getPlayerStorageValue(cid, 201)].storage) == 1 then return true end return false end Terceiro passo: Vá em DATA/CREATURESCRIPTS abra o Arquivo Creaturescripts.xml (XML) E Adcione Essas 4 Tags. <event type="cast" name="Gym1" event="script" value="gym.lua"/> <event type="attack" name="Gym2" event="script" value="gym.lua"/> <event type="direction" name="Gym3" event="script" value="gym.lua"/> <event type="death" name="Gym4" event="script" value="gym.lua"/> Quarto passo: Vá em DATA/NPC/SCRIPTS e Crie um Arquivo Chamado Misty.lua (LUA) e Coloque isto Dentro. local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false local talkState = {} 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, msg) local msg = string.lower(msg) local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if getPlayerStorageValue(cid, ginasios["Misty"].storage) >= 1 then return true end if (msgcontains(msg, 'hi') and (focus == 0) and (focus ~= cid) and (getDistanceToCreature(cid) <= 4)) then focus = cid talkState[talkUser] = 1 selfSay("Welcome to the gym of Pewter City. My name is Misty and I am the leader of this gym. Would you like to battle me?") elseif (msgcontains(msg, "no") or msgcontains(msg, "bye")) and focus == cid and talkState[talkUser] ~= 3 then selfSay("Bye then, tell strong friends to come here and try to beat me!") focus = 0 elseif (msgcontains(msg, "yes") or msgcontains(msg, "battle")) and focus == cid and talkState[talkUser] == 1 then if not hasPokemon(cid) then selfSay("You don't have any pokemon to battle me!") focus = 0 return true end talkState[talkUser] = 3 doGymBattle("Misty", "Misty Starmie", cid, 1) setPlayerStorageValue(cid, ginasios["Misty"].storage, 1) setPlayerStorageValue(cid, 992, 0) local function focusCheck(cid) if not isCreature(cid) then focus = 0 return true end if getPlayerStorageValue(cid, 992) == -1 then focus = 0 return true end addEvent(focusCheck, 500, cid) end addEvent(focusCheck, 1000, cid) 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 Quinto Passo: Vá em DATA/NPC/ e Crie um Arquivo Chamado Misty.xml (XML) e Coloque isto Dentro. <?xml version="1.0" encoding="UTF-8"?> <npc name="Misty" script="misty.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look type="176" head="0" body="0" legs="0" feet="0" addons="0"/> </npc> Abrindo o arquivo gymlib.lua, localizado em DATA/LIB/ você encontra essa tabela: ginasios = { ["Misty"] = { storage = 992, msgdefeat = "You lost! You aren't strong enough yet, don't come back until you get stronger!", msgafk = "Go away if you don't have any pokemons!", msgwin = "Congratulations, you were strong enough to win this battle fairly! Take this Water Badge as reward.", [1] = { msggo = "Lets fight then! I choose you, Starmie!", msgba = "That's enough, Starmie!", pokem = "Misty Starmie", nextp = "Misty Poliwrath"}, [2] = { msggo = "It's your turn, Poliwrath!", msgba = "Come back, Poliwrath!", pokem = "Misty Poliwrath", nextp = "Misty Gyarados"}, [3] = { msggo = "Crush'em, Gyarados!", msgba = "You did well, Gyarados!", pokem = "Misty Gyarados", nextp = "Misty Blastoise"}, [4] = { msggo = "Crush'em, Blastoise!", msgba = "You did well, Blastoise!", pokem = "Misty Blastoise", nextp = "finish"} } } Ali São Aonde Tem os Pokes o Finish Representa Acabou ou Terminou Que dizer Que não Haverá Mas Pokemons Depois de Blastoise. Para Acrescentar Mas Pokemons Tire o Finish e Coloque o Nome do Pokemon Que você quiser e Coloque Mas isto: [5] = { msggo = "Crush'em, Pokemon Que Você Quiser.!", msgba = "You did well, Pokemon Que Você Quiser!", pokem = "Misty Pokemon Que Você Quiser", nextp = "finish"} Ali em Preto é o Pokemon Que Você Quiser. Mas Sempre que Você Não Quiser Mas Pokemons Depois Do Ultimo Coloque Finish no Final Depois de Nextp -. Para o NPC Funcionar Você Terá que Criar os Pokes Com o Nome Misty Antes. Por Exemplo: Misty Blastoise. Ai Você Cria Todos os Pokemon Com o Nome (Misty Antes) e Adciona As Tags dos Pokemon no Monster.xml (XML) Para Ver se o NPC Funcionou Você Fala no Seu Serve /n Misty. Bom é isso Ai. Valeu Galera espero Ter Ajudado Todos do XTibia. Créditos: Bom 99% Fui eu Que fiz Mas Não Sei Exatamente Quem Fez o 1%. Mas Não Foi Aqui do Forum Mas Quando Achar eu Botarei Aqui. Editado Junho 10, 2011 por GMRaphael Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/ Compartilhar em outros sites More sharing options...
batatasmile 8 Postado Junho 9, 2011 Share Postado Junho 9, 2011 e quem já tem o brock, como vai colocar? Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/#findComment-1043752 Compartilhar em outros sites More sharing options...
GMRaphael 34 Postado Junho 9, 2011 Autor Share Postado Junho 9, 2011 (editado) Só Modificar as Storages e Os Nomes de Exemplo e Os Nomes dos Pokes. e Criar os Pokes com o Nome Do GYM Antes. Editado Junho 9, 2011 por GMRaphael Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/#findComment-1043754 Compartilhar em outros sites More sharing options...
gustavico 0 Postado Junho 9, 2011 Share Postado Junho 9, 2011 Kra n entendi a parte la q tenque coloca nome misty antes me ajuda ae tipow qnd eu falo hi, battle ela fala go starmie mais ela n mostra starmie ajuda aew Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/#findComment-1043780 Compartilhar em outros sites More sharing options...
GMRaphael 34 Postado Junho 9, 2011 Autor Share Postado Junho 9, 2011 (editado) Cara Você Tem que Criar o Pokemon Com o Nome Misty Starmie e Os Outros Também Misty Blastoise, Misty Gyarados etc. e Adcionar esses Pokes no Monsters.xml (XML) Como se Fosse Criar Um Poke Normal Só que com o Nome Misty Antes Facil. Entendeu? Editado Junho 9, 2011 por GMRaphael Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/#findComment-1043815 Compartilhar em outros sites More sharing options...
gustavico 0 Postado Junho 9, 2011 Share Postado Junho 9, 2011 Ai so coloca tipo eu fiz la misty blastoise ai tipo coloca la os negocio do blastoise? Tipow como add no monster.xlm so novo malz ae! Da um exemplo ai de como eu coloco la Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/#findComment-1043849 Compartilhar em outros sites More sharing options...
GMRaphael 34 Postado Junho 9, 2011 Autor Share Postado Junho 9, 2011 (editado) Pegue Os Pokes Como Starmie Poliwhart Gayarados e Blatoise Que ja Tem no Seu Serve (Copie) Coloque o Nome Misty Antes e Adcione do Monster.XML (XML) Um Exemplo Do Pokemon Blastoise Feito Com o Nome Misty Antes. <?xml version="1.0" encoding="UTF-8"?><monster name="Misty Blastoise" nameDescription="a Misty Blastoise" race="undead" experience="1600" speed="240" manacost="0"> <health now="10000" max="10000"/> <look type="55" head="0" body="0" legs="0" feet="0" corpse="5999"/> <targetchange interval="1000" chance="1000"/> <strategy attack="100" defense="0"/> <flags> <flag summonable="1"/> <flag attackable="1"/> <flag hostile="1"/> <flag illusionable="1"/> <flag convinceable="1"/> <flag pushable="0"/> <flag canpushitems="1"/> <flag canpushcreatures="1"/> <flag targetdistance="1"/> <flag staticattack="80"/> <flag runonhealth="0"/> </flags> <attacks> <attack name="headbutt" interval="1000" chance="50" min="-850" max="-950"> </attack> <attack name="bubble" interval="1000" chance="50" min="-600" max="-700"> </attack> <attack name="waterball" interval="4500" chance="50" min="-750" max="-800"> </attack> <attack name="water gun" interval="4500" chance="50" min="-900" max="-1000"> </attack> <attack name="bubblebeam" interval="5000" chance="50" min="-1500" max="-2000"> </attack> <attack name="hydro cannon" interval="5000" chance="50" min="-1450" max="-1500"> </attack> <attack name="aqua tail" interval="3500" chance="90" min="-2000" max="-2760"> </attack> <attack name="hydro pump" interval="7000" chance="90" min="-2500" max="-3000"> </attack> </attacks> <defenses armor="1" defense="1"> <defense name="Intense Healing" interval="5000" chance="100" min="150" max="199"> </defense> </defenses> <voices interval="2000" chance="10"> <voice sentence="MISTY BLASTOISE!"/> <voice sentence="TOISE!"/> </voices> <loot> <item id="7159" countmax="15" chance="15000"/><!-- Sell Item --> <item id="6569" countmax="2" chance="10000"/><!-- Sell Item --> <item id="6126" countmax="1" chance="1500"/><!-- Sell Item --> <item id="5810" chance="300"/><!-- Stone --> </loot> </monster> Onde Estão Em Preto é o Nome Deles e No Monsters.xml (XML) Adcione Isto e Mais Os Outros Pokes é Claro. <monster name="misty starmie" file="pokes/misty starmie.xml"/> <monster name="misty poliwrath" file="pokes/misty poliwrath.xml"/> <monster name="misty gyarados" file="pokes/misty gyarados.xml"/> <monster name="misty blastoise" file="pokes/misty blastoise.xml"/> A Tag Ja Ta Com os Pokemons Feitos é Só Adcionar no Monsters.XML (XML) e Os Pokes Você Faz Como o Exemplo Lá em Cima. Espero Ter Ajudado Mais Uma Vez. Editado Junho 10, 2011 por GMRaphael Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/#findComment-1043874 Compartilhar em outros sites More sharing options...
gustavico 0 Postado Junho 10, 2011 Share Postado Junho 10, 2011 Tipo ja entendi mais tipow eu tenho um ot ake ke o acc manager ta bugado ele fala isso qnd termina de cria o char: Account Manager: Your character couldn't be created, please try again. Ja dei rep+ Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/#findComment-1043884 Compartilhar em outros sites More sharing options...
GMRaphael 34 Postado Junho 10, 2011 Autor Share Postado Junho 10, 2011 Ai Isso Ja Não é Mas Comigo. xD Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/#findComment-1043885 Compartilhar em outros sites More sharing options...
nyuchiha 108 Postado Junho 10, 2011 Share Postado Junho 10, 2011 Soh por curiosidade esse Script não do Brun123? Pelo oque eu vi vc apenas colocou outros Pokes e mudou o nome do Npc. Coloca os Creditos Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/#findComment-1043902 Compartilhar em outros sites More sharing options...
GMRaphael 34 Postado Junho 10, 2011 Autor Share Postado Junho 10, 2011 (editado) Eu Achei Em Outro Forum Nem Foi Aqui. Mas Pode Ser Que Tenha Se Expalhado Sei lá. Por isso Não Vou dar Créditos Não Sei Exatamente Quem Fez. Editado Junho 10, 2011 por GMRaphael Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/#findComment-1043904 Compartilhar em outros sites More sharing options...
gustavico 0 Postado Junho 10, 2011 Share Postado Junho 10, 2011 si eu for querer criar mais gym como eu mudo o outfit? Alguem tem o outfit dos outros? Como edito o outfit deles? Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/#findComment-1043913 Compartilhar em outros sites More sharing options...
Terun 1 Postado Junho 10, 2011 Share Postado Junho 10, 2011 (editado) po velho parabens!!! rep + certeza. não precisa adicionar nenhum script dentor do xml do pokemon? ex: <script> alguma coisa </script> Editado Junho 10, 2011 por TeruN Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/#findComment-1043921 Compartilhar em outros sites More sharing options...
GMRaphael 34 Postado Junho 10, 2011 Autor Share Postado Junho 10, 2011 (editado) @Terun: Não Precisa Não Funciona Corretamente. @Gustavico: Só Mudar o Looktype do NPC em DATA/NPC/ Você Abre o Aquivo e Muda o Looktype Corretamente. Bom os Looktypes Eu só sei o Da Misty Mesmo Editado Junho 10, 2011 por GMRaphael Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/#findComment-1043929 Compartilhar em outros sites More sharing options...
SkyDangerous 395 Postado Junho 10, 2011 Share Postado Junho 10, 2011 Muito bom , para quem gosta de um server de pokemon isso vai ajudar bastante ! Obrigado por trazer conteudo ao Xtibia. Peço que se não foi você que fez , coloque os créditos das pessoas. Abraço ! Link para o comentário https://xtibia.com/forum/topic/158238-npc-gym-misty/#findComment-1043939 Compartilhar em outros sites More sharing options...
Posts Recomendados