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

[Request] 4 items to get teleported

zerghel

Tsuni
Joined
Jul 1, 2008
Messages
299
Reaction score
9
hello OtLanders

i'm needing a script i hope you could help me

4 coal basins for 4 items
and a lever to delete those 4 items and get teleported
sounds simple but im very noob with lua

btw! im using mystic Spirit U.U
 
data/actions/scripts/lever.lua
Code:
local t = {
	cfg = {
		[1] = { pos = { x = 100, y = 100, z = 7}, itemid = 2500 },
		[2] = { pos = { x = 100, y = 100, z = 7}, itemid = 2500 },
		[3] = { pos = { x = 100, y = 100, z = 7}, itemid = 2500 },
		[4] = { pos = { x = 100, y = 100, z = 7}, itemid = 2500 }
	},
	destination = { x = 100, y = 100, z = 7 }
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		for _, v in ipairs(t.cfg) do
			if getTileItemById(v.pos, v.itemid).uid < 1 then
				return TRUE, doPlayerSendCancel(cid, "Wrong items.")
			end
		end
		for _, v in ipairs(t.cfg) do
			doRemoveItem(getTileItemById(v.pos, v.itemid).uid)
		end
		doTeleportThing(cid, t.destination)
		doSendMagicEffect(t.destination, CONST_ME_TELEPORT)
		doTransformItem(item.uid, 1946)
	elseif item.itemid == 1946 then
		doTransformItem(item.uid, 1945)
	end
	return TRUE
end
data/actions/actions.xml
Code:
	<action uniqueid="10000" script="lever.lua"/>
 
data/actions/scripts/lever.lua
Code:
local t = {
	cfg = {
		[1] = { pos = { x = 100, y = 100, z = 7}, itemid = 2500 },
		[2] = { pos = { x = 100, y = 100, z = 7}, itemid = 2500 },
		[3] = { pos = { x = 100, y = 100, z = 7}, itemid = 2500 },
		[4] = { pos = { x = 100, y = 100, z = 7}, itemid = 2500 }
	},
	destination = { x = 100, y = 100, z = 7 }
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		for _, v in ipairs(t.cfg) do
			if getTileItemById(v.pos, v.itemid).uid < 1 then
				return TRUE, doPlayerSendCancel(cid, "Wrong items.")
			end
		end
		for _, v in ipairs(t.cfg) do
			doRemoveItem(getTileItemById(v.pos, v.itemid).uid)
		end
		doTeleportThing(cid, t.destination)
		doSendMagicEffect(t.destination, CONST_ME_TELEPORT)
		doTransformItem(item.uid, 1946)
	elseif item.itemid == 1946 then
		doTransformItem(item.uid, 1945)
	end
	return TRUE
end
data/actions/actions.xml
Code:
	<action uniqueid="10000" script="lever.lua"/>

Flawless as always, ty sooooooooo! much
 
Back
Top