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

przesun pare dzwigni -> zrob teleport (nie robi !)

ligus

New Member
Joined
Apr 26, 2010
Messages
253
Reaction score
0
No tak, dziwna sytuacja :P
Chodzi mi o takie coś, że jak przesune pare dzwigni to w wyznaczonym miejscu pojawi się TP. jednak nie wiem czemu nie działa..

Code:
local config = {
	timeLimit = 600, -- in seconds, limit to check all switches
	teleport = {
		time = 1000 * 60 * 10, -- time to auto remove teleport
		pos = {x = 32615, y = 32484, z = 9}, -- where teleport will be created
		toPos = {x = 32615, y = 32485, z = 10} -- where teleport will be teleporting
	},

	switches = { --UIDs of switches
		6551,
		6552,
		6553,
		6554,
		6555,
		6556
	},

	effect = {
		show = "yes",
		text = "Gogogo!",
		magicEffect = 19
	}
}

config.effect.show = getBooleanFromString(config.effect.show)
local switchStates = {}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		doTransformItem(item.uid, 1945)
		table.remove(switchStates, item.uid)
		return TRUE
	end

	if(getTileItemById(config.teleport.pos, 1387).itemid ~= 0) then
		doPlayerSendCancel(cid, "Teleport is already open!")
		return TRUE
	end

	switchStates[item.uid] = 1
	if(table.maxn(switchStates) == #config.switches) then
		if(config.effect.show) then
			for _, uid in pairs(config.switches) do
				local pos = getThingPos(uid)
				doSendMagicEffect(pos, config.effect.magicEffect)
				doSendAnimatedText(pos, "Gogogo!", cid)
			end
		end

		switchStates = {}
		doCreateTeleport(1387, config.teleport.toPos, config.teleport.pos)
		addEvent(autoRemoveTeleport, config.teleport.time)
	end

	doTransformItem(item.uid, 1946)
	return TRUE
end

local function autoRemoveTeleport()
	local teleport = getTileItemById(config.teleport.pos, 1387).uid
	if(teleport ~= 0) then
		doRemoveItem(teleport)
	end
end

actions.xml
<action fromuid="6551" touid="6556" script="switches.lua"/>

na map editorze wszystko prawidłowo też zrobione, w konsoli nie wyrzuca żadnego błędu a jednak TP się nie robi :o
gdzie leży problem?
 
Back
Top