Ir para conteúdo
  • Cadastre-se

(Resolvido)[help] Door com Magic Wall: BUG


Ir para solução Resolvido por Mecianosz,

Posts Recomendados

Olá a todos! Estou com um bug nas doors do meu servidor: não consigo fechar uma porta quando tem MW na frente. O normal é você fechar a porta e quebrar a MW, ocupando o sqm onde ela estava. Mas no meu servidor eu não consigo quebrar a magic wall! Se não for na source, deve ser em actions/doors.lua ou em movements/closingdoor.lua, mas eu troquei esses scripts várias vezes e não corrigi o problema. Alguém pode me ajudar? Valeu!

 

Qual servidor ou website você utiliza como base? 

tfs 0.5 exclusive edition

 

Editado por Mecianosz (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Certifique-se de que a porta que está testando está registrada na tag XML do dito script.

 

 

 

Nós somos aquilo que fazemos repetidamente. Excelência, não é um modo de agir, mas um hábito.

                                                                                                                                                                                                                                        Aristóteles 

Link para o post
Compartilhar em outros sites
2 horas atrás, WooX disse:

Certifique-se de que a porta que está testando está registrada na tag XML do dito script.

@WooX a tag da door já estava em actions.xml (doors.lua) mas não estava no movements.xml (closingdoor.lua ). Porém, quando eu coloquei a tag da door no movements.xml , não corrigiu o problema da magic wall e ainda começou a dar outro bug: só de passar pela porta, ela se fecha sozinha. Deve ser outra coisa! Já tentei trocar os scripts.lua algumas vezes, mas nenhum está dando certo ... 

 

 

 

Editado por Mecianosz (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
2 horas atrás, Mecianosz disse:

@WooX a tag da door já estava em actions.xml (doors.lua) mas não estava no movements.xml (closingdoor.lua ). Porém, quando eu coloquei a tag da door no movements.xml , não corrigiu o problema da magic wall e ainda começou a dar outro bug: só de passar pela porta, ela se fecha sozinha. Deve ser outra coisa! Já tentei trocar os scripts.lua algumas vezes, mas nenhum está dando certo ... 

 

 

 

Ela não tem que estar no script do movements, este é exclusivamente para as portas que devem fechar sozinhas mesmo. Manda seu scripts doors.lua, o que fica em actions mesmo.

 

 

 

 

 

Nós somos aquilo que fazemos repetidamente. Excelência, não é um modo de agir, mas um hábito.

                                                                                                                                                                                                                                        Aristóteles 

Link para o post
Compartilhar em outros sites
39 minutos atrás, WooX disse:

Ela não tem que estar no script do movements, este é exclusivamente para as portas que devem fechar sozinhas mesmo. Manda seu scripts doors.lua, o que fica em actions mesmo.

 

 

doors.lua

Ta aí!

:)

 

Link para o post
Compartilhar em outros sites
4 minutos atrás, Mecianosz disse:

Posta como código.

 

 

 

Nós somos aquilo que fazemos repetidamente. Excelência, não é um modo de agir, mas um hábito.

                                                                                                                                                                                                                                        Aristóteles 

Link para o post
Compartilhar em outros sites
Agora, WooX disse:

Posta como código.

local config = {
	maxLevel = getConfigInfo('maximumDoorLevel')
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(fromPosition.x ~= CONTAINER_POSITION and isPlayerPzLocked(cid) and getTileInfo(fromPosition).protection) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		return true
	end

	local locked = DOORS[item.itemid]
	if(locked) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is locked.")
		return true
	end

	local door = getItemInfo(item.itemid)
	if(door.levelDoor > 0) then
		if(item.aid == 189) then
			if(not isPremium(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
				return true
			end

			doTeleportThing(cid, toPosition)
			return false
		end

		local gender = item.aid - 186
		if(isInArray({PLAYERSEX_FEMALE,  PLAYERSEX_MALE}, gender)) then
			if(gender ~= getPlayerSex(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
				return true
			end

			doTeleportThing(cid, toPosition)
			return false
		end

		local skull = item.aid - 180
		if(skull >= SKULL_NONE and skull <= SKULL_BLACK) then
			if(skull ~= getCreatureSkullType(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
				return true
			end

			doTeleportThing(cid, toPosition)
			return false
		end

		local group = item.aid - 150
		if(group >= 0 and group < 30) then
			if(group > getPlayerGroupId(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
				return true
			end

			doTeleportThing(cid, toPosition)
			return false
		end

		local vocation = item.aid - 100
		if(vocation >= 0 and vocation < 50) then
			local vocationEx = getVocationInfo(getPlayerVocation(cid))
			if(vocationEx.id ~= vocation and vocationEx.fromVocation ~= vocation) then
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
				return true
			end

			doTeleportThing(cid, toPosition)
			return false
		end

		if(item.aid == 190 or (item.aid >= 1000 and (item.aid - door.levelDoor) <= config.maxLevel and getPlayerLevel(cid) >= (item.aid - door.levelDoor))) then
			doTeleportThing(cid, toPosition)
			return false
		end

		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
		return true
	end

	if(door.specialDoor) then
		if(item.aid == 100 or (item.aid ~= 0 and getCreatureStorage(cid, item.aid) ~= EMPTY_STORAGE)) then
			doTeleportThing(cid, toPosition)
			return false
		end

		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.")
		return true
	end

	if(getTileInfo(toPosition).creatures > 0) then -- check only if there are any creatures
		local position = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = STACKPOS_TOP_CREATURE}
		position.x = position.x + 1

		local query = doTileQueryAdd(cid, position, 20)
		if(query == RETURNVALUE_NOTPOSSIBLE) then
			position.x = position.x - 1
			position.y = position.y + 1
			query = doTileQueryAdd(cid, position, 20)
		end

		if(query ~= RETURNVALUE_NOERROR) then
			doPlayerSendDefaultCancel(cid, query)
			return true
		end

		toPosition.stackpos = STACKPOS_TOP_CREATURE
		while(true) do
			local thing = getThingFromPosition(toPosition)
			if(thing.uid == 0) then
				break
			end

			doTeleportThing(thing.uid, position)
		end
	end

	local field = getTileItemByType(toPosition, ITEM_TYPE_MAGICFIELD)
	if(field.uid ~= 0) then
		doRemoveItem(field.uid)
	end

	return door.closingDoor
end

@WooX

Link para o post
Compartilhar em outros sites

Não tenho um servidor TFS 0.5 pra testar aqui, mas tentarei ajudar, sou um pouco novato também ahuahuhaa

 

troque:


	local field = getTileItemByType(toPosition, ITEM_TYPE_MAGICFIELD)
	if(field.uid ~= 0) then
		doRemoveItem(field.uid)
	end

	return door.closingDoor
end

por:


	local field = getTileItemByType(toPosition, ITEM_TYPE_MAGICFIELD)
	if(field.uid ~= 0) then
		doRemoveItem(field.uid)
	end

	return true
end

 

Link para o post
Compartilhar em outros sites
11 horas atrás, Mirajane Sitri disse:

Não tenho um servidor TFS 0.5 pra testar aqui, mas tentarei ajudar, sou um pouco novato também ahuahuhaa

 

troque:



	local field = getTileItemByType(toPosition, ITEM_TYPE_MAGICFIELD)
	if(field.uid ~= 0) then
		doRemoveItem(field.uid)
	end

	return door.closingDoor
end

por:



	local field = getTileItemByType(toPosition, ITEM_TYPE_MAGICFIELD)
	if(field.uid ~= 0) then
		doRemoveItem(field.uid)
	end

	return true
end

 

Não corrigiu o caso da magic wall e agora a porta não fecha , rs.. Mas obrigado pela tentativa!

Link para o post
Compartilhar em outros sites
7 horas atrás, Mecianosz disse:

Não corrigiu o caso da magic wall e agora a porta não fecha , rs.. Mas obrigado pela tentativa!

Hmm.. Tente trocar:


	local field = getTileItemByType(toPosition, ITEM_TYPE_MAGICFIELD)
	if(field.uid ~= 1) then
		doRemoveItem(field.uid)
	end

	return door.closingDoor
end

 

Link para o post
Compartilhar em outros sites
32 minutos atrás, Mirajane Sitri disse:

Hmm.. Tente trocar:



	local field = getTileItemByType(toPosition, ITEM_TYPE_MAGICFIELD)
	if(field.uid ~= 1) then
		doRemoveItem(field.uid)
	end

	return door.closingDoor
end

 

continua não fechando as portas '-'.. voltei para o original e as portas voltaram a fechar, mas ainda não quebra a mw

	local field = getTileItemByType(toPosition, ITEM_TYPE_MAGICFIELD)
	if(field.uid ~= 0) then
		doRemoveItem(field.uid)
	end

	return door.closingDoor
end

 

Link para o post
Compartilhar em outros sites
  • Solução
Em 29/07/2020 em 11:37, Mecianosz disse:

Olá a todos! Estou com um bug nas doors do meu servidor: não consigo fechar uma porta quando tem MW na frente. O normal é você fechar a porta e quebrar a MW, ocupando o sqm onde ela estava. Mas no meu servidor eu não consigo quebrar a magic wall! Se não for na source, deve ser em actions/doors.lua ou em movements/closingdoor.lua, mas eu troquei esses scripts várias vezes e não corrigi o problema. Alguém pode me ajudar? Valeu!

 

Qual servidor ou website você utiliza como base? 

tfs 0.5 exclusive edition

 

A solução não era tão simples, por isso ninguém conseguiu. Com a ajuda de meu amigo Nord, refizemos grande parte do doors.lua. A quem possa interessar:

Citar

local config = {
    maxLevel = getConfigInfo('maximumDoorLevel')
}

local horizontalDoors = {1214, 1222, 1226, 1230, 1236, 1240, 1244, 1248, 1254, 1258, 1262, 1542, 3537, 3539, 3541, 3543, 4918, 5085, 5100, 5102, 5104, 5106, 5118, 5120, 5122, 5124, 5136, 5139, 5280, 5287, 5291, 5295, 5518, 5734, 5746, 6197, 6201, 6205, 6209, 6254, 6258, 6262, 6266, 6796, 6800, 6893, 6895, 6897, 6899, 7035, 7037, 7039, 7041, 7057, 8546, 8550, 8554, 8558, 9170, 9174, 9272, 9276, 9280, 9284, 10273, 10277, 10281, 10285, 10470, 10472, 10476, 10474, 10777, 12094, 12190, 10781, 12096, 12196, 10783, 12098, 12194}
local magicWallIds = {1497, 1499}

local function removeMwall(toPosition)
    for _, id in ipairs(magicWallIds) do
        local item = getTileItemById(toPosition, id)
        if (item.uid ~= 0) then
            doRemoveItem(item.uid)
        end
    end
end

local function teleportFromDoor(cid, toPosition)
    removeMwall(toPosition)
    doTeleportThing(cid, toPosition)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(fromPosition.x ~= CONTAINER_POSITION and isPlayerPzLocked(cid) and getTileInfo(fromPosition).protection) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        return true
    end

    local locked = DOORS[item.itemid]
    if(locked) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is locked.")
        return true
    end

    local door = getItemInfo(item.itemid)
    if(door.levelDoor > 0) then
        if(item.aid == 189) then
            if(not isPremium(cid)) then
                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
                return true
            end

            teleportFromDoor(cid, toPosition)
            return false
        end

        local gender = item.aid - 186
        if(isInArray({PLAYERSEX_FEMALE,  PLAYERSEX_MALE}, gender)) then
            if(gender ~= getPlayerSex(cid)) then
                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
                return true
            end

            teleportFromDoor(cid, toPosition)
            return false
        end

        local skull = item.aid - 180
        if(skull >= SKULL_NONE and skull <= SKULL_BLACK) then
            if(skull ~= getCreatureSkullType(cid)) then
                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
                return true
            end

            teleportFromDoor(cid, toPosition)
            return false
        end

        local group = item.aid - 150
        if(group >= 0 and group < 30) then
            if(group > getPlayerGroupId(cid)) then
                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
                return true
            end

            teleportFromDoor(cid, toPosition)
            return false
        end

        local vocation = item.aid - 100
        if(vocation >= 0 and vocation < 50) then
            local vocationEx = getVocationInfo(getPlayerVocation(cid))
            if(vocationEx.id ~= vocation and vocationEx.fromVocation ~= vocation) then
                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
                return true
            end

            teleportFromDoor(cid, toPosition)
            return false
        end

        if(item.aid == 190 or (item.aid >= 1000 and (item.aid - door.levelDoor) <= config.maxLevel and getPlayerLevel(cid) >= (item.aid - door.levelDoor))) then
            teleportFromDoor(cid, toPosition)
            return false
        end

        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
        return true
    end

    if(door.specialDoor) then
        if(item.aid == 100 or (item.aid ~= 0 and getCreatureStorage(cid, item.aid) ~= EMPTY_STORAGE)) then
            teleportFromDoor(cid, toPosition)
            return false
        end

        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.")
        return true
    end

    if(getTileInfo(toPosition).creatures > 0) then -- check only if there are any creatures
        local position = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = STACKPOS_TOP_CREATURE}
        if isInArray(horizontalDoors, item.itemid) then
            position.y = position.y + 1
        else
            position.x = position.x + 1
        end
        removeMwall(position)

        local query = doTileQueryAdd(cid, position, 20)
        if(query == RETURNVALUE_NOTPOSSIBLE) then
            position.x = position.x - 1
            position.y = position.y + 1
            query = doTileQueryAdd(cid, position, 20)
        end

        if(query ~= RETURNVALUE_NOERROR) then
            doPlayerSendDefaultCancel(cid, query)
            return true
        end

        toPosition.stackpos = STACKPOS_TOP_CREATURE
        while(true) do
            local thing = getThingFromPosition(toPosition)
            if(thing.uid == 0) then
                break
            end

            teleportFromDoor(thing.uid, position)
        end
    end

    local field = getTileItemByType(toPosition, ITEM_TYPE_MAGICFIELD)
    if(field.uid ~= 0) then
        doRemoveItem(field.uid)
    end

    return door.closingDoor
end
 

 

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo