Ir para conteúdo
  • Cadastre-se

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


Ir para solução Resolvido por Mecianosz,

Posts Recomendados

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
  • Respostas 11
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

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:  

  • 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.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Estatísticas dos Fóruns

    96846
    Tópicos
    519606
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo