Boa Tarde Galera,
Hoje venho postar um sistema adaptado que eu desenvolvi. Basicamente eu peguei o sistema de Minning existente no servidor postado pelo Vmspk (http://www.xtibia.co...60-azeroth-rpg/) e modifiquei para corte de árvores ao invés de minério de stones.
Bom, vamos ao que interessa:
Para quê serve este sistema?
R: Ele é um sistema secundário voltado para enfatizar o RPG de servidores, no meu servidor eu o utilizo para obtenção de material para forja. Utilize sua criatividade para implementá-lo no seu servidor.
Ele funciona em quais versões de Open Tibia?
R: Só testei na versão 9.6 até agora, peço que vocês postem caso estejam conseguindo utiliza-lo em outras versões.
primeiramente você precisa adicionar um arquivo chamado cutsystem.lua com o seguinte dentro:
local configs = { sign = {{level = {1,99}, quant = {1,2}, percent = 25}, {level = {100,120}, quant = {1,5}, percent = 35}, {level = {121,130}, quant = {1,7}, percent = 45}, {level = {131,140}, quant = {1,8}, percent = 65}, {level = {141,149}, quant = {1,9}, percent = 70}, {level = {150}, quant = {1,10}, percent = 100}}, trees = {2708, 2768, 2767, 2702, 2785, 2700, 2707, 2711, 2706, 2707, 2705, 2719, 7024, 5156, 5157, 2697, 2698, 2701, 2702, 2703, 2704, 2707, 2712, 2718, 2719, 2720, 2709, 2710, 2722, 2725, 2726, 2770, 2786, 4006, 4007, 4008, 4009, 4010, 7020, 7021, 7022, 7023}, wood = {{5901, 'all'}}, tree_delay = 5, --[em minutos MaxLevel = 150, breakChance = 0 } --END Configs-- function onUse(cid, item, fromPosition, itemEx, toPosition, onUse) local STORAGE_SKILL_LEVEL = 20000 local STORAGE_SKILL_TRY = 20001 local skillLevel = getPlayerStorageValue(cid,STORAGE_SKILL_LEVEL) local skillTry = getPlayerStorageValue(cid,STORAGE_SKILL_TRY) local objeto2 = getThingFromPos(toPosition) local player = (cid) if skillLevel == -1 then setPlayerStorageValue(cid,STORAGE_SKILL_LEVEL,1) end for Q = 1, #configs.sign do if configs.sign[Q].level[2] == nil then configs.sign[Q].level[2] = configs.sign[Q].level[1] end if skillLevel >= configs.sign[Q].level[1] and skillLevel <= configs.sign[Q].level[2] then quant = math.random(configs.sign[Q].quant[1],configs.sign[Q].quant[2]) percent = configs.sign[Q].percent break end end for i = 1, #configs.trees do if objeto2.itemid == configs.trees[i] then if math.random(1,100) <= configs.breakChance then doPlayerSendCancel(cid,"Your axe has broke") doSendMagicEffect(toPosition, 3) doRemoveItem(item.uid,1) doPlayerSay(cid,"Broke!",1) return true else if math.random(1,100) <= percent then possible_wood = {{},{}} for h = 1, #configs.wood do if configs.wood[h][2] == objeto2.itemid then possible_wood[1][#possible_wood[1]+1] = configs.wood[h][1] else if configs.wood[h][2] == 'all' then possible_wood[2][#possible_wood[2]+1] = configs.wood[h][1] end end end if possible_wood[1][1] == nil and possible_wood[2][1] == nil then doPlayerSay(cid,"This tree can not be chopped.",1) elseif possible_wood[1][1] ~= nil then doPlayerAddItem(cid,possible_wood[1][math.random(1,#possible_wood[1])],quant) elseif possible_wood[1][1] == nil and possible_wood[2][1] ~= nil then doPlayerAddItem(cid,possible_wood[2][math.random(1,#possible_wood[2])],quant) end if possible_wood[1][1] ~= nil or possible_wood[2][1] ~= nil then if skillTry >= 0 then setPlayerStorageValue(cid,STORAGE_SKILL_TRY,skillTry + 1) else setPlayerStorageValue(cid,STORAGE_SKILL_TRY,1) end doPlayerSay(cid,"I got "..quant.." woods.",1) doItemSetAttribute(objeto2.uid, "name", "remains of wood ore") doSendMagicEffect(toPosition, 3) addEvent(doTreeReturn,configs.tree_delay * 1000/60,toPosition,objeto2.itemid) doTransformItem(objeto2.uid, 8786) break end else doPlayerSendCancel(cid,"You destroyed the tree...") doSendMagicEffect(toPosition, 3) doItemSetAttribute(objeto2.uid, "name", "remains of wood ore") doPlayerSay(cid,"I broke the tree!",1) addEvent(doTreeReturn,configs.tree_delay * 1000/60,toPosition,objeto2.itemid) doTransformItem(objeto2.uid, 8785) break end end else doPlayerSendCancel(cid,"I can only chop trees") end end if skillTry >= ((skillLevel+1)*3) then if skillLevel == configs.MaxLevel then doPlayerSay(cid,"I got the max level in tree cutting.",1) setPlayerStorageValue(cid,STORAGE_SKILL_TRY,0) else setPlayerStorageValue(cid,STORAGE_SKILL_LEVEL,skillLevel + 1) setPlayerStorageValue(cid,STORAGE_SKILL_TRY,0) doPlayerSay(cid,"I advanced from level ".. skillLevel .." to level ".. skillLevel + 1 .." in chopping skill.",1) doPlayerSay(cid,"LEVEL UP!",1) end end end function doTreeReturn(itemposition,oldid) local pos = getThingfromPos(itemposition) doTransformItem(pos.uid,oldid) doSetItemText(pos.uid, getItemNameById(oldid)) doSendMagicEffect(itemposition,math.random(28,30)) end
Para editar as configurações do sistema basta modificar as primeiras informações da tabela:
sign = {{level = {(do skill)1,(até o skill)99}, quant(quanto você pode conseguir) = {1,2}, percent(chance de dar certo) = 25},
trees(os id's das árvores "cortáveis") = {2708, 2768, 2767, 2702, 2785, 2700, 2707, 2711, 2706, 2707, 2705, 2719, 7024, 5156, 5157, 2697, 2698, 2701, 2702, 2703, 2704, 2707, 2712, 2718, 2719, 2720, 2709, 2710, 2722, 2725, 2726, 2770, 2786, 4006, 4007, 4008, 4009, 4010, 7020, 7021, 7022, 7023},
wood = {{5901, 'all'}}, (troque o id 5901 pelo id do item que você quer dar como recompensa)
tree_delay = 5, --[em minutos (tempo que as árvores vão demorar para crescer novamente depois de cortadas)
MaxLevel = 150, (só modifique caso você aumentar o level máximo na tabela "sign")
breakChance = 0 (a chance em % que o seu item - no meu caso o Axe - tem de quebrar quando usado na árvore)
agora vá no seu arquivo actions.xml e adione a seguinte tag:
<!-- Tree Cut--> <action itemid="2386" script="cutsystem.lua" />
2386= Este é o ID do item Axe, caso queira trocar, fique à vontade.
é isso aih pessoal... esse é o sisteminha que eu adaptei para meu servidor, espero que seja útil para alguém, abraços.