Ir para conteúdo

[Suporte Script] Alavancas da The Ape City Quest Mission 9 (Banuta), script parcialmente funcionando (Ajuda pls x.x)

Featured Replies

Postado

Quando aciono a 7 alavanca (com UniqueID 65430), a wall some, mas só começa a contar o tempo para a alavanca voltar ao normal, se eu der use novamente, ai aparece a mensagem "It doesn't move. Só quando aparece esta mensagem que começa contar o tempo para reverter a alavanca e reaparecer a wall.

 

Gostaria que ao acionar a 7 alavanca, as outras 6 primeiras voltassem ao normal na mesma hora.
E que a alavanca com UniqueID 65431 (que fica dentro da sala da missão), só pudesse ser usada quando a wall aparecer, mas ela está sem ação, ao dar use nela aparece "The lever won't budge".

 

- Versão TFS 1.3

- Todas as localizações contidas no script estão corretas.

- Todos os UniqueIDs contidos no script estão corretos.

 

Citar

local config = {
	leverTime = 60,
	gateLeverTime = 15,
	leverPositions = {
		Position(32891, 32590, 11),
		Position(32843, 32649, 11),
		Position(32808, 32613, 11),
		Position(32775, 32583, 11),
		Position(32756, 32494, 11),
		Position(32799, 32556, 11)
	},

	gateLevers = {
		{position = Position(32862, 32555, 11), duration = 15 * 60, ignoreLevers = true},
		{position = Position(32862, 32557, 11), duration = 60, ignoreLevers = false}
	},

	walls = {
		{position = Position(32864, 32556, 11), itemId = 3474}
	}
}
local WallPosition = Position(32864, 32556, 11)

local function revertLever(position)
	local leverItem = Tile(position):getItemById(1946)
	if leverItem then
		leverItem:transform(1945)
	end
end

local function revertWalls(position)
	Game.createItem(3474, 1, WallPosition)
end


function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if (item.uid == 65430) and item.itemid ~= 1945 then
		player:sendTextMessage(MESSAGE_INFO_DESCR, 'It doesn\'t move.')
		addEvent(revertLever, config.gateLeverTime * 1000, toPosition)
		addEvent(revertWalls, config.gateLeverTime * 1000, toPosition)
		return false
	end

	if isInArray(config.leverPositions, toPosition) then
		item:transform(1946)
		addEvent(revertLever, config.gateLeverTime * 1000, toPosition)
		return true
	end

	local gateLever
	for i = 1, #config.gateLevers do
		if toPosition == config.gateLevers[i].position then
			gateLever = config.gateLevers[i]
		end
	end

	if not gateLever then
		return true
	end

	if not gateLever.ignoreLevers then
		for i = 1, #config.leverPositions do
			-- if lever not pushed, do not continue
			local leverItem = Tile(config.leverPositions[i]):getItemById(1946)
			if not leverItem then
				return false
			end
		end
	end

	-- open gate when all levers used
	for i = 1, #config.walls do
		local wallItem = Tile(config.walls[i].position):getItemById(config.walls[i].itemId)
		if not wallItem then
			player:say('The lever won\'t budge', TALKTYPE_MONSTER_SAY, false, nil, toPosition)
			return true
		end

		wallItem:remove()
		config.walls[i].position:sendMagicEffect(CONST_ME_MAGIC_RED)
	end

	item:transform(1946)
	return true
end

 

 

 

Editado por DiigooMix
detalhes (veja o histórico de edições)

  • DiigooMix mudou o título para [EDITED Suporte Script] Alavancas da The Ape City Quest Mission 9 (Banuta), script parcialmente funcionando (Ajuda pls x.x)
Postado

O erro está sendo gerado pela linha 43:

wallItem:remove()

Porém não tem nada declarando esse “wallItem”.


Creio que foi adicionado ela de forma errada, portanto, basta remover ou comentar a linha para sair o erro.

 

Postado
  • Autor
20 minutos atrás, Toruk disse:

O erro está sendo gerado pela linha 43:


wallItem:remove()

Porém não tem nada declarando esse “wallItem”.


Creio que foi adicionado ela de forma errada, portanto, basta remover ou comentar a linha para sair o erro.

 

 

Fiz isso que você comentou, e removi algumas linhas repetidas, agora não retorna erro nenhum na distro, mas a wall ainda não reaparece. 

E as primeiras 6 walls também não voltam pro id 1945, elas permanecem ativadas, mas se eu tento usar a alavanca 7 novamente (mesmo refazendo o processo de ativação das 6 primeiras alavancas), a alavanca 7 retorna a mensagem da linha 77: player:say('The lever won\'t budge', TALKTYPE_MONSTER_SAY, false, nil, toPosition)

 

O script agora está assim:

Citar

local config = {
	leverTime = 60,
	gateLeverTime = 15,
	leverPositions = {
		Position(32891, 32590, 11),
		Position(32843, 32649, 11),
		Position(32808, 32613, 11),
		Position(32775, 32583, 11),
		Position(32756, 32494, 11),
		Position(32799, 32556, 11)
	},

	gateLevers = {
		{position = Position(32862, 32555, 11), duration = 15 * 60, ignoreLevers = true},
		{position = Position(32862, 32557, 11), duration = 60, ignoreLevers = false}
	},

	walls = {
		{position = Position(32864, 32556, 11), itemId = 3474}
	}
}

local function revertLever(position)
	local leverItem = Tile(position):getItemById(1946)
	if leverItem then
		leverItem:transform(1945)
	end
end

local function revertWalls(leverPosition)
	revertLever(config.leverPosition)

	for i = 1, #config.walls do
		Game.createItem(config.walls[i].itemId, 1, config.walls[i].position)
	end
end


function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if (item.uid == 65430) and item.itemid ~= 1945 then
		player:sendTextMessage(MESSAGE_INFO_DESCR, 'It doesn\'t move.')
		addEvent(revertLever, config.gateLeverTime * 1000, toPosition)
		return false
	end

	if isInArray(config.leverPositions, toPosition) then
		item:transform(1946)
		addEvent(revertLever, config.gateLeverTime * 1000, toPosition)
		return true
	end

	local gateLever
	for i = 1, #config.gateLevers do
		if toPosition == config.gateLevers[i].position then
			gateLever = config.gateLevers[i]
		end
	end

	if not gateLever then
		return true
	end

	if not gateLever.ignoreLevers then
		for i = 1, #config.leverPositions do
			-- if lever not pushed, do not continue
			local leverItem = Tile(config.leverPositions[i]):getItemById(1946)
			if not leverItem then
				return false
			end
		end
	end

	-- open gate when all levers used
	for i = 1, #config.walls do
		local wallItem = Tile(config.walls[i].position):getItemById(config.walls[i].itemId)
		if not wallItem then
			player:say('The lever won\'t budge', TALKTYPE_MONSTER_SAY, false, nil, toPosition)
			return true
		end

		wallItem:remove()
		config.walls[i].position:sendMagicEffect(CONST_ME_MAGIC_RED)
	end

	item:transform(1946)
	return true
end

 

 

  • DiigooMix mudou o título para [Suporte Script] Alavancas da The Ape City Quest Mission 9 (Banuta), script parcialmente funcionando (Ajuda pls x.x)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 520.3k

Informação Importante

Confirmação de Termo