Ir para conteúdo
  • 0

Ordem alavancas correta, abre tp!


sisifos

Pergunta

Olá boa tarde, 

Eu tenho um script que você precisa puxar as alavancas corretas, para abrir um teleport em um determinado local do mapa. 

Estou utilizando OTX 1.0, e não estou conseguindo fazer a action funcionar, porém também ela não apresenta nenhum erro, e os uids estão todos configurados. 

 

Citar

local config = {
	timeLimit = 500, -- in seconds, limit to check all switches
	teleport = {
		time = 1000 * 60 * 10, -- time to auto remove teleport
		pos = {x = 33727, y = 32842, z = 11}, -- where teleport will be created
		toPos = {x = 33763, y = 32861, z = 11} -- where teleport will be teleporting
	},

	switches = { --UIDs of switches
		3345,
		3346,
		3347,
		3348,
		3349,
		3350,
		3351,
		3352,
		3353,
		3354,
	},

	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

 

Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...