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

Mining, Fletching, Woodcutting, Farming

Snafu01

New Member
Joined
Oct 14, 2013
Messages
12
Reaction score
1
Script by shinmaru I made it easier to see and use.

Code:
----------------Script Structure By Nirer/Kakashi~Sensei-----------------
-------------Enhancements and configurablility by 375311-------------
-----------Ask before you re-distribute to other sites-----------
local config = {
grounds = {804},
sMin = 2
}
--To add more plants to grow just copy this example:
--[{XXXX}] = {NFTree = XXXX, bloomInSec = XX, t_DthInSec = XX, FTree = XXXX, tname = ""},--
--Ref: NFTree = Non Fruit Tree, FTree = Fruit Tree, bloomInSec = time that it takes to bloom, t_DthInSec = time that it takes for plant to die,
--tname = tree name and [{XXXX}] = Seed(fruit) itemid, all XXXX are itemids--
--and paste it under:
local t = { --HERE--
[{2675}] = {NFTree = 4008, bloomInSec = 60, t_DthInSec = 120, FTree = 4006, tname = "orange tree"},
[{2676}] = {NFTree = 5092, bloomInSec = 45, t_DthInSec = 30, FTree = 5094, tname = "banana tree"},
[{2678}] = {NFTree = 2726, bloomInSec = 70, t_DthInSec = 50, FTree = 5096, tname = "coconut tree"},
[{2677}] = {NFTree = 2786, bloomInSec = 20, t_DthInSec = 45, FTree = 2785, tname = "blueberry bush"},
[{5097}] = {NFTree = 5156, bloomInSec = 40, t_DthInSec = 20, FTree = 5157, tname = "mango tree"}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local soul = getPlayerSoul(cid)
for i, k in pairs(t) do
if (isInArray(i, itemEx.itemid) == true) and itemEx.type == 1 and (soul >= config.sMin) then
local ground_position = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 0}
local ground_information = getThingfromPos(ground_position)
if(isInArray(config.grounds, ground_information.itemid) == TRUE) then
doPlayerAddSoul(cid, -config.sMin)
doTransformItem(itemEx.uid, k.NFTree)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your "..k.tname.." has grown!")
addEvent(Bloom, k.bloomInSec*1000, {position = toPosition, cid = cid, t_Dth = k.t_DthInSec})

else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This is not the proper ground for farming.")
end
elseif(soul < config.sMin) then
doPlayerSendCancel(cid, "You do not have enough soul to farm.")
elseif(itemEx.type ~= 1) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You may only grow one plant at a time.")
end
end
return TRUE
end
function Bloom(parameter)

local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
for i, k in pairs(t) do
if (tree.itemid == k.NFTree) then
doTransformItem(tree.uid, k.FTree)
doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your "..k.tname.." has fully grown! Harvest it before it withers!")
addEvent(t_Die, parameter.t_Dth*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
end
end
end
function t_Die(parameter)
local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
doRemoveItem(tree.uid)
doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your crop has withered.")
end

2. now make a file in the same said location and name it hoesoil.lua and copy this:

Code:
local cfg = {
level = 15,
soul = 4,
Mon = "Rat",
Lx = "You do not meet the level required to plow the land.",
Sx = "You do not have enough soul to plow the land.",
soil = 103
}
function onUse(cid, item, fromposition, item2, toposition)
local R = math.random(1,500)
local S = getPlayerSoul(cid)
local L = getPlayerLevel(cid)
if (L >= cfg.level) and (S >= cfg.soul) and (item2.itemid == cfg.soil) then
if R <= 100 then
doSummonCreature(cfg.Mon, toposition)
doPlayerAddSoul(cid, -cfg.soul)
doTransformItem(item2.uid, 804)
doDecayItem(item2.uid)

elseif R <= 200 then
doPlayerAddItem(cid, 3976, 3)
doPlayerAddSoul(cid, -cfg.soul)
doTransformItem(item2.uid, 804)
doDecayItem(item2.uid)

elseif R <= 500 then
doTransformItem(item2.uid, 804)
doDecayItem(item2.uid)
doPlayerAddSoul(cid, -cfg.soul)
end
elseif(L < cfg.level) then
doPlayerSendCancel(cid, cfg.Lx)
elseif(S < cfg.soul) then
doPlayerSendCancel(cid, cfg.Sx)

end
return true
end

3.now again make a file and name it harvest plants.lua and copy this in it:

Code:
local cfg = {
soul = 1,
level = 10
}
local t = {
[{4006}] = {fruit = 2675, NFTree = 4008, amount = 3, fName = "Orange"},
[{5094}] = {fruit = 2676, NFTree = 5092, amount = 3, fName = "Banana"},
[{5096}] = {fruit = 2678, NFTree = 2726, amount = 3, fName = "Coconut"},
[{5157}] = {fruit = 5097, NFTree = 5156, amount = 3, fName = "Mango"}
}
function onUse(cid, item, frompos, item2, topos)
local S = getPlayerSoul(cid)
local L = getPlayerLevel(cid)
for i, k in pairs(t) do
if (isInArray(i, item.itemid) == true) and (S >= cfg.soul) and (L >= cfg.level) then
doTransformItem(item.uid, k.NFTree)
doPlayerAddItem(cid, k.fruit, k.amount)
doPlayerAddSoul(cid, -cfg.soul)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got some "..k.fName..".")
elseif (S < cfg.soul) then
doPlayerSendCancel(cid, "You do not have soul to harvest the plant.")
elseif (L < cfg.level) then
doPLayerSendCancel(cid, "You are not in the requiered level to harvest.")
end
end
end

4. same, name it mining.lua and copy:

Code:
--By:Cykotitan Improvised Version--
local config = {
stones = {1285, 1356, 1357, 1358, 1359, 3608, 3615, 3607, 3609, 3616, 3666, 3667, 3668, 3670, 1295, 1290},
level = 20,
skill = SKILL_CLUB,
skillReq = 15,
effect = CONST_ME_BLOCKHIT,
addTries = 100,
debris = 1336,
msgType = MESSAGE_EVENT_ADVANCE,
soul = 5
}
local t = {
[{1, 100}] = {msg = "Oh no, you missed and picked a hole in the ground and a rat came out of it!", summon = "Rat"},
[{101, 200}] = {msg = "You found %A %N.", item = 2157, amountmax = 10},
[{201, 300}] = {msg = "You found %A %N.", item = 2145, amountmax = 10},
[{301, 400}] = {msg = "You found %A %N.", item = 2225},
[{401, 500}] = {msg = "You found %A %N.", item = 2148, amountmax = 100},
[{501, 600}] = {msg = "You found %A %N.", item = 2146, amountmax = 10},
[{601, 700}] = {msg = "You found %A %N.", item = 2149, amountmax = 10},
[{701, 800}] = {msg = "You found %A %N.", item = 2150, amountmax = 10},
[{801, 900}] = {msg = "You found %A %N.", item = 5880},
[{901, 1000}] = {msg = "You lost %D hitpoints due to exhaustion of mining.", damage = {1, 100}},
[{1001, 1100}] = {msg = "You found %A %N.", item = 2147, amountmax = 10},
[{1101, 1200}] = {msg = "You found %A %N.", item = 2143, amountmax = 10},
[{1201, 1300}] = {msg = "You found %A %N.", item = 2144, amountmax = 10},
[{1301, 1400}] = {msg = "An angry dwarf came out of the rock piles!", summon = "Dwarf"},
[{1401, 1500}] = {msg = "A badger got unstuck and it looks angry!", summon = "Badger"},
[{1501, 1600}] = {msg = "A rotworm came from a hole you made on the ground!", summon = "Rotworm"},
[{1601, 1700}] = {msg = "You suffered %D hitpoints due to an earthquake!", damage = {1, 100}},
[{1701, 1800}] = {msg = "A weak troll has appeared from the pile of rocks!", summon = "Troll"},
[{1801, 1900}] = {msg = "Woah! A skeleton just appeared from the pile of rocks!", summon = "Skeleton"},
[{1901, 2000}] = {msg = "Your pick has been heavily damaged and it broke...", destroy = true}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray(config.stones, itemEx.itemid) and config.level <= getPlayerLevel(cid) and config.skillReq <= getPlayerSkill(cid, config.skill) and config.soul <= getPlayerSoul(cid) then
local v, amount, damage = math.random(2000), 1, nil
for i, k in pairs(t) do
if v >= i[1] and v <= i[2] then
if k.destroy then
doRemoveItem(item.uid)
end
if k.summon then
doCreateMonster(k.summon, toPosition)
end
if k.damage then
damage = math.random(k.damage[1], k.damage[2])
doCreatureAddHealth(cid, - damage)
doSendMagicEffect(getThingPos(cid), CONST_ME_DRAWBLOOD)
doSendAnimatedText(getThingPos(cid), damage, TEXTCOLOR_RED)

end
if k.item then
if k.amountmax then
amount = math.random(k.amountmax)
end
doPlayerAddItem(cid, k.item, amount)
end
if k.msg then
local msg = k.msg
if msg:find("%%") then
if msg:find("%%A") and k.item then
msg = msg:gsub("%%A", amount > 1 and amount or getItemDescriptionsById(k.item).article)
end
if msg:find("%%N") and k.item then
msg = msg:gsub("%%N", amount > 1 and getItemDescriptionsById(k.item).plural or getItemNameById(k.item))
end
if msg:find("%%D") and damage then
msg = msg:gsub("%%D", damage)
end
end
doPlayerSendTextMessage(cid, config.msgType, msg)
end
doTransformItem(itemEx.uid, config.debris)
doPlayerAddSoul(cid, -config.soul)
doSendMagicEffect(toPosition, k.destroy and CONST_ME_HITAREA or config.effect)
return doPlayerAddSkillTry(cid, config.skill, config.addTries)
end
end
end
return doPlayerSendCancel(cid, "You either aren't experienced, skilled or don't have enough soul, or this isn't a breakable rock.")
end
 
5. last one, name it woodcutting.lua and copy: [UPDATED]

Code:
local config = {
trees = {2701,2702,2703,2704,2705,2706,2707,2708,2709,2710,2712,2717,2718,2720,2722},
t = {
[{1, 100}] = {tree = 2701},
[{101, 200}] = {tree = 2702},
[{201, 300}] = {tree = 2703},
[{301, 400}] = {tree = 2704},
[{401, 500}] = {tree = 2705},
[{501, 600}] = {tree = 2706},
[{601, 700}] = {tree = 2707},
[{701, 800}] = {tree = 2708},
[{801, 900}] = {tree = 2709},
[{901, 1000}] = {tree = 2710},
[{1001, 1100}] = {tree = 2712},
[{1101, 1200}] = {tree = 2717},
[{1201, 1300}] = {tree = 2718},
[{1301, 1400}] = {tree = 2720},
[{1401, 1500}] = {tree = 2722}
},
level = 15,
skill = SKILL_AXE,
skillReq = 10,
effect = CONST_ME_BLOCKHIT,
addTries = 100,
branches = 6432,
msgType = MESSAGE_EVENT_ADVANCE,
soul = 3,
minutes = 5
}

local t = {
[{1, 500}] = {msg = "You choped the tree and got some wood", item = 5901, amountmax = 3},
[{501, 750}] = {msg = "You have damaged your axe and it broke!", destroy = true},
[{751, 1550}] = {msg = "You choped the tree down, but the the wood was not good."},
[{1551, 1650}] = {msg = "oh no the tree had a Wasps nest in it!", summon = "Wasp"},
[{1651, 1750}] = {msg = "You hurt your self while choping the tree down", damage = {1, 100}},
[{1751, 2000}] = {msg = "You choped the tree and got some wood", item = 5901, amountmax = 5},
[{2001, 2250}] = {msg = "A cat that was stuck jumped from the choped tree", summon = "Cat"},
[{2251, 2500}] = {msg = "There was a bird's nest in the tree and you took some eggs from the nest", item = 2695, amountmax = 5},
[{2501, 2750}] = {msg = "Hahaa! You found a sack with coins in it!", item = 2148, amountmax = 50},
[{2751, 3000}] = {msg = "A rat jumped at you!", summon = "Rat"}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray(config.trees, itemEx.itemid) and config.level <= getPlayerLevel(cid) and config.skillReq <= getPlayerSkill(cid, config.skill) and config.soul <= getPlayerSoul(cid) then
local v, amount, damage = math.random(3000), 1, nil
for i, k in pairs(t) do
if v >= i[1] and v <= i[2] then
if k.destroy then
doRemoveItem(item.uid)
end
if k.summon then
doCreateMonster(k.summon, toPosition)
end
if k.damage then
damage = math.random(k.damage[1], k.damage[2])
doCreatureAddHealth(cid, - damage)
doSendMagicEffect(getThingPos(cid), CONST_ME_DRAWBLOOD)
doSendAnimatedText(getThingPos(cid), damage, TEXTCOLOR_RED)

end
if k.item then
if k.amountmax then
amount = math.random(k.amountmax)
end
doPlayerAddItem(cid, k.item, amount)
end
if k.msg then
local msg = k.msg
doPlayerSendTextMessage(cid, config.msgType, msg)
end

local function newTrees(parameter)
local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
for i2, k2 in pairs(config.t) do
local v2 = math.random(1500), 1, nil
if v2 >= i2[1] and v2 <= i2[2] then
if k2.tree then
if (tree.itemid == config.branches) then
doTransformItem(tree.uid, k2.tree)
end
end
end
end
end
addEvent(newTrees, config.minutes*60*1000, {position = toPosition, cid = cid})
doTransformItem(itemEx.uid, config.branches)
doPlayerAddSoul(cid, -config.soul)
doSendMagicEffect(toPosition, k.destroy and CONST_ME_HITAREA or config.effect)
return doPlayerAddSkillTry(cid, config.skill, config.addTries)
end
end

end
return doPlayerSendCancel(cid, "Either this tree can't be choped or you don't have enough experience, skill or soul to chop this tree.")
end

6. Now to give use to all the wood you collect from chopping down trees, make a file in actions/scripts and name it fletching.lua and copy this:

Code:
local cfg = {
msgType = MESSAGE_INFO_DESCR,
cancel = "You don't have the requiered level."
}
local t = {
[{1, 200}] = {level = 15, item = 2389, name = "spear"},
[{201, 300}] = {level = 20, item = 2544, name = "arrow"},
[{301, 400}] = {level = 25, item = 2543, name = "bolt"},
[{401, 500}] = {level = 30, item = 2547, name = "power bolt"},
[{501, 1000}] = {level = 1, destroy = "You attemted to craft something and broke the piece of wood"},
[{1001, 1200}] = {level = 35, item = 7363, name = "piercing bolt"},
[{1201, 1300}] = {level = 40, item = 7365, name = "onyx arrow"},
[{1301, 1400}] = {level = 45, item = 7364, name = "sniper arrow"},
[{1401, 1500}] = {level = 1, destroyknife = "Your knife broke."}
}

function onUse(cid, item, frompos, item2, item3, topos)
if item2.itemid == 0 then
return 0
end
if item2.itemid == 5901 then
local r = math.random(1500), 1, nil
local level = getPlayerLevel(cid)
for i, k in pairs(t) do
if r >= i[1] and r <= i[2] then
if level >= k.level then
if k.item then
doPlayerAddItem(cid, k.item, 1)
doRemoveItem(item2.uid, 1)
doPlayerSendTextMessage(cid, cfg.msgType, "You crafted "..k.name..".")
end
if k.destroy then
doRemoveItem(item2.uid, 1)
doPlayerSendTextMessage(cid, cfg.msgType, k.destroy)
end
if k.destroyknife then
doRemoveItem(item2.uid, 1)
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid, cfg.msgType, k.destroyknife)
end
else
doPlayerSendCancel(cid, cfg.cancel)
end
end
end
else
return 0
end
return 1
end
 
can you give more info how to istall it and where then i will test it on 2.15 server
 
can you give more info how to istall it and where then i will test it on 2.15 server
1-.add in actions a folder named craft
2-.actions.xml add this and respective script on each one
Code:
        <!-- Craft -->
        <action itemid="2552" event="script" value="craft/hoesoil.lua"/>
        <action itemid="4874" event="script" value="craft/mining.lua"/>
        <action itemid="2549" event="script" value="craft/farm.lua"/>
        <action itemid="2386" event="script" value="craft/woodcutting.lua"/>
        <action itemid="2379" event="script" value="craft/fletching.lua"/>
        <action itemid="4006" event="script" value="craft/plants.lua"/>
        <action itemid="5157" event="script" value="craft/plants.lua"/>
        <action itemid="5094" event="script" value="craft/plants.lua"/>
        <action itemid="5096" event="script" value="craft/plants.lua"/>
3-.use axe on trees to woodcut
4-.use dwarven pick on rocks to mine
5-.use dagger on wood to craft
6-.use hoe on soil (ID: 103) to plow land
7-. put mango,orange,coconut,blueberry,banana on dirst (804) and use rake to farm
8-. enjoy :)
 
Back
Top