Postado Agosto 25, 2016 8 anos Este é um post popular. Yo boyz, cá estou novamente. Eu estava procurando um Addon System funcional e vi que todos tinham bugs, então eu peguei um aqui no fórum mesmo, corrigi os bugs e fiz para que o sistema funcione com fly, ride, surf, look e que o addon suma quando o pokémon evoluir. Também é possível substituir um addon por outro, sem que o pokémon fique com o addon antigo. São muitos arquivos envolvidos, então, se eu esquecer algo e o sistema não esteja 100%, por favor, me fale. Deixei alguns exemplos no código para caso você esteja com preguiça e queira testar, além de comentar como adicionar novos addons. OBS: Eu testei apenas em PDA PokexCyan (TFS 1.0). actions/scripts nome_arquivo.lua local addons = { [14876] = {pokemon = "Shiny Charizard" , looktype = 1950}, [12344] = {pokemon = "Pidgeot" , looktype = 205}, [13990] = {pokemon = "Pidgeot" , looktype = 201}, --[ID do item] = {nome do pokémon, looktype}, } local function getOldAddon (looktype) for index, value in pairs (addons) do if value.looktype == looktype then return index end end end function onUse(cid, item, fromPosition, itemEx, toPosition) local numero = addons[item.itemid].looktype local pb = itemEx.uid local pk = addons[item.itemid].pokemon if not isPokeball(itemEx.itemid) then doPlayerSendCancel(cid, "Você só poder usar este item em uma poke ball.") return true end if getPlayerSlotItem (cid, 8).uid == pb and (getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 63215) >= 1) then doPlayerSendCancel (cid, "Desmonte do seu pokémon e volte-o para a poke ball.") return true end if getItemAttribute(pb, "addon") and getItemAttribute(pb, "addon") == numero then doPlayerSendCancel(cid, "Seu pokémon já está com este addon.") return true end if #getCreatureSummons(cid) > 0 then doPlayerSendCancel(cid, "Por favor, volte o seu pokémon para a poke ball.") return true end if getItemAttribute(pb, "poke") ~= pk then doPlayerSendCancel(cid, "Desculpe, você não pode adicionar este addon neste pokémon.") return true end if getItemAttribute (pb, "addon") and getItemAttribute (pb, "addon") > 1 then doPlayerSendTextMessage(cid, 27, "Você substituiu um "..getItemNameById (getOldAddon (getItemAttribute (pb, "addon"))).." por um "..getItemNameById (item.itemid).."!") else doPlayerSendTextMessage(cid, 27, "Agora seu pokémon usará este "..getItemNameById (item.itemid).."!") end doRemoveItem(item.uid, 1) doSetItemAttribute(pb, "addon", numero) return true end actions.xml: <action itemid="13989;12344;13990;ID do item; ID do item;" event="script" value="nome_arquivo.lua"/> em actions/order.lua, abaixo de: if not isCreature(pk) then pk = doCreateMonster(pokemon, backupPos) if not isCreature(pk) then doPlayerSendCancel(cid, "You can't stop flying/riding here.") return true end doConvinceCreature(cid, pk) end adicione: local pb = getPlayerSlotItem(cid, 8).uid local flyAdd = flysAddon[getItemAttribute (pb, "addon")] local rideAdd = ridesAddon[getItemAttribute (pb, "addon")] if flyAdd then if getItemAttribute(pb, "addon") > 1 then doSetCreatureOutfit(pk, {lookType = getItemAttribute (pb, "addon")}, -1) end elseif rideAdd then if getItemAttribute(pb, "addon") > 1 then doSetCreatureOutfit(pk, {lookType = getItemAttribute (pb, "addon")}, -1) end end em lib/configuration.lua, será necessário adicionar três tabelas, uma para fly, outra para ride e outra para surf. Nesta tabela, o nome do pokémon não é requirido, o que talvez faça você se perder. Se você achar necessário, comente com "--" o nome do pokémon. Exemplo: [205] = {540, 1200}, -- Pidgeot [850] = {210, 800}, -- Dragonair procure por: flys e acima disso adicione: flysAddon = { [205] = {540, 1200}, [201] = {541, 1200}, --[número do looktype normal] = {looktype voando, número da tabela abaixo.} } procure por: rides e acima disso adicione: ridesAddon = { [556] = {555, 30}, --[número do looktype] = {looktype montado, número da tabela abaixo.} } procure por: rides e acima disso adicione: surfsAddon = { [201] = {541, 10}, [552] = {553, 10}, --[número do looktype] = {looktype nadando, speed da tabela abaixo.} } em lib/order.lua, procure por: elseif skill == "fly" then e abaixo adicione: local pb = getPlayerSlotItem(cid, 8).uid if getItemAttribute(pb, "addon") < 1 then doSetCreatureOutfit(cid, {lookType = flys[getPokemonName(getCreatureSummons(cid)[1])][1] + 351}, -1) else doSetCreatureOutfit(cid, {lookType = flysAddon[getItemAttribute (pb, "addon")][1]}, -1) end depois, no mesmo arquivo, procure por: elseif skill == "ride" then e abaixo adicione: local pb = getPlayerSlotItem(cid, 8).uid if getItemAttribute(pb, "addon") < 1 then doSetCreatureOutfit(cid, {lookType = rides[getPokemonName(getCreatureSummons(cid)[1])][1] + 351}, -1) else doSetCreatureOutfit(cid, {lookType = ridesAddon[getItemAttribute (pb, "addon")][1]}, -1) end em movements/surf.lua, procure por: if getPlayerStorageValue(cid, 6598754) == 1 or getPlayerStorageValue(cid, 6598755) == 1 then doPlayerSendCancel(cid, "You can't do it while in the PVP Zone!") --alterado v1.7 doTeleportThing(cid, fromPosition, false) return true end e abaixo adicione: local pb = getPlayerSlotItem(cid, 8).uid if getItemAttribute(pb, "addon") < 1 then doSetCreatureOutfit(cid, {lookType = surfs[getPokemonName(getCreatureSummons(cid)[1])].lookType}, -1) else doSetCreatureOutfit(cid, {lookType = surfsAddon[getItemAttribute(pb, "addon")][1]}, -1) end logo abaixo disso, vocês vão encontrar: (isso não envolve o funcionamento do sistema de addon, mas é um bug que eu achei no meu surf. Todos os pokémon tinham velocidade fixa de 1500.) local speed = 75 + PlayerSpeed + getSpeed(getCreatureSummons(cid)[1]) * 8 * speedRate substitua por: local speed = 75 + PlayerSpeed + surfs[getPokemonName(getCreatureSummons(cid)[1])].speed * 8 * speedRate no mesmo arquivo, procure por: if getItemAttribute(item.uid, "nick") then doCreatureSay(cid, getItemAttribute(item.uid, "nick")..", I'm tired of surfing!", 1) else doCreatureSay(cid, getItemAttribute(item.uid, "poke")..", I'm tired of surfing!", 1) end doSummonMonster(cid, pokemon) local pk = getCreatureSummons(cid)[1] e abaixo adicione: local pb = getPlayerSlotItem(cid, 8).uid if surfsAddon[getItemAttribute(pb, "addon")] then if getItemAttribute(pb, "addon") > 1 then doSetCreatureOutfit(pk, {lookType = getItemAttribute(pb, "addon")}, -1) end end em actions/goback.lua, procure por: doSendMagicEffect(getCreaturePosition(pk), effect) abaixo adicione: local pk = getCreatureSummons(cid)[1] local pb = getPlayerSlotItem(cid, 8).uid local look = getItemAttribute(pb, "addon") if not look then doSetItemAttribute(pb, "addon", 0) end if look and look > 0 then doSetCreatureOutfit(pk, {lookType = look}, -1) end em actions/evolution.lua, procure por: local ball = getPlayerSlotItem(cid, 8).uid há 12 linhas iguais a essa nesse arquivo e embaixo de TODAS elas, adicione: doItemSetAttribute (ball, "addon", 0) em creaturescripts/look.lua, procure por: if getItemAttribute(thing.uid, "gender") == SEX_MALE then table.insert(str, "It is male.") elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then table.insert(str, "It is female.") else table.insert(str, "It is genderless.") end se novamente, esse código aparece duas vezes no arquivo. E também, novamente, embaixo dos dois, adicione: if getItemAttribute(thing.uid, "addon") then if flysAddon[getItemAttribute (thing.uid, "addon")] or ridesAddon[getItemAttribute (thing.uid, "addon")] or surfsAddon[getItemAttribute (thing.uid, "addon")] then if getItemAttribute(thing.uid, "addon") > 1 then table.insert(str, " Has the addon "..getItemNameById (getAddonId (getItemAttribute (thing.uid, "addon")))..".") end end end E no começo desse arquivo, adicione: local addons = { [14876] = {pokemon = "Shiny Charizard" , looktype = 1950}, [12344] = {pokemon = "Pidgeot" , looktype = 205}, [13990] = {pokemon = "Pidgeot" , looktype = 201}, --[ID do item] = {nome do pokémon, looktype}, } local function getAddonId (looktype) for index, value in pairs (addons) do if value.looktype == looktype then return index end end end a tabela "addons" deve ser a mesma que a do actions/addon.lua. Então, quando você adicionar algo no addon.lua, deverá adicionar também no look.lua. em login.lua, procure por: doSetCreatureOutfit(cid, {lookType = flys[poke][1] + 351}, -1) e substitua por: if getItemAttribute(item.uid, "addon") < 1 then doSetCreatureOutfit(cid, {lookType = flys[poke][1] + 351}, -1) else doSetCreatureOutfit(cid, {lookType = flysAddon[getItemAttribute (item.uid, "addon")][1]}, -1) end procure por: doSetCreatureOutfit(cid, {lookType = surfs[poke].lookType + 351}, -1 substitua por: if getItemAttribute(item.uid, "addon") < 1 then doSetCreatureOutfit(cid, {lookType = surfs[poke].looktype + 351}, -1) else doSetCreatureOutfit(cid, {lookType = surfsAddon[getItemAttribute (item.uid, "addon")][1]}, -1) end procure por: doSetCreatureOutfit(cid, {lookType = rides[poke][1] + 351}, -1) substitua por: if getItemAttribute(item.uid, "addon") < 1 then doSetCreatureOutfit(cid, {lookType = rides[poke][1] + 351}, -1) else doSetCreatureOutfit(cid, {lookType = ridesAddon[getItemAttribute (item.uid, "addon")][1]}, -1) end Editado Agosto 26, 2016 8 anos por Talesigorvr (veja o histórico de edições)
Postado Agosto 30, 2016 8 anos Parabéns, seu tópico de conteúdo foi aprovado! Muito obrigado pela sua contribuição, nós do Tibia King agradecemos. Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP. Spoiler Congratulations, your content has been approved! Thank you for your contribution, we of Tibia King we are grateful. Your content will help many other users, you received +1 REP.
Postado Setembro 10, 2016 8 anos Só funciona á addon sem eu dar fly/ride/surf ~~ o look também não funciona, só funciona em pokemon que tem montaria ._.
Postado Setembro 13, 2016 8 anos Em 10/09/2016 ás 09:05, SkyFrozer disse: Só funciona á addon sem eu dar fly/ride/surf ~~ o look também não funciona, só funciona em pokemon que tem montaria ._. aq funfo 100% man eu so alteri alguns scripts e fico 100%
Postado Setembro 29, 2016 8 anos Em 13/09/2016 ás 16:17, ADM jeanasgotine disse: aq funfo 100% man eu so alteri alguns scripts e fico 100% man se puder verificar o systema aee pois deve estar faltando algo o meu deu a mesma coisa o addon funcionou mas com fly, surf e ride não esta funcionando e tambem o look n funciona alias funciona sim mas apenas se eu deslogar exemplo se eu uso o fly vai ficar com a outfit normal mas se eu deslogar de fly quando eu voltar vou estar de fly com addon deve ter mais alguma coisa em algum arquivo que voce n se lembra acredito que esteja faltando algo em action/order mais especifico na parte abaixo disso START FLY or RIDE or LEVITATE porque voce passou a parte do END FLY mas n Start falta algo no start fly algo que force a outfit mudar quando voce usa o fly voce disponibilizou o script de quando sai do fly mas n de quando entra nele Editado Setembro 29, 2016 8 anos por wevertonvrb (veja o histórico de edições)
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.