Maniucza
~Lua~ Noob
I present a system of weed cuting in this system you can cut various skill tree the smaller the less the chance that the tree cut down.
You OTS/MODS/weedCuting.xml
You OTS/MODS/weedCuting.xml
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="WoodCuting System" version="1.0" author="Karpio" contact="http://tibia.net.pl/members/karpio.html" enabled="yes">
<config name="WoodCuting Lib"><![CDATA[
wood = {}
wood.reward = 5901
wood.trees = {2700, 2701, 2702, 2703, 2704, 2705, 2706, 2707, 2708}
wood.maxLevel = 100
wood.stor = {876, 875}
wood.showLevel = true
function wood.getPlayerSkill(cid)
return getPlayerStorageValue(cid, wood.stor[1])
end
function wood.addSkillTry(cid)
if(getPlayerStorageValue(cid, wood.stor[1]) >= wood.maxLevel) then
return true
end
local formula = getPlayerStorageValue(cid, wood.stor[1]) / 10
if(math.random(1, formula) == 1) then
if(getPlayerStorageValue(cid, wood.stor[2]) >= 99) then
setPlayerStorageValue(cid, wood.stor[2], 0)
setPlayerStorageValue(cid, wood.stor[1], getPlayerStorageValue(cid, wood.stor[1])+1)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You advanced in WoodCuting. "..(wood.showLevel == true and "["..getPlayerStorageValue(cid, wood.stor[1]).."]" or "").."")
else
setPlayerStorageValue(cid, wood.stor[2], getPlayerStorageValue(cid, wood.stor[2])+1)
end
end
return true
end
]]></config>
<action itemid="2559" event="script"><![CDATA[
domodlib("WoodCuting Lib")
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(isInArray(wood.trees, itemEx.itemid) == false) then
return false
end
wood.addSkillTry(cid)
doSendMagicEffect(toPosition, 16)
if(math.random(wood.getPlayerSkill(cid), wood.maxLevel) == wood.maxLevel) then
local itemid = itemEx.itemid
doRemoveItem(itemEx.uid, 1)
doCreateItem(8786, 1, toPosition)
addEvent(function()
doRemoveItem(getThingFromPos(toPosition).uid)
pien = doCreateItem(2768, 1, toPosition)
addEvent(function()
doRemoveItem(getThingFromPos(toPosition).uid)
doCreateItem(itemid, 1, toPosition)
end, 5 * 1000, {itemid = itemid, toPosition = toPosition})
end, 5 * 1000, {itemid = itemid, toPosition = toPosition})
end
return true
end]]></action>
<event type="login" name="WoodCuting Login" event="script"><![CDATA[
domodlib("WoodCuting Lib")
function onLogin(cid)
if(getPlayerStorageValue(cid, wood.stor[1]) < 10) then
setPlayerStorageValue(cid, wood.stor[1], 10)
end
if(getPlayerStorageValue(cid, wood.stor[2]) < 0) then
setPlayerStorageValue(cid, wood.stor[2], 0)
end
return true
end
]]></event>
</mod>