Ir para conteúdo

Featured Replies

Postado

Boa Tarde, tenho um script de quest porém quando aperta para entrar na quest da um erro na distro.

 

 

O script da quest.

Spoiler

local sto = 44487

function isOnSameFloor(fromPos, toPos)
    return fromPos.z == toPos.z and true or false
end

function isEven(arg)
    return arg % 2 == 0 and true or false
end

function getMiddlePos(fromPos, toPos)
    if not isOnSameFloor(fromPos, toPos) then
        return false
    end
    
    local middle = {x = 0, y = 0, z = 0}    
        middle.x = isEven(fromPos.x + toPos.x) and (fromPos.x + toPos.x)/2 or math.floor((fromPos.x + toPos.x)/2) + 1
        middle.y = isEven(fromPos.y + toPos.y) and (fromPos.y + toPos.y)/2 or math.floor((fromPos.y + toPos.y)/2) + 1
        middle.z = fromPos.z or toPos.z
    return middle
end

function getDistanceRadius(fromPos, toPos)
    if not isOnSameFloor(fromPos, toPos) then
        return false
    end
    
    local distance = getDistanceBetween(fromPos, toPos)
    return isEven(distance) and (distance/2) or math.floor(distance/2) + 1
end

function cleareArea1(middlePos, rangex, rangey)
    local final = {x=1030, y=1085, z=7} -- Posição onde será teleportado quando acabar o tempo
    
    for i = -rangex, rangex do
        for j = -rangey, rangey do
            pos = {x = middlePos.x + i, y = middlePos.y + j, z = middlePos.z}
            creature = getTopCreature(pos).uid
            
            if isMonster(creature) then
                doSendMagicEffect(getThingPos(creature), 14)
                doRemoveCreature(creature)
            elseif isPlayer(creature) then
                doSendMagicEffect(getThingPos(creature), 10)
                doTeleportThing(creature, final)
            end
        end
    end
    
    setGlobalStorageValue(sto, -1)
    return true
end
    
local t = {
    lvl = 150,
    lvl2 = 201,
    entrada = {
        {x = 1067, y = 1067, z = 9}, -- pos players
        {x = 1067, y = 1068, z = 9}, -- pos players
        {x = 1067, y = 1069, z = 9}, -- pos players
        {x = 1067, y = 1070, z = 9}, -- pos players
        {x = 1067, y = 1071, z = 9}, -- pos players
    },
    saida = {
        {x = 717, y = 1013, z = 9}, -- pos para onde eles irão
        {x = 717, y = 1013, z = 9}, -- pos para onde eles irão
        {x = 717, y = 1013, z = 9}, -- pos para onde eles irão
        {x = 717, y = 1013, z = 9}, -- pos para onde eles irão
        {x = 717, y = 1013, z = 9}, -- pos para onde eles irão
    },    
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local configure = {
        fromPos = {x=702, y=988, z=9}, -- posição superior esquerda do mapa, da area em que esta mapeado a area.
        toPos = {x=811, y=1025, z=9}, -- posição inferior direita do mapa, da area em que esta mapeado a area.
    }
    
    local config = {
        position = {x=1067, y=1066, z=9}, -- Contagem
        fromPosition = {x=1022, y=1024, z=9},
        toPosition = {x=1139, y=1134, z=9},
        id = 1498,
        time = 1
    }

    local time = 300
    local check = {}
    
    for _, k in ipairs(t.entrada) do
         local x = getTopCreature(k).uid  
            if getPlayerLevel(cid) <= 149 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você precisa estar entre os níveis 150 á 200 para poder entrar.")
            return true
        end

  for _, k in ipairs(t.entrada) do
         local x = getTopCreature(k).uid  
            if getPlayerLevel(cid) >= 201 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você precisa estar entre os níveis 150 á 200 para poder entrar.")
            return true
        end


   
             
            if getGlobalStorageValue(sto) == 1 then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde até que a sala seja liberada.")
                return true
            end
            
        table.insert(check, x)
    end
                                    
                    for i, tid in ipairs(check) do
                        doTeleportThing(tid, t.saida[i], false)
                        doSendMagicEffect(t.saida[i], 10)
                        doTransformItem(item.uid, item.itemid == 1810 and 1810 or 1810)
                    end
                    
            for i = 1,time do
                formula = time - 1*i
                addEvent(doSendAnimatedText, i*1000, config.position, formula, TEXTCOLOR_GREY)                
            end
    
    setGlobalStorageValue(sto, 1)
    local rx = getDistanceRadius(configure.fromPos, configure.toPos)
    addEvent(cleareArea1, config.time * 1800 * 1000, getMiddlePos(configure.fromPos, configure.toPos), rx, rx)
    return true
end
end

Erro apresentado.

Spoiler

[11/06/2020 16:24:43] [Error - Action Interface] 
[11/06/2020 16:24:43] data/actions/scripts/one/dungeons/dungeon150-200.lua:onUse
[11/06/2020 16:24:43] Description: 
[11/06/2020 16:24:43] (luaDoTeleportThing) Thing not found

[11/06/2020 16:24:43] [Error - Action Interface] 
[11/06/2020 16:24:43] data/actions/scripts/one/dungeons/dungeon150-200.lua:onUse
[11/06/2020 16:24:43] Description: 
[11/06/2020 16:24:43] (luaDoTeleportThing) Thing not found

[11/06/2020 16:24:43] [Error - Action Interface] 
[11/06/2020 16:24:43] data/actions/scripts/one/dungeons/dungeon150-200.lua:onUse
[11/06/2020 16:24:43] Description: 
[11/06/2020 16:24:43] (luaDoTeleportThing) Thing not found

[11/06/2020 16:24:43] [Error - Action Interface] 
[11/06/2020 16:24:43] data/actions/scripts/one/dungeons/dungeon150-200.lua:onUse
[11/06/2020 16:24:43] Description: 
[11/06/2020 16:24:44] (luaDoTeleportThing) Thing not found

 

 

Postado

Tenta esse 

Spoiler

function onUse(cid, item, frompos, item2, topos)
	
	local config = {
    
    storage = 90021, --Storage da Quest
	from = {x = 471, y = 146, z = 14}, -- coordenada do canto superior esquerdo da área.
	to = {x = 490, y = 173, z = 14}, -- coordenada do canto inferior direito da área.
	GroupPlayer = 1, -- quantos grupos poderão entrar na área ao mesmo tempo.
	pos1 = {x = 480, y = 168, z = 14}, -- para onde o jogador 1 será teleportado.
	pos2 = {x = 480, y = 169, z = 14}, -- para onde o jogador 2 será teleportado.
	pos3 = {x = 480, y = 170, z = 14}, -- para onde o jogador 3 será teleportado.
	pos4 = {x = 480, y = 171, z = 14}, -- para onde o jogador 4 será teleportado.
	
	player1 = getThingfromPos({x=492, y=64, z=13, stackpos=253}),
	player2 = getThingfromPos({x=492, y=65, z=13, stackpos=253}),
	player3 = getThingfromPos({x=492, y=66, z=13, stackpos=253}),
	player4 = getThingfromPos({x=492, y=67, z=13, stackpos=253}),
	
	nomeMonst1 = "Tenten",	----- nome do monstro que ira aparacer
	posmonster1 = {x = 475, y = 171, z = 14}, -- onde ira nascer o monstro.
	
	nomeMonst2 = "Rat",	----- nome do monstro que ira aparacer
	posmonster2 = {x = 475, y = 168, z = 14}, -- onde ira nascer o monstro.

	nomeMonst3 = "Cave Rat",	----- nome do monstro que ira aparacer
	posmonster3 = {x = 475, y = 164, z = 14}, -- onde ira nascer o monstro.
	
	nomeMonst4 = "Spider",	----- nome do monstro que ira aparacer
	posmonster4 = {x = 475, y = 163, z = 14}, -- onde ira nascer o monstro.
	
	nomeMonst5 = "Snake",	----- nome do monstro que ira aparacer
	posmonster5 = {x = 475, y = 162, z = 14}, -- onde ira nascer o monstro. 
    
	}
	
	
if getPlayerStorageValue(cid, storage) <= 0 then 
if config.player1.uid == 0 or config.player2.uid == 0 or config.player3.uid == 0 or config.player4.uid == 0 then 
doPlayerSendCancel(cid, "You need 4 Players to do this quest.")
return false
end

if getPlayerStorageValue(config.player1.uid,storage) == 1 or 
getPlayerStorageValue(config.player2.uid,storage) == 1 or 
getPlayerStorageValue(config.player3.uid,storage) == 1 or 
getPlayerStorageValue(config.player4.uid,storage) == 1 then 
doPlayerSendCancel(cid, "Someone in your group already did this quest.")
return false
end
	
	local function getPlayersInArea(left, right)
		local playersInArea = {}
		for _, cid in ipairs(getPlayersOnline()) do
			if isInRange(getThingPos(cid), left, right) then
				table.insert(playersInArea, cid)
			end
		end
	return playersInArea
	end
	
	if isPlayer(cid) then
	
		if table.getn(getPlayersInArea(config.from, config.to)) < config.GroupPlayer then

	
	for x = config.from.x, config.to.x do
	for y = config.from.y, config.to.y do
	for z = config.from.z, config.to.z do
local pos2 = {x = x, y = y, z = z, stackpos = 253}
local monsterTile = getThingfromPos(pos2).uid
				
if isMonster(monsterTile) then
doRemoveCreature(monsterTile)
end
end
end
end

doTeleportThing (config.player1.uid, config.pos1)
doTeleportThing (config.player2.uid, config.pos2)
doTeleportThing (config.player3.uid, config.pos3)
doTeleportThing (config.player4.uid, config.pos4)

			doCreateMonster(config.nomeMonst1,config.posmonster1)
			doCreateMonster(config.nomeMonst2,config.posmonster2)
			doCreateMonster(config.nomeMonst3,config.posmonster3)
			doCreateMonster(config.nomeMonst4,config.posmonster4)
			doCreateMonster(config.nomeMonst5,config.posmonster5)

		elseif table.getn(getPlayersInArea(config.from, config.to)) >= config.GroupPlayer then
			doPlayerSendCancel(cid, "Someone still inside this quest, wait him left.")
		end
	end

	else
	doPlayerSendCancel(cid, "You already did this quest.")
	end
end

 

 

Postado
  • Autor
Em 14/06/2020 em 09:58, Koetejiraya disse:

Tenta esse 

  Mostrar conteúdo oculto


function onUse(cid, item, frompos, item2, topos)
	
	local config = {
    
    storage = 90021, --Storage da Quest
	from = {x = 471, y = 146, z = 14}, -- coordenada do canto superior esquerdo da área.
	to = {x = 490, y = 173, z = 14}, -- coordenada do canto inferior direito da área.
	GroupPlayer = 1, -- quantos grupos poderão entrar na área ao mesmo tempo.
	pos1 = {x = 480, y = 168, z = 14}, -- para onde o jogador 1 será teleportado.
	pos2 = {x = 480, y = 169, z = 14}, -- para onde o jogador 2 será teleportado.
	pos3 = {x = 480, y = 170, z = 14}, -- para onde o jogador 3 será teleportado.
	pos4 = {x = 480, y = 171, z = 14}, -- para onde o jogador 4 será teleportado.
	
	player1 = getThingfromPos({x=492, y=64, z=13, stackpos=253}),
	player2 = getThingfromPos({x=492, y=65, z=13, stackpos=253}),
	player3 = getThingfromPos({x=492, y=66, z=13, stackpos=253}),
	player4 = getThingfromPos({x=492, y=67, z=13, stackpos=253}),
	
	nomeMonst1 = "Tenten",	----- nome do monstro que ira aparacer
	posmonster1 = {x = 475, y = 171, z = 14}, -- onde ira nascer o monstro.
	
	nomeMonst2 = "Rat",	----- nome do monstro que ira aparacer
	posmonster2 = {x = 475, y = 168, z = 14}, -- onde ira nascer o monstro.

	nomeMonst3 = "Cave Rat",	----- nome do monstro que ira aparacer
	posmonster3 = {x = 475, y = 164, z = 14}, -- onde ira nascer o monstro.
	
	nomeMonst4 = "Spider",	----- nome do monstro que ira aparacer
	posmonster4 = {x = 475, y = 163, z = 14}, -- onde ira nascer o monstro.
	
	nomeMonst5 = "Snake",	----- nome do monstro que ira aparacer
	posmonster5 = {x = 475, y = 162, z = 14}, -- onde ira nascer o monstro. 
    
	}
	
	
if getPlayerStorageValue(cid, storage) <= 0 then 
if config.player1.uid == 0 or config.player2.uid == 0 or config.player3.uid == 0 or config.player4.uid == 0 then 
doPlayerSendCancel(cid, "You need 4 Players to do this quest.")
return false
end

if getPlayerStorageValue(config.player1.uid,storage) == 1 or 
getPlayerStorageValue(config.player2.uid,storage) == 1 or 
getPlayerStorageValue(config.player3.uid,storage) == 1 or 
getPlayerStorageValue(config.player4.uid,storage) == 1 then 
doPlayerSendCancel(cid, "Someone in your group already did this quest.")
return false
end
	
	local function getPlayersInArea(left, right)
		local playersInArea = {}
		for _, cid in ipairs(getPlayersOnline()) do
			if isInRange(getThingPos(cid), left, right) then
				table.insert(playersInArea, cid)
			end
		end
	return playersInArea
	end
	
	if isPlayer(cid) then
	
		if table.getn(getPlayersInArea(config.from, config.to)) < config.GroupPlayer then

	
	for x = config.from.x, config.to.x do
	for y = config.from.y, config.to.y do
	for z = config.from.z, config.to.z do
local pos2 = {x = x, y = y, z = z, stackpos = 253}
local monsterTile = getThingfromPos(pos2).uid
				
if isMonster(monsterTile) then
doRemoveCreature(monsterTile)
end
end
end
end

doTeleportThing (config.player1.uid, config.pos1)
doTeleportThing (config.player2.uid, config.pos2)
doTeleportThing (config.player3.uid, config.pos3)
doTeleportThing (config.player4.uid, config.pos4)

			doCreateMonster(config.nomeMonst1,config.posmonster1)
			doCreateMonster(config.nomeMonst2,config.posmonster2)
			doCreateMonster(config.nomeMonst3,config.posmonster3)
			doCreateMonster(config.nomeMonst4,config.posmonster4)
			doCreateMonster(config.nomeMonst5,config.posmonster5)

		elseif table.getn(getPlayersInArea(config.from, config.to)) >= config.GroupPlayer then
			doPlayerSendCancel(cid, "Someone still inside this quest, wait him left.")
		end
	end

	else
	doPlayerSendCancel(cid, "You already did this quest.")
	end
end

 

 

Parceiro, esse seu script não tá completo como desejo o meu, o meu ele retira o palyer depois de um tempo da quest, não sumona nenhum boss, e ele checa se pode tem 1 ou 5 player, não é obrigatoriamente ter 5 player.

Postado

Ok, Vamos la. Seu código esta dando erro ao teleportar o jogador, seu script não o encontra. 

Voce esqueceu de acrescentar o stackpos no seu script. 

O player tem que ser declarado desta forma.

player = getThingfromPos({x=492, y=64, z=13, stackpos=253})

e o teleport desta forma

player = getThingfromPos({x=492, y=64, z=13, stackpos=253})
doTeleportThing (player.uid, pos) --pos (Posição para onde o player irá)

 

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 519.6k

Informação Importante

Confirmação de Termo