Ir para conteúdo

Featured Replies

Postado

 

 

Bom dia galera do TibiaKing.
estou aqui para pedir a voces uma ajuda no meu Warcastle 24hrs
estou usando esse:

 

mais estou precisando de algumas alterações nas scripts e eu não faço ideia por onde começar..
então vamos lá:


o comando !gocastle usar em qualquer andar do castelo pq aqui só usa no andar 7 e o castelo que fiz tem + 4 andares (total =5 andares)

{{x = 1207, y = 1508, z = 7}, {x = 1265, y = 1576, z = 7}}
 

 

Spoiler

-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.

-- //

COH_PUSHTIME = 10800 -- Tempo (em segundos) de exhausted para usar o comando !gocastle - Padrão (3 horas)
COH_AREA = {{x = 1207, y = 1508, z = 7}, {x = 1265, y = 1576, z = 7}} -- Canto superior esquerdo / inferior direito do Castle

-- // Não mexa daqui para baixo
COH_STATUS = 201320111714
COH_PREPARE1 = 201320111715
COH_PUSHSTOR = 201320111716
COH_PREPARE2 = 201320111717

function doCastleRemoveEnemies()

 for index, creature in ipairs(getPlayersOnline()) do
  if isInArea(getThingPos(creature), COH_AREA[1], COH_AREA[2]) then
   if getPlayerGuildName(creature) ~= getGlobalStorageValue(COH_STATUS) then
    doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature)))
   end
  end
 end
 return true
end


e eu estou fazendo umas areas exclusivas para a guild que vencer:
mais queria que só quem e da guild vencedora ficasse no lugar!  e se os playes espertinhos tiver caçando no lugar ou deslogar no lugar na hora que ele logar ele e direcionado para o templo

me ajudem porfavor
agradeço desde ja!


valendo REPP +

 

 

 

 

Editado por Leomonti
Consegui arrumar o Bug do 015 (veja o histórico de edições)

Resolvido por Dwarfer

Ir para solução
  • Respostas 6
  • Visualizações 549
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • No arquivo da lib adicione a função:      A talkaction fica assim:     Você configura a área na lib:    COH_AREA = {{x=1,y=1,z=6}, {x=1,y=1,z=7}} -- canto su

  • Sim

  • Edita as posições como eu mostrei lá, que vai funcionar. Agora que vi o que você fez, só tinha olhado para a função. Não são variás linhas para a COH_AREA, é somente uma linha com as posições dos anda

Postado
  • Solução

No arquivo da lib adicione a função: 

 

Spoiler

function getAllPlayersInArea(fromPosition, toPosition)
    local players = {}
    for _, pid in ipairs(getPlayersOnline()) do
        local f = {x = fromPosition.x, y = fromPosition.y, z = fromPosition.z}
        local t = {x = toPosition.x, y = toPosition.y, z = toPosition.z}
        local min = (fromPosition.z > toPosition.z and toPosition.z or fromPosition.z)
        for index = 0, math.abs(toPosition.z - fromPosition.z) do
            f.z = min + index
            t.z = min + index
            if isInRange(getPlayerPosition(pid), f, t) then
                table.insert(players, pid)
            end
        end    
    end
    return players
end

 

 

A talkaction fica assim:

 

Spoiler

function onSay(cid, words, param)
    local players = getAllPlayersInArea(COH_AREA[1], COH_AREA[2])
    if (not isInArray(players, cid)) then
        return doPlayerSendCancel(cid, "[CoH] Você deve estar no castelo.")
    end

    if getPlayerGuildLevel(cid) == GUILDLEVEL_LEADER then
        if getPlayerStorageValue(cid, COH_PUSHSTOR) < os.time() then
            if getGlobalStorageValue(COH_STATUS) == getPlayerGuildName(cid) then
                if #getMembersOnline(getPlayerGuildId(cid)) > 0 then
                    for index, creature in ipairs(getMembersOnline(getPlayerGuildId(cid))) do
                        if (getTileInfo(getThingPos(creature)).protection ~= true) then
                            return doPlayerSendCancel(cid, "[CoH] Os membros devem estar em área PZ.")
                        end
                        doTeleportThing(creature, getThingPos(cid))
                    end
                    setPlayerStorageValue(cid, COH_PUSHSTOR, os.time() + COH_PUSHTIME) 
                    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "[Castle of Honor] Você teleportou seus membros, comando pode ser usado a cada "..tostring(COH_PUSHTIME / 60).." minuto(s).")
                else
                    doPlayerSendCancel(cid, "[CoH] Para executar isso, sua guild deve ter 2 ou mais membros online.") 
                end
            else
                doPlayerSendCancel(cid, "[CoH] Sua guild não é dona do castelo.")
            end
        else
            doPlayerSendCancel(cid, "[CoH] Você deve aguardar "..tostring(math.ceil((getPlayerStorageValue(cid, COH_PUSHSTOR) - os.time()) / 60)).." minuto(s) para usar este comando.")
        end
    else
        doPlayerSendCancel(cid, "[CoH] Você deve ser líder de uma guild para executar este comando.")
    end
return true
end

function getMembersOnline(id)
 local mbr = {}

 for index, creature in ipairs(getPlayersOnline()) do
  if getPlayerGuildId(creature) == id then
   if getCreatureSkullType(creature) < 3 then
    table.insert(mbr, creature)
   end
  end                      
 end
 return mbr or #mbr
end

 

 

Você configura a área na lib: 

 

COH_AREA = {{x=1,y=1,z=6}, {x=1,y=1,z=7}} -- canto superior esquerdo, canto inferior direito da área (com os respectivos valores de z se os andares forem diferentes)

 

Para o player que logar dentro da área voltar no templo, crie um arquivo em creaturescripts/scripts:

 

 

Spoiler

local exclusive_areas = {
[1] = {{x=1,y=1,z=6}, {x=1,y=1,z=7}}, 
[2] = {{x=1,y=1,z=5}, {x=1,y=1,z=8}},
[3] = {{x=1,y=1,z=6}, {x=1,y=1,z=7}}
}

function onLogin(cid)
    for i, v in pairs(exclusive_areas) do
        local players = getAllPlayersInArea(v[1], v[2])
        if isInArray(players, cid) and (getGlobalStorageValue(COH_STATUS) ~= getPlayerGuildName(cid)) then
            doTeleportThing(cid, getPlayerMasterPos(cid))
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You were removed from exclusive area.")
            break
        end
    end
return true
end

 

 

Em creaturescripts.xml, adicione a tag:  <event type="login" name="RemoveExclusive" event="script" value="NOMEDOSEUARQUIVO.lua"/>

 

Para impedir a passagem de algum player da guild perdedora em algum tile, crie um arquivo em movements/scripts:

 

Spoiler

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local winner = getGlobalStorageValue(COH_STATUS)
if (winner ~= getPlayerGuildName(cid)) then
    doPlayerSendCancel(cid, "You are not a member of ".. winner .. " guild.")
    doTeleportThing(cid, fromPosition)
end
return true
end

 

 

Em movements.xml, adicione a tag: <movevent type="StepIn" actionid="ACTION_ID_DO_PISO" event="script" value="NOMEDOSEUARQUIVO.lua"/>

 

 

Contato:

 

Postado
  • Autor

muito obrigado cara! fiz uma area so pra teste pq ainda nao terminei as hunt ..perfeito script! do jeito que eu queria

so nao intendi direito o Lib ...ele tem que ficar assim entao?
 

Spoiler

-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.

-- //

COH_PUSHTIME = 10800 -- Tempo (em segundos) de exhausted para usar o comando !gocastle - Padrão (3 horas)
COH_AREA = {{x = 1207, y = 1508, z = 7}, {x = 1265, y = 1576, z = 7}} -- Canto superior esquerdo / inferior direito do Castle
COH_AREA = {{x = 1207, y = 1508, z = 6}, {x = 1265, y = 1576, z = 6}} -- Canto superior esquerdo / inferior direito do Castle
COH_AREA = {{x = 1207, y = 1508, z = 5}, {x = 1265, y = 1576, z = 5}} -- Canto superior esquerdo / inferior direito do Castle
COH_AREA = {{x = 1207, y = 1508, z = 4}, {x = 1265, y = 1576, z = 4}} -- Canto superior esquerdo / inferior direito do Castle
COH_AREA = {{x = 1207, y = 1508, z = 3}, {x = 1265, y = 1576, z = 3}} -- Canto superior esquerdo / inferior direito do Castle

-- // Não mexa daqui para baixo
COH_STATUS = 201320111714
COH_PREPARE1 = 201320111715
COH_PUSHSTOR = 201320111716
COH_PREPARE2 = 201320111717

function doCastleRemoveEnemies()

 for index, creature in ipairs(getPlayersOnline()) do
  if isInArea(getThingPos(creature), COH_AREA[1], COH_AREA[2]) then
   if getPlayerGuildName(creature) ~= getGlobalStorageValue(COH_STATUS) then
    doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature)))
   end
  end
 end
 return true
end

function getAllPlayersInArea(fromPosition, toPosition)
    local players = {}
    for _, pid in ipairs(getPlayersOnline()) do
        local f = {x = fromPosition.x, y = fromPosition.y, z = fromPosition.z}
        local t = {x = toPosition.x, y = toPosition.y, z = toPosition.z}
        local min = (fromPosition.z > toPosition.z and toPosition.z or fromPosition.z)
        for index = 0, math.abs(toPosition.z - fromPosition.z) do
            f.z = min + index
            t.z = min + index
            if isInRange(getPlayerPosition(pid), f, t) then
                table.insert(players, pid)
            end
        end    
    end
    return players
end

 

 

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

Postado
  • Autor
Agora, Dwarfer disse:

Sim

entao! ta assim e e eu só consigo usar no andar 3 no caso !

a area exclusiva eu testei sem guild e funcionou ! e agora eu testei sendo da guild e mesmo assim me mando pro templo

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo