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

On use Transform

Blackcody

RiseOfTibia Owner
Joined
Aug 31, 2008
Messages
136
Reaction score
1
LUA:
local grass = {106, 103, 101}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if itemid == 2549 then 
		doTransformItem(grass, 804)then
        end
return true
end

If The Rake Id = 2549 is used on the grass Tiles Id = {106, 103, 101} the grass tiles should transform to the dirt tile Id = 804

Some One Please Help
 
Maybe?


PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
   local timetoreset = 10 --10 seconds
    if itemid == 2549 then
     if (isPlayer(cid)) then
        doTransformItem(item.uid, 804) --804 = TileID, edit it for another tileID if you want
        addEvent(resetgoodtile, timetoreset * 1000, item, pos)
      end
    end
end

function resetgoodtile(item, pos)
doItemSetAttribute(doCreateItem(804, 1, pos) --804 = TileID, edit it for another tileID if you want
end
 
LUA:
local grass = {106, 103, 101}
local resetTime = 10 -- in seconds
local transformItemId = 804
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(cid) then
		if isInArray(grass, itemEx.itemid) then 
			doTransformItem(itemEx.uid, transformItemId)
			addEvent(resetGrass, resetTime * 1000, getThingPos(itemEx.uid), transformItemId, itemEx.itemid)
		else
			doPlayerSendCancel(cid, 'You can use this item only on grass.')
		end
	end
	return true
end

function resetGrass(pos, Id, trans)
	local thing = getTileItemById(pos, Id).uid
	if thing > 0 then
		doTransformItem(thing, trans)
	end
end
 
Back
Top