• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

I need some help with an action

Angel Of Death

Rise Of Tibia ServerOwner
Joined
Mar 12, 2012
Messages
91
Reaction score
0
this works
with one item on soil

LUA:
local cfg = {
  level = 0,
  soul = 0,
  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 = 4526,
  grass = 103
  }

this doesnt work
with more than one item on soil

LUA:
local cfg = {
  level = 0,
  soul = 0,
  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 = 4533, 4526, 4536,
  grass = 103
  }
 
soil has to be an array

something like this:
LUA:
local cfg = {
	level = 0,
	soul = 0,
	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 = {
		[1] = "4533",
		[2] = "4526",
		[3] = "4536"
	},
	grass = 103
}
 
Thought so

LUA:
local cfg = {
	level = 0,
	soul = 0,
	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 = {4533, 4526, 4536},
	grass = 103
}
 
when i use the rake on the grass witch is the 3 ids 3 diffrent grass types its turns them to dirt so i can plant sh*t

- - - Updated - - -

but it only works then there is one grass id there

- - - Updated - - -

LUA:
local cfg = {
	level = 0,
	soul = 0,
	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 = {4533, 4526, 4536},
	grass = 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
   doTransformItem(item2.uid, cfg.grass)
   doDecayItem(item2.uid)
 
  elseif R <= 200 then
   doTransformItem(item2.uid, cfg.grass)
   doDecayItem(item2.uid)
 
  elseif R <= 500 then
   doTransformItem(item2.uid, cfg.grass)
   doDecayItem(item2.uid)
  end
 elseif(L < cfg.level) then
  doPlayerSendCancel(cid, cfg.Lx)
 elseif(S < cfg.soul) then
  doPlayerSendCancel(cid, cfg.Sx)
 
 end
  return true
end
 
so how do i do that with this script
LUA:
local cfg = {
	level = 0,
	soul = 0,
	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 = {4533, 4526, 4536},
	grass = 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
   doTransformItem(item2.uid, cfg.grass)
   doDecayItem(item2.uid)
 
  elseif R <= 200 then
   doTransformItem(item2.uid, cfg.grass)
   doDecayItem(item2.uid)
 
  elseif R <= 500 then
   doTransformItem(item2.uid, cfg.grass)
   doDecayItem(item2.uid)
  end
 elseif(L < cfg.level) then
  doPlayerSendCancel(cid, cfg.Lx)
 elseif(S < cfg.soul) then
  doPlayerSendCancel(cid, cfg.Sx)
 
 end
  return true
end
 
LUA:
local cfg = {
	level = 0,
	soul = 0,
	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 = {4533, 4526, 4536},
	grass = 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 (isInArray(cfg.soil, item2.itemid)) then
  if R <= 100 then
   doTransformItem(item2.uid, cfg.grass)
   doDecayItem(item2.uid)
 
  elseif R <= 200 then
   doTransformItem(item2.uid, cfg.grass)
   doDecayItem(item2.uid)
 
  elseif R <= 500 then
   doTransformItem(item2.uid, cfg.grass)
   doDecayItem(item2.uid)
  end
 elseif(L < cfg.level) then
  doPlayerSendCancel(cid, cfg.Lx)
 elseif(S < cfg.soul) then
  doPlayerSendCancel(cid, cfg.Sx)
 
 end
  return true
end

Try that
 

Similar threads

Back
Top