• 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 Shovel On Grass

Beo

Three Magic
Joined
Aug 25, 2009
Messages
9,075
Solutions
1
Reaction score
857
This script will allow you to dig grass, like you was digging sand.

Eg, sand gives you chances to either dig Scarab Coin or dig Scarab, this will enable you to dig grass and gives you chances to dig Crystal Coin or Rubbish.

LUA:
	elseif itemEx.itemid == 4526 then
		local rand = math.random (1, 200)
		if rand == 1 then
			doCreateItem(2160, 1, toPosition)
		elseif rand > 55 then
			doCreateItem(2242, 1, toPosition)
		end
		doSendMagicEffect (toPosition, CONST_ME_POFF)

Insert it into your shovel.lua file

UNTESTED.
This is my second script, so I'm not 100% it will work ^_^

Unknown666's full version;
Updated script, for both grass & sand.

LUA:
local c,cc = 2.5,2.6 -- chance % for scarab coin[1] and crystal coin[2], so 2.5% chance now to get scarab coin, else summon scarab. You have 2.6% for a crystal coin at grass.
local m,s,t = 'Scarab',2821,30*1000 -- monster name, storage, exhaustion time (30*1000), not sure if exhaustion.set uses mseconds.
local sand,grass = {4760;4783},{4526;4553} -- fromid;toid, not sure wether ; = toid.
function onUse(cid,item,topos,itemEx,frompos)
local r = math.random(1,100)
	if exhaustion.get(cid,s) then
		doPlayerSendCancel(cid,'Cooldown, try again in '..exhaustion.check(cid,s)..' seconds.')
	else
		if isInArray(sand,itemEx.itemid) then
			if r <= c then
				exhaustion.set(cid,s,t)
				doCreateItem(2159,1,topos)
				doSendMagicEffect(topos,CONST_ME_MAGIC_GREEN)
				doPlayerSendTextMessage(cid,MESSAGE_FIRST,'You found a scarab coin!')
			else
				exhaustion.set(cid,s,t)
				doCreateMonster(m:lower(),topos)
				doSendMagicEffect(topos,CONST_ME_POFF)
				doPlayerSendTextMessage(cid,MESSAGE_FIRST,'You failed digging for scarab coin, you made a '..m..' angry!')
			end
		elseif isInArray(grass,itemEx.itemid) then
			if r <= cc then
				exhaustion.set(cid,s,t)
				doCreateItem(2160,1,topos)
				doSendMagicEffect(topos,CONST_ME_MAGIC_GREEN)
				doPlayerSendTextMessage(cid,MESSAGE_FIRST,'You found a crystal coin!')
			else
				exhaustion.set(cid,s,t)
				doCreateItem(math.random(2223,2224),1,topos)
				doSendMagicEffect(topos,CONST_ME_POFF)
				doPlayerSendTextMessage(cid,MESSAGE_FIRST,'You failed digging for a crystal coin, however, you got some rubbish though.')
			end
		else
			doPlayerSendCancel(cid,'Invalid tile.')
		end
	end
	return true
end
 
Last edited:
SECOND!! o.O!!

I would change
doCreateItem(2160, 1, toPosition)
to
doCreateItem(2148, 15, toPosition)

so noobs don't stand around all day picking at my grass..

and it gives them a (little) extra gold, but not too much.
unless your doing a High Exp server, than I would use "Crystal Coins".
other than that I would use "Gold Coins".

But thanks Rep++
 
LUA:
elseif itemEx.itemid == 4526 then
Will work only with 4526? Grass has more IDs I believe :p
And only 0.5% chance of gettin cc :(
Well done anyway
 
Yeah you can change to whatever you like.. Lol.

Blez, did you put it in correctly?

@ Santigg, yeah.. about that.. It was just a quick 5 minute script, didnt wanna put all grass ID's in, haha.
Yeah 0.5%.. Wanted it the same as scarab coin, so its not so easy. :)

Thanks, second script.. haha, learning.... SLOWLY.
 
@Divise
I'm checking it right now, I just need to finish 1 thing really quick, but I'm going to add all the ids of the grass then re-add the script here if you want, so others can use it.

if you were adding the other ids would you do

4256,????,????,???? ect?
 
You would do it so it looks like;

LUA:
 elseif itemEx.itemid == 4526 or itemEx.itemid == 4527

I guess.
 
This one if modifiable, and grass id's might work, not really sure if ; represents fromid-toid.
Also has exhaustion to prevent abuse.

LUA:
local c = 2.5 -- chance %, so 2.5% chance now to get scarab coin, else summon scarab.
local m,s,t = 'Scarab',2821,30*1000 -- monster name, storage, exhaustion time (30*1000), not sure if exhaustion.set uses mseconds.
local grass = {4526;4553} -- fromid;toid, not sure wether ; = toid.
function onUse(cid,item,topos,itemEx,frompos)
local r = math.random(1,100)
	if exhaustion.get(cid,s) then
		doPlayerSendCancel(cid,'Cooldown, try again in '..exhaustion.check(cid,s)..' seconds.')
	else
		if isInArray(grass,itemEx.itemid) then
			if r <= c then
				exhaustion.set(cid,s,t)
				doCreateItem(2160,1,topos)
				doSendMagicEffect(topos,CONST_ME_MAGIC_GREEN)
			else
				exhaustion.set(cid,s,t)
				doCreateMonster(m:lower(),topos)
				doSendMagicEffect(topos,CONST_ME_POFF)
				doPlayerSendTextMessage(cid,MESSAGE_FIRST,'You failed digging for scarab coin, you made a '..m..' angry!')
			end
		else
			doPlayerSendCancel(cid,'Invalid tile.')
		end
	end
	return true
end
 
That would summon a scarab, though?
 
Updated script, for both grass & sand.

LUA:
local c,cc = 2.5,2.6 -- chance % for scarab coin[1] and crystal coin[2], so 2.5% chance now to get scarab coin, else summon scarab. You have 2.6% for a crystal coin at grass.
local m,s,t = 'Scarab',2821,30*1000 -- monster name, storage, exhaustion time (30*1000), not sure if exhaustion.set uses mseconds.
local sand,grass = {4760;4783},{4526;4553} -- fromid;toid, not sure wether ; = toid.
function onUse(cid,item,topos,itemEx,frompos)
local r = math.random(1,100)
	if exhaustion.get(cid,s) then
		doPlayerSendCancel(cid,'Cooldown, try again in '..exhaustion.check(cid,s)..' seconds.')
	else
		if isInArray(sand,itemEx.itemid) then
			if r <= c then
				exhaustion.set(cid,s,t)
				doCreateItem(2159,1,topos)
				doSendMagicEffect(topos,CONST_ME_MAGIC_GREEN)
				doPlayerSendTextMessage(cid,MESSAGE_FIRST,'You found a scarab coin!')
			else
				exhaustion.set(cid,s,t)
				doCreateMonster(m:lower(),topos)
				doSendMagicEffect(topos,CONST_ME_POFF)
				doPlayerSendTextMessage(cid,MESSAGE_FIRST,'You failed digging for scarab coin, you made a '..m..' angry!')
			end
		elseif isInArray(grass,itemEx.itemid) then
			if r <= cc then
				exhaustion.set(cid,s,t)
				doCreateItem(2160,1,topos)
				doSendMagicEffect(topos,CONST_ME_MAGIC_GREEN)
				doPlayerSendTextMessage(cid,MESSAGE_FIRST,'You found a crystal coin!')
			else
				exhaustion.set(cid,s,t)
				doCreateItem(math.random(2223,2224),1,topos)
				doSendMagicEffect(topos,CONST_ME_POFF)
				doPlayerSendTextMessage(cid,MESSAGE_FIRST,'You failed digging for a crystal coin, however, you got some rubbish though.')
			end
		else
			doPlayerSendCancel(cid,'Invalid tile.')
		end
	end
	return true
end
 
Back
Top