DevilMoon 125 Postado Agosto 22, 2010 Share Postado Agosto 22, 2010 Ola Xtibianos, Vejo Muintas Pessoas Com Problemas em Seus Pets como Eu!! Entao decidi Achar um Para minha TFS 0.3.4 e Achei um Perfeitinho e Quis Compartilhar a Galera Xtibiana!! Comandos: !pet summon !pet buy Cat !pet release !pet move !pet say Começando: Vá em Data>Talkactions.xml Adicione Isso: <talkaction words="!pet" script="pet.lua"/> Agora em Data>Talkactions>Scripts crie uma pasta.lua chamada pet e coloque isso: local PET = -- CONFIG -- { -- storages name = 7700, petuid = 7701, online = 7702, damage = 7703, allowed = { -- allowed pets, costs & level required ["cat"] = {cost = 50, level = 1}, ["dog"] = {cost = 50, level = 1}, ["deer"] = {cost = 50, level = 1}, ["pig"] = {cost = 50, level = 1}, ["parrot"] = {cost = 50, level = 1}, ["seagull"] = {cost = 50, level = 1}, ["chicken"] = {cost = 50, level = 1}, ["rabbit"] = {cost = 50, level = 1}, ["squirrel"] = {cost = 50, level = 1}, ["frog"] = {cost = 50, level = 1}, ["rat"] = {cost = 50, level = 1}, ["sheep"] = {cost = 100, level = 1}, ["wolf"] = {cost = 300, level = 8}, ["skeleton"] = {cost = 300, level = 15}, ["war wolf"] = {cost = 1000, level = 20}, ["demon skeleton"] = {cost = 3000, level = 25} }, direction = {["up"] = NORTH, ["down"] = SOUTH, ["right"] = EAST, ["left"] = WEST}, -- used with !pet move help = { -- used with !pet say "Type '!pet summon' to summon your pet.", "Type '!pet buy [petname]' to buy a pet. e.g. '!pet buy war_wolf'", "Type '!pet move [direction]' to ask your pet to move.", "Type '!pet say \"text' to ask your pet to say something.", "Type '!pet release' to release your pet." } } function petHelp(p) doPlayerSendTextMessage(p.cid, 19, PET.help[p.i]) end function onSay(cid, words, param) local p = {""} if param ~= "" then p = string.explode(param, " ") end local petuid = getPlayerStorageValue(cid, PET.petuid) local online = getPlayerStorageValue(cid, PET.online) if p[1] == "help" then for i = 1, #PET.help do addEvent(petHelp, 1000*i - 1000, {i = i, cid = cid}) end elseif p[1] == "summon" then local name = getPlayerStorageString(cid, PET.name) if isCreature(petuid) == FALSE then if online == 1 then local tile = getClosestFreeTile(cid, getThingPos(cid), FALSE, FALSE) if getTilePzInfo(getThingPos(cid)) ~= 1 and getTilePzInfo(tile) ~= 1 then if name ~= "" then if getMonsterInfo(name) ~= nil then petuid = doSummonCreature(name, tile) doConvinceCreature(cid, petuid) doCreatureSay(petuid, 'hey, sup', TALKTYPE_ORANGE_1) doChangeSpeed(petuid, getCreatureBaseSpeed(cid) - getCreatureBaseSpeed(petuid)) setPlayerStorageValue(cid, PET.online, 2) setPlayerStorageValue(cid, PET.petuid, petuid) doPlayerSendCancel(cid, 'Summoning '..name..'.') if getPlayerStorageValue(cid, PET.damage) > 0 then if getPlayerStorageValue(cid, PET.damage) < getCreatureMaxHealth(petuid) then doCreatureAddHealth(petuid, getPlayerStorageValue(cid, PET.damage)*-1) end end else doPlayerSendCancel(cid, 'Invalid pet name.') end else doPlayerSendCancel(cid, 'Invalid pet name.') end else doPlayerSendCancel(cid, 'You may not summon your pet here.') end else doPlayerSendCancel(cid, 'You do not have a pet. Type !pet <pet name> to get one.') end else setPlayerStorageValue(cid, PET.damage, getCreatureMaxHealth(petuid) - getCreatureHealth(petuid)) doCreatureSay(petuid, 'gtg, cya', TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(petuid),CONST_ME_POFF) doRemoveCreature(petuid) doPlayerSendCancel(cid, 'Retrieving '..name..'.') setPlayerStorageValue(cid, 7702, 1) end elseif p[1] == "buy" then local text if p[2] ~= nil then name = string.gsub(p[2], "_", " ") if (isCreature(petuid) ~= TRUE and online == 2) or online <= 0 then if PET.allowed[name] ~= nil then if getPlayerLevel(cid) >= PET.allowed[name].level then if getPlayerMoney(cid) >= PET.allowed[name].cost then doPlayerRemoveMoney(cid, PET.allowed[name].cost) setPlayerStorageValue(cid, PET.online, 1) setPlayerStorageValue(cid, PET.damage, 0) setPlayerStorageString(cid, PET.name, name) text = "You have bought a pet \""..name.."\" for "..PET.allowed[name].cost.." gold coins." else text = "You do not have enough money. It costs "..PET.allowed[name].cost.." gold coins to buy a "..name.."." end else text = "You need level "..PET.allowed[name].level.." to buy this pet." end else text = "You may not buy that pet." end else text = "You already have a pet." end else text = "!pet buy [petname]" end if text ~= nil then doPlayerSendTextMessage(cid, 19, text) end elseif p[1] == "move" then if isCreature(petuid) == TRUE then if p[2] ~= nil then if PET.direction[p[2]] ~= nil then if doTileQueryAdd(petuid, getPosByDir(getThingPos(petuid), PET.direction[p[2]], 1)) == 1 then doMoveCreature(petuid, PET.direction[p[2]]) else doPlayerSendCancel(cid, 'Tile is blocked.') end else doPlayerSendCancel(cid, '!pet move [up/down/left/right]') end else doPlayerSendCancel(cid, '!pet move [up/down/left/right]') end else doPlayerSendCancel(cid, 'Summon a pet first.') end elseif p[1] == "say" then text = string.explode(param, "\"") if isCreature(petuid) == TRUE then if text[2] ~= nil then if string.len(text[2]) < 39 then doCreatureSay(petuid, text[2], TALKTYPE_ORANGE_1) else doPlayerSendCancel(cid, 'Too long text.') end else doPlayerSendCancel(cid, '!pet say "I am '..getCreatureName(cid)..'\'s pet.') end else doPlayerSendCancel(cid, 'Summon a pet first.') end elseif p[1] == "release" then if isCreature(petuid) == TRUE and getPlayerStorageValue(cid, PET.online) == 2 then doCreatureSay(petuid, ':\'(', TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(petuid),CONST_ME_POFF) doRemoveCreature(petuid) doPlayerSendCancel(cid, 'Releasing '..name..'.') setPlayerStorageValue(cid, 7702, 1) end setPlayerStorageValue(cid, PET.online, 2) setPlayerStorageValue(cid, PET.damage, 0) doPlayerSendTextMessage(cid, 19, "You have released your pet \""..name.."\".") setPlayerStorageString(cid, PET.name, "") else doPlayerSendTextMessage(cid, 19, "!pet [help/summon/buy/move/say/release]") end return TRUE end Ok Acabamos com as Talkactions agora vá em Data>CreatureEvents.xml e Adicione Isso: Obs: ( Caso Ja Ouver a Pasta Logout.lua Delete Tudu dela e Coloque a Nova ) <event type="logout" name="logout" event="script" value="logout.lua"/> Agora vá em Data>CreatureEvents>Scripts crie uma pasta.lua chamada logout e coloque isso: local petuidstor = 7701 -- storages, have to be same as your other script. local onlinestor = 7702 local damagestor = 7703 function onLogout(cid) if isCreature(getPlayerStorageValue(cid, petuidstor)) == 1 then if getPlayerStorageValue(cid, onlinestor) == 2 then local petuid = getPlayerStorageValue(cid, petuidstor) setPlayerStorageValue(cid, damagestor, getCreatureMaxHealth(petuid) - getCreatureHealth(petuid)) doSendMagicEffect(getThingPos(petuid),CONST_ME_POFF) setPlayerStorageValue(cid, onlinestor, 1) end end return TRUE end Abra a pata login.lua que se localiza em Data>CreatureEvents>Scripts abra ela e coloque isso: registerCreatureEvent(cid, "logout") Agora para Finalizar vá em Data>Lib>Function.lua e Acresente Isso: string.explode = function (str, sep) local pos, t = 1, {} if #sep == 0 or #str == 0 then return end for s, e in function() return str:find(sep, pos) end do table.insert(t, str:sub(pos, s - 1):trim()) pos = e + 1 end table.insert(t, str:sub(pos):trim()) return t end _warpzone = 2147483648 -- start storing strings here (THIS IS THE ABSOLUTE MAXIMUM VALUE FOR THIS) _maxlength = 1024 -- multiply by 3 to get the true length. setPlayerStorageInteger = setPlayerStorageValue getPlayerStorageInteger = getPlayerStorageValue function setPlayerStorageString(cid, key, value) if #value > (_maxlength-1) * 3 - 1 then -- Last word is reserved for 0 termination of the string. error("Storage string is too long") end if key > _warpzone / _maxlength then error("Storage string key is too large (" .. key .. ")") end key = _warpzone + key * _maxlength local word = 0 local wordwrap = 0 local wordcount = 0 local i = 1 while i <= #value do local byte = string.byte(string.sub(value, i, i)) word = bit.bor(word, bit.lshift(byte, wordwrap)) wordwrap = wordwrap + 8 if wordwrap == 24 then --[[ In the ideal world we would be able to store 4 characters per word, however, as the default return value for getPlayerStorageValue is -1, we can't use the last bit. ]]-- setPlayerStorageInteger(cid, key + wordcount, word) word = 0 wordwrap = 0 wordcount = wordcount + 1 end i = i + 1 end -- store the last word setPlayerStorageInteger(cid, key + wordcount, word) end function getPlayerStorageString(cid, key) if key > _warpzone / _maxlength then error("Storage string key is too large (" .. key .. ")") end key = _warpzone + key * _maxlength local wordcount = 0 local str = "" while true do if wordcount >= _maxlength then break end local word = getPlayerStorageInteger(cid, key + wordcount) if word == -1 then -- end of string break else -- Extract the 3 characters from the value byte = bit.band(word, 255) if byte == 0 then break else str = str .. string.char(byte) end byte = bit.rshift(bit.band(word, 65280), 8) if byte == 0 then break else str = str .. string.char(byte) end byte = bit.rshift(bit.band(word, 16711680), 16) if byte == 0 then break else str = str .. string.char(byte) end end wordcount = wordcount + 1 end return str end Obs²: Delete Todos Arquivos de Pets System Velhos para nao Causar nem um Bug!! Creditos: jordanhenry. Sugestoes, Duvidas Somente neste Topico!! Abraços.. Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/ Compartilhar em outros sites More sharing options...
morty666 0 Postado Agosto 22, 2010 Share Postado Agosto 22, 2010 não tem aquele negocio de "!petattack" ? é bem legal esse comando '-' assim é quase mesma coisa que um simples utevo res mais fico bom parabens deu certo aqui Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/#findComment-923072 Compartilhar em outros sites More sharing options...
DevilMoon 125 Postado Agosto 22, 2010 Autor Share Postado Agosto 22, 2010 o Seguinte.. Voce ataka o Monstro e o pet ataka so que ele solta as spells automaticamente!! Abraços.. Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/#findComment-923079 Compartilhar em outros sites More sharing options...
sloanbr 0 Postado Setembro 4, 2010 Share Postado Setembro 4, 2010 Ou man aki num unfo n Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/#findComment-928398 Compartilhar em outros sites More sharing options...
DevilMoon 125 Postado Setembro 4, 2010 Autor Share Postado Setembro 4, 2010 Cara q mania voces tem de fala deu erro.. POSTA O ERRO DO DISTRO .. Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/#findComment-928399 Compartilhar em outros sites More sharing options...
sloanbr 0 Postado Setembro 4, 2010 Share Postado Setembro 4, 2010 so funfa !pet escrevi ussi e aparece [help/summon/buy/move/say/release] o !pet Buy n funfa nao da erro nenhum so nao funfa tipo so o !pet que funfa o resto nao funfa ajuda aew e me add no msn teteus_guitarra@hotmail.com Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/#findComment-928401 Compartilhar em outros sites More sharing options...
Subwat 405 Postado Setembro 4, 2010 Share Postado Setembro 4, 2010 [03/09/2010 21:57:42] [Error - TalkAction Interface] [03/09/2010 21:57:42] data/talkactions/scripts/PET/pet.lua:onSay [03/09/2010 21:57:42] Description: [03/09/2010 21:57:42] data/lib/050-function.lua:853: bad argument #2 to 'insert' (number expected, got string) [03/09/2010 21:57:42] stack traceback: [03/09/2010 21:57:42] [C]: in function 'insert' [03/09/2010 21:57:42] data/lib/050-function.lua:853: in function 'explode' [03/09/2010 21:57:42] data/talkactions/scripts/PET/pet.lua:41: in function <data/talkactions/scripts/PET/pet.lua:38> testado com TFS 0.4.0 Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/#findComment-928416 Compartilhar em outros sites More sharing options...
DevilMoon 125 Postado Setembro 4, 2010 Autor Share Postado Setembro 4, 2010 cara tu ta escrevendo errado tenta.. !pet buy minotaur tudo minusculo manolo!! e Tambem ou ve se tu ta dando buy nos bixo que tu nao coloco para comprar!! @Subwat testado com TFS 0.4.0 é Feita para 0.3.4 Por isso.. Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/#findComment-928421 Compartilhar em outros sites More sharing options...
Subwat 405 Postado Setembro 4, 2010 Share Postado Setembro 4, 2010 Pow tenta dar uma atualizada nisso,tá muito antigo 0.3.4 é do tempo do ÊPA!,vai servir pra quase ninguem. Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/#findComment-928492 Compartilhar em outros sites More sharing options...
mapperneto 4 Postado Setembro 4, 2010 Share Postado Setembro 4, 2010 Testei em 8.54~8.57 e deu o seguinte erro [04/09/2010 11:12:50] [Error - TalkAction Interface] [04/09/2010 11:12:50] data/talkactions/scripts/pet.lua:onSay [04/09/2010 11:12:50] Description: [04/09/2010 11:12:50] data/lib/050-function.lua:8: bad argument #2 to 'insert' (number expected, got string) [04/09/2010 11:12:50] stack traceback: [04/09/2010 11:12:50] [C]: in function 'insert' [04/09/2010 11:12:50] data/lib/050-function.lua:8: in function 'explode' [04/09/2010 11:12:50] data/talkactions/scripts/pet.lua:41: in function <data/talkactions/scripts/pet.lua:38> Se puder me ajudar arrume ae Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/#findComment-928528 Compartilhar em outros sites More sharing options...
rokaroma 0 Postado Setembro 4, 2010 Share Postado Setembro 4, 2010 aqui deu mesmo erro [help/summon/buy/move/say/release] porque nao cria um para TFS 0.3.6 , em ?? Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/#findComment-928568 Compartilhar em outros sites More sharing options...
lais16gatinha 0 Postado Setembro 4, 2010 Share Postado Setembro 4, 2010 (editado) DevilMoon seu Script parece ser Ótimo... Tem como criar para uma outra versão? Adoro seus scripts '-' Att. Laay õ/ @EDIT Funcionou no 0.3.4 Abra a [b][color="#800080"]pata[/color][/b] login.lua que se localiza em Data>CreatureEvents>Scripts abra ela e coloque isso. Editado Setembro 4, 2010 por Laaay Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/#findComment-928754 Compartilhar em outros sites More sharing options...
DevilMoon 125 Postado Setembro 4, 2010 Autor Share Postado Setembro 4, 2010 é para os que deram erro, os que eu vi nao tem as funçoes no seu ot explode e a insert Na Verdade o Script foi Testado e foi feito para 0.3.4, Vou pedir a ajuda do vodkart para me ajudar! dps posto aki !! Abraços.. Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/#findComment-928765 Compartilhar em outros sites More sharing options...
pikiman 0 Postado Setembro 14, 2010 Share Postado Setembro 14, 2010 Não tem como façar um pet system que não precise revivelo? tipo so colocar e tirar, porque qndo ele morrer tem que voltar e reviver mo chato isso se tiver como coloca script sei la, por favor to precisando ^^ Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/#findComment-932872 Compartilhar em outros sites More sharing options...
DevilMoon 125 Postado Setembro 24, 2010 Autor Share Postado Setembro 24, 2010 cara é so tirar a storage life, so que ficaria muinto chato o player atakaria seu monstro dechava no RED LIFE, tu tiraria colocaria denovo ia voltar com Full Life... Gente para quem Quer Pet System TFS= 0.3.5 e 0.3.6 ja esta aqui no Xtibia so procurar nesta Area!! Abraços.. Link para o comentário https://xtibia.com/forum/topic/139853-pet-system-tfs-034/#findComment-937813 Compartilhar em outros sites More sharing options...
Posts Recomendados