Postado Julho 25, 2012 12 anos Autor: MaXwEllDeN (Maxwell Denisson) Versão testada: TFS 0.3.6, 8.54 #Introdução Vish, eu tava aqui de boa vasculhando meus scripts e achei esse sistema de Forja, é antigo e pode conter bugs, então quem encontrar por favor reporte (: #Instalação @Actions Na pasta scripts copie qualquer arquivo com a extenção lua, e renomeie ele para Smith, abra, delete tudo que houver dentro dele, copie esse conteúdo e salve: [paste]pfyxwqAY[/paste] TAG: <action itemid = "2422" event = "script" value = "Smith.lua"/> @Libs Na pasta lib copie qualquer arquivo com a extenção lua, e renomeie ele para SmithLib, abra, delete tudo que houver dentro dele, copie esse conteúdo e salve: [paste]cZZVpA6k[/paste] #Configuração [paste]Kc9Gr1PA[/paste] #Level para poder forjar Max sou seu fã kkkk, bom eu dei uma editado aqui no script agora pode por level pra poder forja, eu fiz por eu tava precisando então se alguém precisar tb aqui está: No arquivo Smith em actions cole isso: --[[ ################################################ ## Smith System ## ## Author: Maxwell Denisson(MaXwEllDeN) ## ## Version: 1.0 ## ################################################ ]] function onUse(cid, item, frompos, item2, topos) local tekz, takz, tikz, XTz = {}, {}, {}, {} for _, v in pairs(getAllItemsInPos(topos, {1642, 1643, 1644, 1645, 1617, 1618, 1620, 1621})) do table.insert(takz, v) end for _, v in pairs(takz) do if not isInArray(tikz, v.uid) then if (v.itemid ~= 2555) then table.insert(XTz, v) end table.insert(tikz, v.uid) table.insert(tekz, v.itemid) end end if not (isInArray(tekz, 2555)) then return false end local u, d = _SMITHY_.getRevenue(topos) if (u == 0) then for i, v in pairs(d) do if (math.random(100) > 49) then local tp = (v.type > 0) and v.type or 1 doRemoveItem(v.uid, tp) end end if (#d > 0) then doSendMagicEffect(topos, 3) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Failure!") end return true end local rec = _SMITHY_.receitas[u] if (math.random(10) + _SMITHY_.getLevel(cid) < rec.dif) then for i, v in pairs(d) do if (math.random(100) > 49) then local tp = (v.type > 0) and v.type or 1 doRemoveItem(v.uid, tp) end end doSendMagicEffect(topos, 3) return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Failure!") end if getPlayerLevel(cid) < rec.lvl then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "No have level!") end local xp = math.random(10) + rec.dif doSendAnimatedText(getThingPos(cid), xp, 125) _SMITHY_.addExp(cid, xp) if (_SMITHY_.getExp(cid) >= _SMITHY_.getExpToNextLevel(cid)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You advanced from level ".. _SMITHY_.getLevel(cid) .. " to level ".. _SMITHY_.getLevel(cid) + 1 .. ", in smithy skills.") _SMITHY_.addLevel(cid, 1) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Experience: ".. _SMITHY_.getExp(cid) .. "/".. _SMITHY_.getExpLevel(_SMITHY_.getLevel(cid) + 1) ..".") for _, v in pairs(d) do local tp = (v.type > 0) and v.type or 1 doRemoveItem(v.uid, tp) end doSendMagicEffect(topos, 3) doItemSetAttribute(doCreateItem(rec.ma[1], rec.ma[2], topos), "description", "Forjado por ".. getCreatureName(cid) .."") doPlayerSendTextMessage(cid, 25, "You've forged a ".. getItemNameById(rec.ma[1]) .. "!") return TRUE end agora em SmithLib, na pasta lib cole isso: --[[ ################################################ ## Smith System ## ## Author: Maxwell Denisson(MaXwEllDeN) ## ## Version: 1.0 ## ################################################ ]] _SMITHY_ = { exp_b = 40, receitas = { --dif = Dificuldade [1] = {dif = 5, -- Staff lvl = 150, re = {{5892, 2}, }, ma = {2401, 1} }, [2] = {dif = 1, -- Staff lvl = 150, re = {{5901, 5}, {5880, 1}, }, ma = {2401, 1} }, } } _SMITHY_.getRevenue = function (pos) local recs = {} local ipos = {} local posi = {} local block = {1642, 1643, 1644, 1645, 1617, 1618, 1620, 1621, 2555} local IDEx = 0 for i, v in pairs(_SMITHY_.receitas) do recs[i] = {} for _, a in pairs(v.re) do for b = 1, a[2] do table.insert(recs[i], a[1]) end end end local Zk = {} for _, v in pairs(getAllItemsInPos(pos, block)) do if not isInArray(Zk, v.uid) then table.insert(ipos, v) table.insert(Zk, v.uid) end end for _, v in pairs(ipos) do local t = (v.type > 0) and v.type or 1 for te = 1, t do table.insert(posi, v.itemid) end end for _, v in pairs(recs) do local AE = true for x, i in pairs(posi) do if (AE) then if (not isInArray(v, i)) or (#v ~= #posi) then AE = false else IDEx = _ end end end end if (#recs < 1) then return 0, ipos else return IDEx, ipos end end _SMITHY_.getExp = function (uid) if (getPlayerStorageValue(uid, 58913) < 1) then setPlayerStorageValue(uid, 58913, 0) end return getPlayerStorageValue(uid, 58913) end _SMITHY_.getLevel = function (uid) if (getPlayerStorageValue(uid, 58912) < 1) then setPlayerStorageValue(uid, 58912, 1) end return getPlayerStorageValue(uid, 58912) end _SMITHY_.addLevel = function (uid, ammount) local level = _SMITHY_.getLevel(uid) return setPlayerStorageValue(uid, 58912, level + ammount) end _SMITHY_.getExpToNextLevel = function (uid) return _SMITHY_.getExpLevel(_SMITHY_.getLevel(uid) + 1) end _SMITHY_.getExpLevel = function (level) return level * (_SMITHY_.exp_b) + (level - 1* (_SMITHY_.exp_b)) end _SMITHY_.setExp = function (uid, ammount) return setPlayerStorageValue(uid, 58913, ammount) end _SMITHY_.addExp = function (uid, ammount) local xp = _SMITHY_.getExp(uid) return _SMITHY_.setExp(uid, xp + ammount) end function getAllItemsInPos(pos, block) local results = {} for _ = 1, 255 do local findPos = {x = pos.x, y = pos.y, z = pos.z, stackpos = _} local item = getThingFromPos(findPos) if (not isInArray(block, item.itemid)) and (item.uid > 1) then table.insert(results, item) end end return results end Ai no parte: [1] = {dif = 5, -- Staff lvl = 150, re = {{5892, 2}, }, ma = {2401, 1} }, Onde tem lvl é o level que o player tem que ter pra poder forja Ahh e dei uma editada na parte que manda as msg pro player (fail, etc) pq geralmente os negoh tem preguiça de ir ver no serverlog kkkkk agora manda pro default. Foi uma simples modificação, o cabeça da questão é o Max kkkkkk Editado Outubro 18, 2012 12 anos por MaXwEllDeN (veja o histórico de edições) -"Supra Omnes Lux Lucis" - Acima de todos brilha a Luz -
Postado Julho 25, 2012 12 anos Fico bom, parabéns De boua na lagoa ? *-* Entrada ao Tibia King:27/05/2012 (02:14)
Postado Outubro 18, 2012 12 anos Max sou seu fã kkkk, bom eu dei uma editado aqui no script agora pode por level pra poder forja, eu fiz por eu tava precisando então se alguém precisar tb aqui está: No arquivo Smith em actions cole isso: --[[ ################################################ ## Smith System ## ## Author: Maxwell Denisson(MaXwEllDeN) ## ## Version: 1.0 ## ################################################ ]] function onUse(cid, item, frompos, item2, topos) local tekz, takz, tikz, XTz = {}, {}, {}, {} for _, v in pairs(getAllItemsInPos(topos, {1642, 1643, 1644, 1645, 1617, 1618, 1620, 1621})) do table.insert(takz, v) end for _, v in pairs(takz) do if not isInArray(tikz, v.uid) then if (v.itemid ~= 2555) then table.insert(XTz, v) end table.insert(tikz, v.uid) table.insert(tekz, v.itemid) end end if not (isInArray(tekz, 2555)) then return false end local u, d = _SMITHY_.getRevenue(topos) if (u == 0) then for i, v in pairs(d) do if (math.random(100) > 49) then local tp = (v.type > 0) and v.type or 1 doRemoveItem(v.uid, tp) end end if (#d > 0) then doSendMagicEffect(topos, 3) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Failure!") end return true end local rec = _SMITHY_.receitas[u] if (math.random(10) + _SMITHY_.getLevel(cid) < rec.dif) then for i, v in pairs(d) do if (math.random(100) > 49) then local tp = (v.type > 0) and v.type or 1 doRemoveItem(v.uid, tp) end end doSendMagicEffect(topos, 3) return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Failure!") end if getPlayerLevel(cid) < rec.lvl then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "No have level!") end local xp = math.random(10) + rec.dif doSendAnimatedText(getThingPos(cid), xp, 125) _SMITHY_.addExp(cid, xp) if (_SMITHY_.getExp(cid) >= _SMITHY_.getExpToNextLevel(cid)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You advanced from level ".. _SMITHY_.getLevel(cid) .. " to level ".. _SMITHY_.getLevel(cid) + 1 .. ", in smithy skills.") _SMITHY_.addLevel(cid, 1) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Experience: ".. _SMITHY_.getExp(cid) .. "/".. _SMITHY_.getExpLevel(_SMITHY_.getLevel(cid) + 1) ..".") for _, v in pairs(d) do local tp = (v.type > 0) and v.type or 1 doRemoveItem(v.uid, tp) end doSendMagicEffect(topos, 3) doItemSetAttribute(doCreateItem(rec.ma[1], rec.ma[2], topos), "description", "Forjado por ".. getCreatureName(cid) .."") doPlayerSendTextMessage(cid, 25, "You've forged a ".. getItemNameById(rec.ma[1]) .. "!") return TRUE end agora em SmithLib, na pasta lib cole isso: --[[ ################################################ ## Smith System ## ## Author: Maxwell Denisson(MaXwEllDeN) ## ## Version: 1.0 ## ################################################ ]] _SMITHY_ = { exp_b = 40, receitas = { --dif = Dificuldade [1] = {dif = 5, -- Staff lvl = 150, re = {{5892, 2}, }, ma = {2401, 1} }, [2] = {dif = 1, -- Staff lvl = 150, re = {{5901, 5}, {5880, 1}, }, ma = {2401, 1} }, } } _SMITHY_.getRevenue = function (pos) local recs = {} local ipos = {} local posi = {} local block = {1642, 1643, 1644, 1645, 1617, 1618, 1620, 1621, 2555} local IDEx = 0 for i, v in pairs(_SMITHY_.receitas) do recs[i] = {} for _, a in pairs(v.re) do for b = 1, a[2] do table.insert(recs[i], a[1]) end end end local Zk = {} for _, v in pairs(getAllItemsInPos(pos, block)) do if not isInArray(Zk, v.uid) then table.insert(ipos, v) table.insert(Zk, v.uid) end end for _, v in pairs(ipos) do local t = (v.type > 0) and v.type or 1 for te = 1, t do table.insert(posi, v.itemid) end end for _, v in pairs(recs) do local AE = true for x, i in pairs(posi) do if (AE) then if (not isInArray(v, i)) or (#v ~= #posi) then AE = false else IDEx = _ end end end end if (#recs < 1) then return 0, ipos else return IDEx, ipos end end _SMITHY_.getExp = function (uid) if (getPlayerStorageValue(uid, 58913) < 1) then setPlayerStorageValue(uid, 58913, 0) end return getPlayerStorageValue(uid, 58913) end _SMITHY_.getLevel = function (uid) if (getPlayerStorageValue(uid, 58912) < 1) then setPlayerStorageValue(uid, 58912, 1) end return getPlayerStorageValue(uid, 58912) end _SMITHY_.addLevel = function (uid, ammount) local level = _SMITHY_.getLevel(uid) return setPlayerStorageValue(uid, 58912, level + ammount) end _SMITHY_.getExpToNextLevel = function (uid) return _SMITHY_.getExpLevel(_SMITHY_.getLevel(uid) + 1) end _SMITHY_.getExpLevel = function (level) return level * (_SMITHY_.exp_b) + (level - 1* (_SMITHY_.exp_b)) end _SMITHY_.setExp = function (uid, ammount) return setPlayerStorageValue(uid, 58913, ammount) end _SMITHY_.addExp = function (uid, ammount) local xp = _SMITHY_.getExp(uid) return _SMITHY_.setExp(uid, xp + ammount) end function getAllItemsInPos(pos, block) local results = {} for _ = 1, 255 do local findPos = {x = pos.x, y = pos.y, z = pos.z, stackpos = _} local item = getThingFromPos(findPos) if (not isInArray(block, item.itemid)) and (item.uid > 1) then table.insert(results, item) end end return results end Ai no parte: [1] = {dif = 5, -- Staff lvl = 150, re = {{5892, 2}, }, ma = {2401, 1} }, Onde tem lvl é o level que o player tem que ter pra poder forja Ahh e dei uma editada na parte que manda as msg pro player (fail, etc) pq geralmente os negoh tem preguiça de ir ver no serverlog kkkkk agora manda pro default. Foi uma simples modificação, o cabeça da questão é o Max kkkkkk Editado Outubro 18, 2012 12 anos por porkts (veja o histórico de edições) "A arte de Bottear a Cip não pode Blockear" (Porkts)
Postado Outubro 18, 2012 12 anos Autor Obrigado por fazer a modificação porkts, vou anexar ao tópico para quem estiver procurando P: -"Supra Omnes Lux Lucis" - Acima de todos brilha a Luz -
Postado Outubro 18, 2012 12 anos Ah esqueci de falar, também fiz uma modificação que quando o cara forja o item fica com o nome dele na descrição do item "Forjado por Xumbrega" kkkkkk "A arte de Bottear a Cip não pode Blockear" (Porkts)
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.