Script by shinmaru I made it easier to see and use.
2. now make a file in the same said location and name it hoesoil.lua and copy this:
3.now again make a file and name it harvest plants.lua and copy this in it:
4. same, name it mining.lua and copy:
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