Action

GustavaoTibia
em Scripts

GustavaoTibia

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 25/06/15Posts: 30Gênero: Masculino

Galera to com um problema no action de um boss...

Alguém poderia me ajudar corrigir? ou dizer mais ou menos porque acontece?

 

Lua Script Error: [Action Interface] 
data/actions/scripts/forgotten knowledge/tenebris lever.lua:onUse
data/actions/scripts/forgotten knowledge/tenebris lever.lua:15: attempt to compare number with nil
stack traceback:
        [C]: in function '__le'
        data/actions/scripts/forgotten knowledge/tenebris lever.lua:15: in function <data/actions/scripts/forgotten knowledge/tenebris lever.lua:7

 

 

gabriel28

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 26/08/10Posts: 429Gênero: MasculinoChar no Tibia: Gabriel Rookgaardian
25 minutos atrás, GustavaoTibia disse:
 

Testa ai:
 

local config = {
	centerRoom = Position(32912, 31599, 14),
	BossPosition = Position(32912, 31599, 14),
	newPosition = Position(32911, 31603, 14)
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if item.itemid == 9825 then
		if player:getPosition() ~= Position(32902, 31623, 14) then
			item:transform(9826)
			return true
		end
	end
	if item.itemid == 9825 then
		if Game.getStorageValue(GlobalStorage.ForgottenKnowledge.TenebrisTimer) <= 0 then
		local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15)
		for i = 1, #specs do
			spec = specs[i]
			if spec:isPlayer() then
				player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with Lady Tenebris.")
				return true
			end
		end
		for y = 31623, 31627 do
			local playerTile = Tile(Position(32902, y, 14)):getTopCreature()
			if playerTile and playerTile:isPlayer() then
				playerTile:getPosition():sendMagicEffect(CONST_ME_POFF)
				playerTile:teleportTo(config.newPosition)
				playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
				playerTile:setExhaustion(Storage.ForgottenKnowledge.LadyTenebrisTimer, 20 * 60 * 60)
			end
		end
		for d = 1, 6 do
			Game.createMonster('shadow tentacle', Position(math.random(32909, 32914), math.random(31596, 31601), 14), true, true)
		end
		Game.createMonster("lady tenebris", config.BossPosition, true, true)
		Game.setStorageValue(GlobalStorage.ForgottenKnowledge.TenebrisTimer, 1)
		addEvent(clearForgotten, 30 * 60 * 1000, Position(32895, 31584, 14), Position(32929, 31614, 14), Position(32925, 31617, 14), GlobalStorage.ForgottenKnowledge.TenebrisTimer)
		item:transform(9826)
		elseif item.itemid == 9826 then
		item:transform(9825)
		else			
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait a while, recently someone challenge Lady Tenebris.")
			return true
		end
	end
	return true
end

 

GustavaoTibia

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 25/06/15Posts: 30Gênero: Masculino

Não da erro, mas não acontece nada, alavanca antes movia pra um lado e quando fosse da use de novo dava aquele erro com o jogador no sqm certo, se o jogador tiver no sqm fora alavanca vai e volta sem aparecer nenhum erro no console

gabriel28

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 26/08/10Posts: 429Gênero: MasculinoChar no Tibia: Gabriel Rookgaardian
2 minutos atrás, GustavaoTibia disse:

Não da erro, mas não acontece nada, alavanca antes movia pra um lado e quando fosse da use de novo dava aquele erro com o jogador no sqm certo, se o jogador tiver no sqm fora alavanca vai e volta sem aparecer nenhum erro no console

Testa:
 

Spoiler
local config = {
	centerRoom = Position(32912, 31599, 14),
	BossPosition = Position(32912, 31599, 14),
	newPosition = Position(32911, 31603, 14)
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if item.itemid == 9825 then
		if player:getPosition() ~= Position(32902, 31623, 14) then
			item:transform(9826)
			return true
		end
	end
	if item.itemid == 9825 then
		if Game.getStorageValue(GlobalStorage.ForgottenKnowledge.TenebrisTimer) == nil then
		local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15)
		for i = 1, #specs do
			spec = specs[i]
			if spec:isPlayer() then
				player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with Lady Tenebris.")
				return true
			end
		end
		for y = 31623, 31627 do
			local playerTile = Tile(Position(32902, y, 14)):getTopCreature()
			if playerTile and playerTile:isPlayer() then
				playerTile:getPosition():sendMagicEffect(CONST_ME_POFF)
				playerTile:teleportTo(config.newPosition)
				playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
				playerTile:setExhaustion(Storage.ForgottenKnowledge.LadyTenebrisTimer, 20 * 60 * 60)
			end
		end
		for d = 1, 6 do
			Game.createMonster('shadow tentacle', Position(math.random(32909, 32914), math.random(31596, 31601), 14), true, true)
		end
		Game.createMonster("lady tenebris", config.BossPosition, true, true)
		Game.setStorageValue(GlobalStorage.ForgottenKnowledge.TenebrisTimer, 1)
		addEvent(clearForgotten, 30 * 60 * 1000, Position(32895, 31584, 14), Position(32929, 31614, 14), Position(32925, 31617, 14), GlobalStorage.ForgottenKnowledge.TenebrisTimer)
		item:transform(9826)
		elseif item.itemid == 9826 then
		item:transform(9825)
		else			
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait a while, recently someone challenge Lady Tenebris.")
			return true
		end
	end
	return true
end

 

 

GustavaoTibia

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 25/06/15Posts: 30Gênero: Masculino

também nada, sem erro no console sem mover alavanca