• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action [MODS] Weed Cuting System

Maniucza

~Lua~ Noob
Joined
Aug 2, 2009
Messages
86
Reaction score
6
Location
Poland / Rzeszów
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
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>

16b0aar.jpg


vmystv.jpg
 
I have problem with it.
[Error - Action Interface]
buffer:eek:nUse
Description:
[string "wood = {}..."]:18: bad argument #2 to 'random' (interval is empty)
stack traceback:
[C]: in function 'random'
[string "wood = {}..."]:18: in function 'addSkillTry'
[string "loadBuffer"]:7: in function <[string "loadBuffer"]:2>
 
In tfs 0.3.6


05/04/2010 13:27:34] [Error - Action Interface]
[05/04/2010 13:27:34] buffer:eek:nUse
[05/04/2010 13:27:34] Description:
[05/04/2010 13:27:34] [string "wood = {}..."]:18: bad argument #2 to 'random' (interval is empty)
[05/04/2010 13:27:34] stack traceback:
[05/04/2010 13:27:34] [C]: in function 'random'
[05/04/2010 13:27:34] [string "wood = {}..."]:18: in function 'addSkillTry'
[05/04/2010 13:27:34] [string "loadBuffer"]:7: in function <[string "loadBuffer"]:2>
 
Hello, I edited this mod and no know storage =(
Need a new storage, you can help me?

Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="stoneCuting System" version="1.0" author="Amy Azzkaban" contact="N/N" enabled="yes">
<config name="stoneCuting Lib"><![CDATA[
stone = {}

stone.reward = 1294
stone.trees = {1304, 3613}
stone.maxLevel = 100
stone.stor = {880, 879}
stone.showLevel = true

function stone.getPlayerSkill(cid)
        return getPlayerStorageValue(cid, stone.stor[1])
end

function stone.addSkillTry(cid)
        if(getPlayerStorageValue(cid, stone.stor[1]) >= stone.maxLevel) then
                return true
        end
        local formula = getPlayerStorageValue(cid, stone.stor[1]) / 10
        if(math.random(1, formula) == 1) then
                if(getPlayerStorageValue(cid, stone.stor[2]) >= 99) then
                        setPlayerStorageValue(cid, stone.stor[2], 0)
                        setPlayerStorageValue(cid, stone.stor[1], getPlayerStorageValue(cid, stone.stor[1])+1)
                        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You advanced in stoneCuting. "..(stone.showLevel == true and "["..getPlayerStorageValue(cid, stone.stor[1]).."]" or "").."")
                else
                        setPlayerStorageValue(cid, stone.stor[2], getPlayerStorageValue(cid, stone.stor[2])+1)
                end
        end
return true
end
]]></config>

<action itemid="2422" event="script"><![CDATA[
        domodlib("stoneCuting Lib")
        function onUse(cid, item, fromPosition, itemEx, toPosition)             
                if(isInArray(stone.trees, itemEx.itemid) == false) then
                        return false
                end
                
                wood.addSkillTry(cid)
                doSendMagicEffect(toPosition, 44)               
                if(math.random(wood.getPlayerSkill(cid), stone.maxLevel) == stone.maxLevel) then
                        local itemid = itemEx.itemid
                        doRemoveItem(itemEx.uid, 1)
                        doCreateItem(3613, 1, toPosition)
                        addEvent(function()
                                doRemoveItem(getThingFromPos(toPosition).uid)
                                pien = doCreateItem(3613, 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="stoneCuting Login" event="script"><![CDATA[
        domodlib("stoneCuting Lib")
        function onLogin(cid)
                if(getPlayerStorageValue(cid, stone.stor[1]) < 10) then
                        setPlayerStorageValue(cid, stone.stor[1], 10)
                end
                if(getPlayerStorageValue(cid, stone.stor[2]) < 0) then
                        setPlayerStorageValue(cid, stone.stor[2], 0)
                end
        return true
        end
]]></event>
</mod>
 
Last edited by a moderator:
[24/04/2010 02:46:38] > Loading weedCuting.xml...[Error - ScriptingManager::loadFromXml] Cannot load mod mods/weedCuting.xml
[24/04/2010 02:46:39] Line: 1, Info: XML declaration allowed only at the start of the document
 
how do u can train this skills? so u go to a three and u use or axe or something on it? and then ur skills goes up, yes so?:S:S:S
do u get the woods in ur bp, do u can do something with this woods?.....
to make a idea like this, ( its great and funny idea btw ), u need to see what it does, if u can only get the trees down and it does nothing after that. its not usefull

u need to do something like this:
like u train ur sword fighting so u hit harder
if player skills higher > more chanse to get woods... something like that.
 
@Nerkoerko
open the file and where you see this(<?xml version="1.0" encoding="UTF-8"?>) on the very top well you have a space on it remove it.
This is what it looks like in your script:
Code:
 <?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[
that space that you see behind <?xml remove it.
 
I have tfs 0.3.5 but its only one thing that don't work and thats i can't skill up and in the client there isnt any woodcutting skill bar :S
 
The script has been loaded into the OTS, but you can not cut trees, it is animation, but the tree is not felled and no ability to grow and does not have the skills in the skills.
 
Back
Top