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

Need script for Mining!

Casanna

Legend...
Joined
Oct 26, 2008
Messages
35
Reaction score
0
Location
Wierden, Netherlands
hello,

im searching for an full working mining script.
i'v got an converted illusions map 8.54, but now i need a mining script for the mininG area.

for the ppl who dont know what i mean:p

in 7.6 you had a script that when u are using a pick on a stone, its says ~clang and then you got cash or an iron ore.

now i need the script for the pick, the stones And the iron ore table in the map illusions :)

please help me.
kind regards,

Casanna

ps. sorry for my bad english :p
 
Credits to Cykotitan for his table, Colandus for fixing a nil value, and me the rest =D
Lua:
-- Mining made by [email][email protected][/email] -- 
-- TODO: -- edit your caveIds
local config = {
	caveIds = {5815, 8347, 6476, 8362, 8916},
	rateSkill = getConfigValue("rateSkill"),
	randomsize = 500,
	v = {
		[{1, 2}] = {level = 50, monster = "Slime", msg = "A fierce Slime came out of the pile of rocks!"},
		[{3, 5}] = {level = 50, monster = "Demon Skeleton", msg = "A fierce Demon Skeleton came out of the pile of rocks!"},
		[{6, 8}] = {level = 50, monster = "Dwarf Guard", msg = "A fierce dwarf guard came out of the pile of rocks!"},
		[{9, 11}] = {level = 30, monster = "Demon", msg = "You hit the rock to hard making a hole, A Demon comes up striaght from hell!", bc = true},
		[{12, 15}] = {level = 10, monster = "Troll", msg = "A weak troll has appeared from the pile of rocks!"},
		[{16, 18}] = {level = 20, monster = "Dwarf Soldier", msg = "A dwarf soldier came out of the pile of rocks!"},
		[{19, 22}] = {level = 20, itemId = "2157", countId = "1", msg = "You\'ve found a golden nugget."},
		[{23, 27}] = {level = 20, itemId = "2145", countId = "1", msg = "You\'ve found a diamond."},
		[{28, 32}] = {level = 20, itemId = "2225", countId = "1", msg = "Omg. You\'ve FOUND A PIECE OF IRON!!"},
		[{33, 37}] = {level = 20, itemId = "2152", countId = "1", msg = "That\'s good!"},
		[{38, 41}] = {level = 20, itemId = "2147", countId = "1", msg = "You\'ve found a ruby."},
		[{42, 48}] = {level = 20, itemToRemove = "2553", countId = "1", msg = "Your pick has been heavily damaged and broke..."},
		[{49, 52}] = {level = 20, itemId = "2225", countId = "5", msg = "Omg. You\'ve FOUND A PIECE OF IRON!!"},
		[{53, 55}] = {level = 20, itemId = "2152", countId = "4", msg = "That\'s good!"},
		[{56, 58}] = {level = 20, itemId = "2152", countId = "3", msg = "That\'s good!"},
		[{59, 62}] = {level = 20, itemId = "2152", countId = "2", msg = "That\'s good!"}
	}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if not isInArray(config.caveIds, itemEx.itemid) then
		return false
	end
	if math.random((100 + (getPlayerSkillLevel(cid, SKILL_CLUB) / 20))) < getPlayerSkillLevel(cid, SKILL_CLUB) then
		doPlayerAddSkillTry(cid, SKILL_CLUB, 1)
		local formula, lvl, club = math.random(config.randomsize), getPlayerLevel(cid), getPlayerSkillLevel(cid, SKILL_CLUB)
		for range, inf in pairs(config.v) do
			if formula >= range[1] and formula <= range[2] and lvl >= inf.level then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, inf.msg)
                                                                if inf.bc then
                                                                                 doBroadcastMessage(getPlayerName(cid) .. " Is mining, GET HIM!", 22)
                                                                                 if inf.monster then
			                                                 doSummonCreature(inf.monster, getThingPos(cid))
                                                                                 elseif inf.itemId and inf.countId then
				                                 doPlayerAddItem(cid, inf.itemId, inf.countId)
                                                                                 elseif inf.itemToRemove and inf.countId then
                                                                                                 doPlayerRemoveItem(cid, itemToRemove, inf.countId)
				end
				break
			end
		end
	end
	doSendMagicEffect(toPosition, 3)
	return true
end
end
 
Code:
-- Mining made by [email][email protected][/email] --
-- TODO: -- edit your caveIds
local config = {
	caveIds = {5815, 8347, 6476, 8362, 8916},
	rateSkill = getConfigValue("rateSkill"),
	randomsize = 500,
	v = {
		[{1, 2}] = {level = 50, monster = "Slime", msg = "A fierce Slime came out of the pile of rocks!"},
		[{3, 5}] = {level = 50, monster = "Demon Skeleton", msg = "A fierce Demon Skeleton came out of the pile of rocks!"},
		[{6, 8}] = {level = 50, monster = "Dwarf Guard", msg = "A fierce dwarf guard came out of the pile of rocks!"},
		[{9, 11}] = {level = 30, monster = "Demon", msg = "You hit the rock too hard making a hole, A Demon comes straight up from hell!", bc = true},
		[{12, 15}] = {level = 10, monster = "Troll", msg = "A weak troll has appeared from the pile of rocks!"},
		[{16, 18}] = {level = 20, monster = "Dwarf Soldier", msg = "A dwarf soldier came out of the pile of rocks!"},
		[{19, 22}] = {level = 20, itemId = 2157, countId = 1, msg = "You've found a golden nugget."},
		[{23, 27}] = {level = 20, itemId = 2145, countId = 1, msg = "You've found a diamond."},
		[{28, 32}] = {level = 20, itemId = 2225, countId = 1, msg = "Omg. You've FOUND A PIECE OF IRON!!"},
		[{33, 37}] = {level = 20, itemId = 2152, countId = 1, msg = "That's good!"},
		[{38, 41}] = {level = 20, itemId = 2147, countId = 1, msg = "You've found a ruby."},
		[{42, 48}] = {level = 20, itemToRemove = 2553, countId = 1, msg = "Your pick has been heavily damaged and it broke..."},
		[{49, 52}] = {level = 20, itemId = 2225, countId = 5, msg = "Omg. You've FOUND A PIECE OF IRON!!"},
		[{53, 55}] = {level = 20, itemId = 2152, countId = 4, msg = "That's good!"},
		[{56, 58}] = {level = 20, itemId = 2152, countId = 3, msg = "That's good!"},
		[{59, 62}] = {level = 20, itemId = 2152, countId = 2, msg = "That's good!"}
	}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if not isInArray(config.caveIds, itemEx.itemid) then
		return false
	end
	if math.random((100 + (getPlayerSkillLevel(cid, SKILL_CLUB) / 20))) < getPlayerSkillLevel(cid, SKILL_CLUB) then
		doPlayerAddSkillTry(cid, SKILL_CLUB, 1)
		local formula, lvl, club = math.random(config.randomsize), getPlayerLevel(cid), getPlayerSkillLevel(cid, SKILL_CLUB)
		for range, inf in pairs(config.v) do
			if formula >= range[1] and formula <= range[2] and lvl >= inf.level then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, inf.msg)
				if inf.bc then
					doBroadcastMessage(getPlayerName(cid) .. " Is mining, GET HIM!", 22)
				end
				if inf.monster then
					doSummonCreature(inf.monster, getThingPos(cid))
				elseif inf.itemId then
					doPlayerAddItem(cid, inf.itemId, inf.countId or 1)
				elseif inf.itemToRemove then
					doPlayerRemoveItem(cid, itemToRemove, inf.countId or 1)
				end
				break
			end
		end
	end
	doSendMagicEffect(toPosition, 3)
	return true
end
 
Btw, the doPlayerAddItem works with inf.countId... but the doplayerremoveitem doesnt work with inf.countId :eek:, this might make it work, thanks
 
Yea, put this in data/actions/tools/Mining.lua
and in data/actions/actions.xml add:
Code:
	<action itemid="2553" event="script" value="tools/mining.lua" allowfaruse="1"/>
 
i put the script in actions/other/mining.lua

and this in actions.xml
<action itemid="2553" event="script" value="other/mining.lua" allowfaruse="1"/>

i need to change cave id or what?
 
Yea use the caveIds in the script, if you want to change it, then change it to whatever suits youre server.
I used those only for a test.
 
Create an item from the following caveIds in the script, then use the pick on the item and it will work:thumbup:
 
hmm,

local config = {
caveIds = {5815, 8347, 6476, 8362, 8916, 352},
rateSkill = getConfigValue("rateSkill"),
randomsize = 500,
this are the cave ids but its only floor:p.
i rlly dont know what youre meaning
can we talk easyer with msn or what?
 
Back
Top