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

How am I failing with this script i want the rake to transform grass to dirt

Angel Of Death

Rise Of Tibia ServerOwner
Joined
Mar 12, 2012
Messages
91
Reaction score
0
LUA:
function onUse(cid, item, frompos, item2, topos)
 if item.itemid== 106 then 
 doTransformItem(item.uid, 103)
 return
 end
 
you dont need line 2. The ID of the item is specified in actions.xml

Demonc_blood.lua: example

LUA:
local POTIONS = {7588, 7589}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	doTransformItem(item.uid, POTIONS[math.random(1, table.maxn(POTIONS))])
	doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED)
	return true
end
 
No... You cannot tranform ground because when you tranform, you remove item and place another one. You cannot remove a tile because it will be void. So you have to create a ground above the existing ground:

doCreateItem(103, 1, pos)
I think.
 
oh i see

- - - Updated - - -

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid== 106 then  
doCreateItem(103, 1, pos)
end


not really that sure what im doing
 
change line 3's third argument "pos" to "toPosition".

line 2 isn't needed, and if you use it, add an extra end.

then use this in actions.xml

<action itemid="106" event="script" value="file.lua"/>
 
if you specified that the script is to an specific item id in the action.xml, you don't need to check again the item id in the script like you're doing.

but remember that all if need an end.

function onUse(cid, item, frompos, item2, topos)
doTransformItem(item.uid, 103)
return true
end
 
i need the rake make the grass transform to dirt or create dirt where the grass is

- - - Updated - - -

there ever you what ever grass you click with the rake turns to dirt
 
Back
Top