PsyMcKenzie 150 Postado Maio 8, 2013 Share Postado Maio 8, 2013 (editado) Sistema de Pet V1.0 E ai Galera, suave? Hoje venho trazer pra vocês, meu sistema de pet.É bem do tipo pokemon, mas tenho certeza que irão gostar. Vou liberá-lo porque gosto de compartilhar as coisas, e sei que alguém esta querendo um sistema desses. Assim como eu quis um dia e nunca encontrei um que funcionasse.O sistema está na versão 1.0, mas em em breve trarei um npc para healar o pet e algumas talks para o pet soltar spells. Vamos lá! Primeiramente, vá em data/action/scripts, crie um arquivo com o nome de CatchPet.lua e adicione: local mtrs = { ["Rat"] = {hp = 1000, maxhp = 1000, corpse = 2813, chance = 100}, ["Rotworm"] = {hp = 1000, maxhp = 1000, corpse = 5967, chance = 100}, ["Skeleton"] = {hp = 1000, maxhp = 1000, corpse = 5972, chance = 100}, ["Dragon"] = {hp = 1000, maxhp = 1000, corpse = 3104, chance = 100}, ["Dragon Lord"] = {hp = 1000, maxhp = 1000, corpse = 5984, chance = 100}, } function onUse(cid, item, frompos, item2, topos) for pet_name, v in pairs(mtrs) do if item2.itemid == v.corpse then if math.random(0,100) <= v.chance then doPlayerSendTextMessage(cid, 27, "Você capturou um ".. pet_name .. ".") doRemoveItem(item2.uid, 1) doRemoveItem(item.uid, 1) local itemcatch = doPlayerAddItem(cid, 7632, 1) doItemSetAttribute(itemcatch, "namepet", pet_name) doItemSetAttribute(itemcatch, "description", "Contém um ".. pet_name ..".") doItemSetAttribute(itemcatch, "lifepet", v.hp) doItemSetAttribute(itemcatch, "maxlifepet", v.maxhp) else doPlayerSendTextMessage(cid, 27, "Falhou.") end end end return true end Em seguida, duplique o arquivo, renomeie para VaiVolta e adicione: function onUse(cid, item, frompos, item2, topos) local health = tonumber(getItemAttribute(item.uid, "lifepet")) local mhp = tonumber(getItemAttribute(item.uid, "maxlifepet")) if health <= 0 then return doPlayerSendCancel(cid, "Esse pet esta morto.") end local pet_name = getItemAttribute(item.uid, "namepet") if item.itemid == 7632 then if not getTilePzInfo(getPlayerPosition(cid)) then if #getCreatureSummons(cid) < 1 then doTransformItem(item.uid, 7633) local summon = doSummonCreature(pet_name, getThingPos(cid)) doConvinceCreature(cid, summon) setCreatureMaxHealth(summon, mhp) doCreatureAddHealth(summon, mhp) doCreatureAddHealth(summon, health - mhp) doSendMagicEffect(getCreaturePosition(summon), 67) doCreatureSay(cid, "Vai, ".. pet_name .. "!", TALKTYPE_SAY) else doPlayerSendCancel(cid, "Você já sumonou um Pet.") end else doPlayerSendCancel(cid, "Você não pode estar em Protection Zone para sumonar seu Pet.") end elseif item.itemid == 7633 then local hp, maxhp = getCreatureHealth(getCreatureSummons(cid)[1]), getCreatureMaxHealth(getCreatureSummons(cid)[1]) if #getCreatureSummons(cid) >= 1 then doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 67) doRemoveCreature(getCreatureSummons(cid)[1]) doTransformItem(item.uid, 7632) doItemSetAttribute(item.uid, "lifepet", hp) doItemSetAttribute(item.uid, "maxlifepet", maxhp) doCreatureSay(cid, "Volta, " .. pet_name .. ".", TALKTYPE_SAY) end end return true end Agora em Actions.xml, adicione as tags: <action itemid="2149" event="script" value="CatchPet.lua"/> <action itemid="7632;7633" event="script" value="VaiVolta.lua"/> Configurando Nesta parte você irá editar: ["Rat"] = {hp = 1000, maxhp = 1000, corpse = 2813, chance = 100}, ["Rotworm"] = {hp = 1000, maxhp = 1000, corpse = 5967, chance = 100}, ["Skeleton"] = {hp = 1000, maxhp = 1000, corpse = 5972, chance = 100}, ["Dragon"] = {hp = 1000, maxhp = 1000, corpse = 3104, chance = 100}, ["Dragon Lord"] = {hp = 1000, maxhp = 1000, corpse = 5984, chance = 100}, NOME DO PET / HP / HP MÁXIMO / CORPSE ID ( AQUELE QUE FICA QUANDO O MONSTRO MORRE) / CHANCE DE CAPTURA DO PET. Esse são os id's das "pokeballs": if item.itemid == 7632 then elseif item.itemid == 7633 then Caso queira mudar, troque no script e na tag no actions.xml. Este é o item de captura: <action itemid="2149" event="script" value="CatchPet.lua"/> Bom, é isso galera, espero que gostem e que façam um bom uso do sistema! Aproveitem! Dúvidas? Sugestões? Criticas?Comentem!! Créditos/Agradecimentos: BananaFight LuckOake MaXwElldEn Gears Editado Maio 8, 2013 por PsyMcKenzie Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/ Compartilhar em outros sites More sharing options...
liliangutierry2 0 Postado Maio 8, 2013 Share Postado Maio 8, 2013 Legal rep+ bom esse sistema Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/#findComment-1517535 Compartilhar em outros sites More sharing options...
PsyMcKenzie 150 Postado Maio 8, 2013 Autor Share Postado Maio 8, 2013 Muito obrigado! Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/#findComment-1517537 Compartilhar em outros sites More sharing options...
BananaFight 196 Postado Maio 8, 2013 Share Postado Maio 8, 2013 Agora é terminar o sistema né, com as funções na morte do summon, deslogar etc. Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/#findComment-1517538 Compartilhar em outros sites More sharing options...
PsyMcKenzie 150 Postado Maio 8, 2013 Autor Share Postado Maio 8, 2013 Pode crer mano, vou começar a trabalhar essa parte. Obrigado! Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/#findComment-1517539 Compartilhar em outros sites More sharing options...
Gears 109 Postado Maio 8, 2013 Share Postado Maio 8, 2013 (editado) local mtrs = { ["Rat"] = {hp = 1000, maxhp = 1000, corpse = 2813, chance = 100}, ["Rotworm"] = {hp = 1000, maxhp = 1000, corpse = 5967, chance = 100}, ["Skeleton"] = {hp = 1000, maxhp = 1000, corpse = 5972, chance = 100}, ["Dragon"] = {hp = 1000, maxhp = 1000, corpse = 3104, chance = 100}, ["Dragon Lord"] = {hp = 1000, maxhp = 1000, corpse = 5984, chance = 100}, } function onUse(cid, item, frompos, item2, topos) for pet_name, v in pairs(mtrs) do if item2.itemid == v.corpse then if math.random(0,100) <= v.chance then doPlayerSendTextMessage(cid, 27, "Você capturou um ".. pet_name .. ".") doRemoveItem(item2.uid, 1) doRemoveItem(item.uid, 1) local itemcatch = doPlayerAddItem(cid, 7632, 1) doItemSetAttribute(itemcatch, "namepet", pet_name) doItemSetAttribute(itemcatch, "description", "Contém um ".. pet_name ..".") doItemSetAttribute(itemcatch, "lifepet", v.hp) doItemSetAttribute(itemcatch, "maxlifepet", v.maxhp) else doPlayerSendTextMessage(cid, 27, "Falhou.") end end end return true end 2. function onUse(cid, item, frompos, item2, topos) local health = tonumber(getItemAttribute(item.uid, "lifepet")) local mhp = tonumber(getItemAttribute(item.uid, "maxlifepet")) if health <= 0 then return doPlayerSendCancel(cid, "Esse pet esta morto.") end local pet_name = getItemAttribute(item.uid, "namepet") if item.itemid == 7632 then if not getTilePzInfo(getPlayerPosition(cid)) then if #getCreatureSummons(cid) < 1 then doTransformItem(item.uid, 7633) local summon = doSummonCreature(pet_name, getThingPos(cid)) doConvinceCreature(cid, summon) setCreatureMaxHealth(summon, mhp) doCreatureAddHealth(summon, mhp) doCreatureAddHealth(summon, health - mhp) doSendMagicEffect(getCreaturePosition(summon), 67) doCreatureSay(cid, "Vai, ".. pet_name .. "!", TALKTYPE_SAY) else doPlayerSendCancel(cid, "Você já sumonou um Pet.") end else doPlayerSendCancel(cid, "Você não pode estar em Protection Zone para sumonar seu Pet.") end elseif item.itemid == 7633 then local hp, maxhp = getCreatureHealth(getCreatureSummons(cid)[1]), getCreatureMaxHealth(getCreatureSummons(cid)[1]) if #getCreatureSummons(cid) >= 1 then doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 67) doRemoveCreature(getCreatureSummons(cid)[1]) doTransformItem(item.uid, 7632) doItemSetAttribute(item.uid, "lifepet", hp) doItemSetAttribute(item.uid, "maxlifepet", maxhp) doCreatureSay(cid, "Volta, " .. pet_name .. ".", TALKTYPE_SAY) end end return true end Ps: no ultimo script da pra remover essa linha aqui: print(tonumber(getItemAttribute(item.uid, "lifepet")),tonumber(getItemAttribute(item.uid, "maxlifepet"))) Isso ai vai ficar printando a life do pet no distro, oque seria desnecessário. Editado Maio 8, 2013 por Gears Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/#findComment-1517553 Compartilhar em outros sites More sharing options...
MaXwEllDeN 89 Postado Maio 8, 2013 Share Postado Maio 8, 2013 Sistema legal cara, mas, é como o Banana falou, ainda tem umas coisas que você tem adicionar pro sistema ficar melhor e se diferenciar dos outros. Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/#findComment-1517558 Compartilhar em outros sites More sharing options...
PsyMcKenzie 150 Postado Maio 8, 2013 Autor Share Postado Maio 8, 2013 Obrigado MaXwEllDeN, vou procurar melhorar o código. Abraços! Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/#findComment-1517575 Compartilhar em outros sites More sharing options...
LucasVinia 4 Postado Maio 8, 2013 Share Postado Maio 8, 2013 Cara, muito foda.... Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/#findComment-1517577 Compartilhar em outros sites More sharing options...
PsyMcKenzie 150 Postado Maio 8, 2013 Autor Share Postado Maio 8, 2013 Obrigado brow. ^^ Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/#findComment-1517593 Compartilhar em outros sites More sharing options...
gmstrikker 0 Postado Maio 8, 2013 Share Postado Maio 8, 2013 Muito bom cara! Parabéns! Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/#findComment-1517598 Compartilhar em outros sites More sharing options...
gabyzinho1 3 Postado Maio 8, 2013 Share Postado Maio 8, 2013 Esse Sistema esta perfeito parabéns rep+ Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/#findComment-1517630 Compartilhar em outros sites More sharing options...
PsyMcKenzie 150 Postado Maio 8, 2013 Autor Share Postado Maio 8, 2013 Obrigado galera! Em breve V2.0 Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/#findComment-1517633 Compartilhar em outros sites More sharing options...
Caslu15 0 Postado Maio 8, 2013 Share Postado Maio 8, 2013 Aee Dahora xD Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/#findComment-1517750 Compartilhar em outros sites More sharing options...
PsyMcKenzie 150 Postado Maio 9, 2013 Autor Share Postado Maio 9, 2013 Valew man! =) Link para o comentário https://xtibia.com/forum/topic/213927-sistema-de-pet-v10-by-psymckenzie/#findComment-1518116 Compartilhar em outros sites More sharing options...
Posts Recomendados