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

Script

Tibia Rox

Member
Joined
Feb 4, 2009
Messages
1,181
Reaction score
9
Location
U.S.A
I need a script that when you pull a lever, the item in x,x,x moves to the right one square.

Simple enough?

Thanks in advance
 
ServerDirectory/mods/Move_Item.xml
LUA:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Move_Item" version="1.0" author="Slaktaren" contact="my ass" enabled="yes">

	local cfg = {
			action = XXXX, -- The action id of the lever
			currentPos = { posx = XXX, posy = YYY, posz = ZZZ }, -- Pos of the item start position
			newPos = { posx = cfg.currentPos.x+1, posy = cfg.currentPos.y, posz = cfg.currentPos.z }, -- Pos of the new item position
			itemID = XXXX, -- ID of the item that should be moved
				}

	<action itemid="cfg.action" event="script"><![CDATA[
	
		if item.itemid == 1945 or item.itemid == 1946 then
			if getTileItemById(cfg.currentPos, cfg.itemID) then
				doTeleportThing(getTileItemById(cfg.currentPos, itemID).uid, cfg.newPos)
			else
				doPlayerSendCancel(cid, "The item has already been moved."}
			end
		return TRUE
		end
	]]></action>
</mod>
 
Last edited:
ju8gso.jpg
 
It doesn't say anything about the mod file..?
Does your server even support MOD?

Action instead:
data/actions/scripts/Move_Tile.lua
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)

	local cfg = {
		action = XXXX, -- The action id of the lever
		currentPos = { posx = XXX, posy = YYY, posz = ZZZ }, -- Pos of the item start position
		newPos = { posx = cfg.currentPos.x+1, posy = cfg.currentPos.y, posz = cfg.currentPos.z }, -- Pos of the new item position
		itemID = XXXX, -- ID of the item that should be moved
				}

	if item.itemid == 1945 or item.itemid == 1946 then
		if getTileItemById(cfg.currentPos, cfg.itemID) then
				doTeleportThing(getTileItemById(cfg.currentPos, itemID).uid, cfg.newPos)
		else
			doPlayerSendCancel(cid, "The item has already been moved."}
		end
return TRUE
end
data/actions/actions.xml
Code:
<action actionid="[COLOR="Red"]XXXX[/COLOR]" event="script" value="Move_Tile.lua"/>
 
Last edited:
try this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Move_Item" version="1.0" author="Slaktaren" contact="my ass" enabled="yes">
	<config name="cfg"><![CDATA[
		cfg = {
			currentPos = {posx = XXX, posy = YYY, posz = ZZZ }, -- Pos of the item start position
			newPos = {posx = cfg.currentPos.x+1, posy = cfg.currentPos.y, posz = cfg.currentPos.z}, -- Pos of the new item position
			itemID = XXXX, -- ID of the item that should be moved
		}
	]]></config>
	<action itemid="xxxx" event="buffer"><![CDATA[
		domodlib('cfg')
		if item.itemid == 1945 or item.itemid == 1946 then
			if getTileItemById(cfg.currentPos, cfg.itemID) then
				doTeleportThing(getTileItemById(cfg.currentPos, itemID).uid, cfg.newPos)
			else
				doPlayerSendCancel(cid, "The item has already been moved."}
			end
		end
		return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
	]]></action>
</mod>
 
ops
edit this line
Code:
<action itemid="xxxx" event="buffer"><![CDATA[
replace with
Code:
<action uniqueid="xxxx" event="buffer"><![CDATA[
 
If you want to move all items from the square:
Code:
function onUse(cid, item, frompos, itemEx, topos)
local itemPos = {x=111, y=111, z=7}
	doRelocate(itemPos, {x=itemPos.x+1, y=itemPos.y, z=itemPos.z}, false)
return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Back
Top