• 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!

[MOD]Wood Cutting

hakeee

New Member
Joined
Oct 23, 2008
Messages
45
Reaction score
0
Location
sweden
This is a [MOD] wood cutting system by me Hakeee.
It has a good config and i believe it's easy to understand.
It's tested on tfs 3.6pl1 and working good.
If anyone find errors then report it to me and I'm gonna fix it at least try:)
Wood cutting script
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="cutting" version="1.0" author="Hakeee" contact="otland.net" enabled="yes">
<action itemid="2386" event="script"><![CDATA[
local treestime = 60 
local trees = { -- [treeid] = {skill = needed skills,skillType = SKILL_AXE, weapon = another weapon(need to be adden on action itemid to, root = onother root can be added here,  delay = time before the tree grow back},
                [2700] = {skill = 10,skillType = SKILL_AXE, weapon = 2386, root = 6432,  delay = 40},
                [2701] = {skill = 14},
                [2702] = {},
                [2703] = {skill = 140, weapon = 2386},
                [2704] = {},
                [2705] = {}
            }
               
local function roototree(pos,tree,frompos)
local root = getTileItemById(pos, tree)
    if root.itemid == trees[root.actionid].root then
    doTransformItem(root.uid, root.actionid)
    doItemSetAttribute(root.uid, "aid", 0)
    end
return
end

local function addroot(pos,tree,root,delay,frompos)
    if isCreature(getThingFromPos(pos).uid) then
        addEvent(addroot,500,pos,tree,root,delay,frompos)
    else
        doCreateItem(root,1,pos)
        local nroot = getTileItemById(pos, root)
        doItemSetAttribute(nroot.uid, "aid", tree)
        addEvent(roototree,delay*1000,pos,root,frompos)
    end
return
end


function onUse(cid, item, fromPosition, itemEx, toPosition)
    if trees[itemEx.itemid] ~= nil then
        thing = itemEx.itemid
    elseif trees[itemEx.actionid] ~= nil and trees[itemEx.actionid].root == itemEx.itemid then
        thing = itemEx.actionid
    end
            if trees[thing].skillType == nil then
                trees[thing].skillType = SKILL_AXE
            end
            if trees[thing].skill == nil then
                trees[thing].skill = 10
            end
            if trees[thing].skill > getPlayerSkillLevel(cid, trees[thing].skillType) then
                doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,"Damn I don't have the skills to cut it.")
                return true
            end
            
            if trees[thing].root == nil then
                trees[thing].root = 6432
            end
            if trees[thing].delay == nil then
                trees[thing].delay = 60
            end
            
            if trees[thing].weapon ~= nil then
                if item ~= trees[thing].weapon then
                    doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,"You can't cut this tree with this weapon.")
                    return true
                end
            end
            
        if thing == itemEx.itemid then
            doItemSetAttribute(itemEx.uid, "aid", itemEx.itemid)
            doTransformItem(itemEx.uid, trees[itemEx.itemid].root)
            ttr = addEvent(roototree,trees[thing].delay*1000,toPosition,trees[thing].root,fromPosition)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,"I've cutted a tree!")
        elseif thing == itemEx.actionid then
            stopEvent(ttr)
            addEvent(addroot,trees[thing].delay*1000,toPosition,itemEx.actionid,trees[thing].root,trees[thing].delay,fromPosition)
            doRemoveItem(itemEx.uid)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,"I've cutted a root!")
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,"This isn't a tree or it cant be cutted!")
        end
return true
end
]]></action>
</mod>
I know it was released a wood cutting script before somewhere but I hope someone liked it.
 
can't get it to work :/ i just inserted it into MOD file and added tree id and the cutting axe id. What else do i have to do? Is it possible to add this script without having any skill?
 
Back
Top