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

Rotating Tapestrys

Nightimarez

New Member
Joined
Jul 24, 2008
Messages
287
Reaction score
2
This script rotates tapestrys by clicking use on them. If you have it in your backpack, it causes an error and disappears. I need for it to only work on the ground.

PHP:
function onUse(cid, item, frompos, item2, topos)
 
 cortina1 = {x=topos.x-1, y=topos.y, z=topos.z} 
 cortina2 = {x=topos.x+1, y=topos.y-1, z=topos.z} 
 cortina3 = {x=topos.x, y=topos.y+1, z=topos.z} 
 
 if item.itemid == 1857 or item.itemid == 1860 or item.itemid == 1863 or item.itemid == 1866 or item.itemid == 1869 or item.itemid == 1872 then 
 doRemoveItem(item.uid,1)
 doCreateItem(item.itemid-1,1,cortina1)
 return 1
 
 elseif item.itemid == 1856 or item.itemid == 1859 or item.itemid == 1862 or item.itemid == 1865 or item.itemid == 1868 or item.itemid == 1871 then
 doRemoveItem(item.uid,1)
 doCreateItem(item.itemid-1,1,cortina2)
 return 1
 
 elseif item.itemid == 1855 or item.itemid == 1858 or item.itemid == 1861 or item.itemid == 1864 or item.itemid == 1867 or item.itemid == 1870 then
 doRemoveItem(item.uid,1)
 doCreateItem(item.itemid+2,1,cortina3)

elseif item.itemid == 1880 then
 doRemoveItem(item.uid,1)
 doCreateItem(item.itemid-1,1,cortina1)

elseif item.itemid == 1879 then
 doRemoveItem(item.uid,1)
 doCreateItem(item.itemid-1,1,cortina2)

elseif item.itemid == 1878 then
 doRemoveItem(item.uid,1)
 doCreateItem(item.itemid+2,1,cortina3)

elseif item.itemid == 5616 then
 doRemoveItem(item.uid,1)
 doCreateItem(item.itemid-1,1,cortina1)

elseif item.itemid == 5615 then
 doRemoveItem(item.uid,1)
 doCreateItem(item.itemid-1,1,cortina2)

elseif item.itemid == 5614 then
 doRemoveItem(item.uid,1)
 doCreateItem(item.itemid+2,1,cortina3)
 
 return 1
 end
 end

Heres some functions that could help.

PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if fromPosition.x ~= CONTAINER_POSITION then
		fireworksEffect = math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE)
		doSendMagicEffect(fromPosition, fireworksEffect)
	else
		doSendMagicEffect(fromPosition, CONST_ME_HITBYFIRE)
		doSendMagicEffect(fromPosition, CONST_ME_EXPLOSIONAREA)
		doCreatureSay(cid, "Ouch! Rather place it on the ground next time.", TALKTYPE_ORANGE_1)
		doCreatureAddHealth(cid, -10)
	end
	doRemoveItem(cid, item.uid, 1)
	return TRUE
end

And this is the error I get.

PHP:
[05/05/2011 16:14:05] luaDoCreateItem(). ( 65534 / 00064 / 000 ) Tile not found
[05/05/2011 16:14:05] stack traceback:
[05/05/2011 16:14:05] 	[C]: in function 'doCreateItem'
[05/05/2011 16:14:05] 	data/actions/scripts/other/tapestry.lua:11: in function <data/actions/scripts/other/tapestry.lua:3>
 
Last edited:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if fromPosition.x ~= CONTAINER_POSITION then
fireworksEffect = math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE)
doSendMagicEffect(fromPosition, fireworksEffect)
else
doSendMagicEffect(fromPosition, CONST_ME_HITBYFIRE)
doSendMagicEffect(fromPosition, CONST_ME_EXPLOSIONAREA)
doCreatureSay(cid, "Ouch! Rather place it on the ground next time.", TALKTYPE_ORANGE_1)
doCreatureAddHealth(cid, -10)
end
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if fromPosition.x == 65535 then
		return false
	end

	doRemoveItem(item.uid)
	if isInArray({1855,1858,1861,1864,1867,1870,1878,5614}, item.itemid) then
		doCreateItem(item.itemid+2, 1, {x=toPosition.x, y=toPosition.y+1, z=toPosition.z})
	elseif isInArray({1856,1859,1862,1865,1868,1871,1879,5615}, item.itemid) then
		doCreateItem(item.itemid-1, 1, {x=toPosition.x+1, y=toPosition.y-1, z=toPosition.z})
	elseif isInArray({1857,1860,1863,1866,1869,1872,1880,5616}, item.itemid) then
		doCreateItem(item.itemid-1, 1, {x=toPosition.x-1, y=toPosition.y, z=toPosition.z})
	end
	return true
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 10347 then
doPlayerSendTextMessage(cid,21,"Rawr XD!")
doTransformItem(item.uid, item.itemid - 4556)
elseif item.itemid == 5791
doPlayerSendTextMessage(cid,21,"SORA!")
doTransformItem(item.uid, item.itemid + 4556)
end
return TRUE
end
 
Last edited:
Back
Top