gonorreiaswat 151 Postado Janeiro 12, 2013 Share Postado Janeiro 12, 2013 (editado) Galera, eu estava passeando pela OTLand, então achei este MOD, procurei ele pelo forum aqui e não encontrei, então decidi postar para vocês. Como o próprio nome diz, é um anel de loot, que aumenta a chance de Loot para quem está o usando. Bora lá, como é MOD, então é muito fácil, acesse sua pasta mods, geralmente situada na pasta onde fica o Launcher.exe. Crie um arquivo.xml, no exemplo iremos usar o "lootring.xml" e deixe somente o código abaixo dentro do arquivo. <?xml version="1.0" encoding="UTF-8"?> <mod name="Loot Ring" version="1.0" author="Cykotitan" contact="otland.net" enabled="yes"> <event type="kill" name="lootring" event="script"> <![CDATA[ local t = { item = 2179, slot = CONST_SLOT_RING, newRate = 5 } local rate = getConfigInfo('rateLoot') function getContentDescription(uid, comma) local ret, i, containers = '', 0, {} while i < getContainerSize(uid) do local v, s = getContainerItem(uid, i), '' local k = getItemInfo(v.itemid) if k.name ~= '' then if v.type > 1 and k.stackable and k.showCount then s = v.type .. ' ' .. getItemInfo(v.itemid).plural else local article = k.article s = (article == '' and '' or article .. ' ') .. k.name end ret = ret .. (i == 0 and not comma and '' or ', ') .. s if isContainer(v.uid) and getContainerSize(v.uid) > 0 then table.insert(containers, v.uid) end else ret = ret .. (i == 0 and not comma and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster' end i = i + 1 end for i = 1, #containers do ret = ret .. getContentDescription(containers[i], true) end return ret end local function send(cid, pos, corpseid, monster, party) local corpse = getTileItemById(pos, corpseid).uid local ret = isContainer(corpse) and getContentDescription(corpse) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing')) if party then for _, pid in ipairs(getPartyMembers(party)) do doPlayerSendChannelMessage(pid, '', 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'), TALKTYPE_CHANNEL_W, CHANNEL_PARTY) end end end local function createLoot(i, ext) local item = type(i.id) == 'table' and i.id[math.random(#i.id)] or i.id local random = math.ceil(math.random(100000) / (ext and t.newRate or rate)) local tmpItem if random < i.chance then tmpItem = doCreateItemEx(item, getItemInfo(item).stackable and random % i.count + 1 or 1) end if not tmpItem then return end if i.subType ~= -1 then doItemSetAttribute(tmpItem, 'subType', i.subType) end if i.actionId ~= -1 then doItemSetAttribute(tmpItem, 'aid', i.actionId) end if i.uniqueId ~= -1 then doItemSetAttribute(tmpItem, 'uid', i.uniqueId) end if i.text ~= '' then doItemSetAttribute(tmpItem, 'text', i.text) end return tmpItem end local function createChildLoot(parent, i, ext) if #i == 0 then return true end local size, cap = 0, getContainerCap(parent) for k = 1, #i do if size == cap then break end local tmp = createLoot(i[k], ext) if tmp then if isContainer(tmp) then if createChildLoot(tmp, i[k].child, ext) then doAddContainerItemEx(parent, tmp) size = size + 1 else doRemoveItem(tmp) end else doAddContainerItemEx(parent, tmp) size = size + 1 end end end return size > 0 end local function dropLoot(pos, v, ext) local corpse = getTileItemById(pos, v.lookCorpse).uid if isContainer(corpse) then for i = 1, getContainerSize(corpse) do doRemoveItem(getContainerItem(corpse, 0).uid) end local size, cap = 0, getContainerCap(corpse) for i = 1, #v.loot do if size == cap then break end local tmp = createLoot(v.loot[i], ext) if tmp then if isContainer(tmp) then if createChildLoot(tmp, v.loot[i].child, ext) then doAddContainerItemEx(corpse, tmp) size = size + 1 else doRemoveItem(tmp) end else doAddContainerItemEx(corpse, tmp) size = size + 1 end end end end end function onKill(cid, target, lastHit) if lastHit and isMonster(target) then local v = getMonsterInfo(getCreatureName(target)) if v.lookCorpse > 0 then local master = getCreatureMaster(target) if not master or master == target then addEvent(dropLoot, 0, getThingPos(target), v, getPlayerSlotItem(cid, t.slot).itemid == t.item) end addEvent(send, 100, cid, getThingPos(target), v.lookCorpse, v.description, getPlayerParty(cid)) end end return true end ]]></event> <event type="login" name="Loot Ring" event="buffer"><![CDATA[ registerCreatureEvent(cid, "lootring") ]]></event> </mod> Então, salve-o e feche. Agora vá no seu config.lua, procure por "monsterLootMessage" e altera seu valor para "0", ficando como o abaixo: monsterLootMessage = 0 Well done. #Caso seu OTServ não possua a pasta MOD, faça os passos do Spoiler abaixo: Agora vá no seu config.lua, procure por "monsterLootMessage" e altera seu valor para "0", ficando como o abaixo: monsterLootMessage = 0 Feche-o salvando. Agora vá na pasta creaturescripts e abra o arquivo creaturescripts.xml. Adicione a tag abaixo ao arquivo, lembre-se que tem que ser antes da tag final do arquivo (</creaturescripts>). <event type="kill" name="lootring" event="script" value="lootring.lua"/> Certo, salve e feche o arquivo. Agora abra a pasta scripts da própria pasta creaturescripts, em seguida abra o arquivo chamado login.lua e adicione a tag abaixo: registerCreatureEvent(cid, "lootring") Agora crie um arquivo dentro da pasta creaturescripts/scripts, chamado de lootring.lua e cole o código do spoiler abaixo: local t = { item = 2179, slot = CONST_SLOT_RING, newRate = 5 } local rate = getConfigInfo('rateLoot') function getContentDescription(uid, comma) local ret, i, containers = '', 0, {} while i < getContainerSize(uid) do local v, s = getContainerItem(uid, i), '' local k = getItemInfo(v.itemid) if k.name ~= '' then if v.type > 1 and k.stackable and k.showCount then s = v.type .. ' ' .. getItemInfo(v.itemid).plural else local article = k.article s = (article == '' and '' or article .. ' ') .. k.name end ret = ret .. (i == 0 and not comma and '' or ', ') .. s if isContainer(v.uid) and getContainerSize(v.uid) > 0 then table.insert(containers, v.uid) end else ret = ret .. (i == 0 and not comma and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster' end i = i + 1 end for i = 1, #containers do ret = ret .. getContentDescription(containers[i], true) end return ret end local function send(cid, pos, corpseid, monster, party) local corpse = getTileItemById(pos, corpseid).uid local ret = isContainer(corpse) and getContentDescription(corpse) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing')) if party then for _, pid in ipairs(getPartyMembers(party)) do doPlayerSendChannelMessage(pid, '', 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'), TALKTYPE_CHANNEL_W, CHANNEL_PARTY) end end end local function createLoot(i, ext) local item = type(i.id) == 'table' and i.id[math.random(#i.id)] or i.id local random = math.ceil(math.random(100000) / (ext and t.newRate or rate)) local tmpItem if random < i.chance then tmpItem = doCreateItemEx(item, getItemInfo(item).stackable and random % i.count + 1 or 1) end if not tmpItem then return end if i.subType ~= -1 then doItemSetAttribute(tmpItem, 'subType', i.subType) end if i.actionId ~= -1 then doItemSetAttribute(tmpItem, 'aid', i.actionId) end if i.uniqueId ~= -1 then doItemSetAttribute(tmpItem, 'uid', i.uniqueId) end if i.text ~= '' then doItemSetAttribute(tmpItem, 'text', i.text) end return tmpItem end local function createChildLoot(parent, i, ext) if #i == 0 then return true end local size, cap = 0, getContainerCap(parent) for k = 1, #i do if size == cap then break end local tmp = createLoot(i[k], ext) if tmp then if isContainer(tmp) then if createChildLoot(tmp, i[k].child, ext) then doAddContainerItemEx(parent, tmp) size = size + 1 else doRemoveItem(tmp) end else doAddContainerItemEx(parent, tmp) size = size + 1 end end end return size > 0 end local function dropLoot(pos, v, ext) local corpse = getTileItemById(pos, v.lookCorpse).uid if isContainer(corpse) then for i = 1, getContainerSize(corpse) do doRemoveItem(getContainerItem(corpse, 0).uid) end local size, cap = 0, getContainerCap(corpse) for i = 1, #v.loot do if size == cap then break end local tmp = createLoot(v.loot[i], ext) if tmp then if isContainer(tmp) then if createChildLoot(tmp, v.loot[i].child, ext) then doAddContainerItemEx(corpse, tmp) size = size + 1 else doRemoveItem(tmp) end else doAddContainerItemEx(corpse, tmp) size = size + 1 end end end end end function onKill(cid, target, lastHit) if lastHit and isMonster(target) then local v = getMonsterInfo(getCreatureName(target)) if v.lookCorpse > 0 then local master = getCreatureMaster(target) if not master or master == target then addEvent(dropLoot, 0, getThingPos(target), v, getPlayerSlotItem(cid, t.slot).itemid == t.item) end addEvent(send, 100, cid, getThingPos(target), v.lookCorpse, v.description, getPlayerParty(cid)) end end return true end Salve e feche-o. Está pronto seu script, e como pode ver, no início do script lootring.lua tem as opções de configuração caso queira mudar o item especial ou a porcentagem de loot. Script's testados em: TFS 0.3.6 e Alissow 0.4.1. #Obs: Eu não testei, estou postando pois achei interessante. ##Créditos¹: Cykotitan que é de outro forum e criou o script em Action. ###Créditos²: Collz que é de outro forum, editou o script e também o transformou em MOD. Editado Janeiro 13, 2013 por Adriano Swatt Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/ Compartilhar em outros sites More sharing options...
danilinho79 6 Postado Janeiro 12, 2013 Share Postado Janeiro 12, 2013 Legal, não sabia dessa + se for colocar em algum servidor, não acho que vá fazer muito sucesso, ainda mais se o anel tiver tempo Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/#findComment-1437257 Compartilhar em outros sites More sharing options...
gonorreiaswat 151 Postado Janeiro 12, 2013 Autor Share Postado Janeiro 12, 2013 Então, a função dele vai ter ou não sentido de acordo com a "história" que seu OTServ proporciona, e é claro, relacionado também com a experiencia e nível de dificuldade do server. Pode sim também, por tempo nele o que poderia torná-lo mais interessando, e é como disse acima, de acordo com a dificuldade do server, daí basta saber ligar uma coisa a outra. Enfim, obrigado por comentar. Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/#findComment-1437266 Compartilhar em outros sites More sharing options...
EliaWalak 0 Postado Janeiro 13, 2013 Share Postado Janeiro 13, 2013 Me Diga oque devo fazer quando meu Servidor não tem a pasta MOD? Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/#findComment-1437864 Compartilhar em outros sites More sharing options...
gonorreiaswat 151 Postado Janeiro 13, 2013 Autor Share Postado Janeiro 13, 2013 Me Diga oque devo fazer quando meu Servidor não tem a pasta MOD? Atualizei o tópico. Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/#findComment-1437941 Compartilhar em outros sites More sharing options...
MaryGirl13 9 Postado Maio 19, 2013 Share Postado Maio 19, 2013 Aonde altera o tempo do anel? E a corzinha do anel também.. Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/#findComment-1522292 Compartilhar em outros sites More sharing options...
gonorreiaswat 151 Postado Maio 20, 2013 Autor Share Postado Maio 20, 2013 Aonde altera o tempo do anel? E a corzinha do anel também.. Então, esta parte de por tempo, você pode por diretamente em "items.xml", pegando como base algum ring como o life ring, por exemplo. Já a cor do item, você pode pegar outro item de sua preferência, e por a ID dele no script que passei no Tutorial e por nesta parte a ID nova. local t = { item = 2179, <--- aqui slot = CONST_SLOT_RING, newRate = 5 } Qualquer dúvida, pode perguntar. Obrigado. Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/#findComment-1522918 Compartilhar em outros sites More sharing options...
MaryGirl13 9 Postado Maio 21, 2013 Share Postado Maio 21, 2013 Obrigado, esclareceu as minhas duvidas, rep+ Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/#findComment-1523226 Compartilhar em outros sites More sharing options...
gonorreiaswat 151 Postado Maio 21, 2013 Autor Share Postado Maio 21, 2013 Obrigado, esclareceu as minhas duvidas, rep+ Por nada. Obrigado pelo REP+ e por Comentar. Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/#findComment-1523300 Compartilhar em outros sites More sharing options...
DavyziinC 1 Postado Maio 28, 2013 Share Postado Maio 28, 2013 Cara não entendi nada namoral como crio items proprio pra exp loot tem como me fala isso quanto de exp bota igual exp ring? Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/#findComment-1525686 Compartilhar em outros sites More sharing options...
gonorreiaswat 151 Postado Maio 28, 2013 Autor Share Postado Maio 28, 2013 Cara não entendi nada namoral como crio items proprio pra exp loot tem como me fala isso quanto de exp bota igual exp ring? Tudo bem, e eu não entendi direito sua dúvida. No caso, quando estiver usando o Item, ele aumenta a porcentagem de chance de dropar itens dos monstros. Criar itens, você põe a ID desejada no arquivo Script do item. Ex: local t = { item = 2179, slot = CONST_SLOT_RING, newRate = 5 O verde é a ID do item que deseja, o azul é onde o item deverá estar para ativar o "novo drop" e o roxo é a nova porcentagem de chance de dropar itens. Espero que seja isso. Qualquer coisa, esclareça sua dúvida e eu estarei tentando te explicar melhor como fazer. Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/#findComment-1525708 Compartilhar em outros sites More sharing options...
DavyziinC 1 Postado Maio 29, 2013 Share Postado Maio 29, 2013 Cara ainda não to entendo queria cria um anel proprio pra essa ring Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/#findComment-1525765 Compartilhar em outros sites More sharing options...
gonorreiaswat 151 Postado Maio 29, 2013 Autor Share Postado Maio 29, 2013 Cara ainda não to entendo queria cria um anel proprio pra essa ring Você quer criar outro Ring com Sprite diferente? O desenho do item diferente? Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/#findComment-1525768 Compartilhar em outros sites More sharing options...
DavyziinC 1 Postado Maio 29, 2013 Share Postado Maio 29, 2013 Sei la cara cria ai pra miim ai tu faz o tutorial pra mim explicando como fazer anel funfa e como cria anel tem como? Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/#findComment-1525805 Compartilhar em outros sites More sharing options...
gonorreiaswat 151 Postado Maio 29, 2013 Autor Share Postado Maio 29, 2013 Sei la cara cria ai pra miim ai tu faz o tutorial pra mim explicando como fazer anel funfa e como cria anel tem como? Manolo, eu adoraria fazer um tutorial novo somente pra te ajudar, mas é que ultimamente nem tenho trabalhado com OTServ, pois estou no ramo Imobiliário, estudando Técnico. Então é meio complicado, eu só entro aqui e respondo correndo quando chega em meu e-mail. Enfim, não tem segredo. Seu OTServ tem a pasta MOD? Link para o comentário https://xtibia.com/forum/topic/204144-an%C3%A9l-de-loot-loot-ring/#findComment-1525823 Compartilhar em outros sites More sharing options...
Posts Recomendados