Ir para conteúdo
  • Cadastre-se

Scripting Defend The Towers ( Ajuda BUG no DoRemoveCreature/Item )


Posts Recomendados

.Qual servidor ou website você utiliza como base? 

OTX 2.6

Qual o motivo deste tópico? 

Meu evento "Defend The Towers" aparentemente funcionando porém apresenta erro na distro quando inicia, na função DoRemoveItem e DoRemoveCreature dizendo que nenhum dos dois existem... "not found"

Está surgindo algum erro? Se sim coloque-o aqui. 

Citar

-- This script is part of Defend the Towers
-- Copyright (C) 2016 ChaitoSoft
--
-- 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/>.

dtt = {
    pos = {
        temple_wait = {x=438, y=1138, z=7}, -- sala de espera
        tp_create = {x=36, y=151, z=7}, -- onde teleport de entrada sera criado
    },

    --Configurações de abertura
    days_open = {1, 2, 3, 4, 5, 6, 7}, -- dias de semana que vai abrir
    min_players = 1, -- numero minimo de jogadores em cada time
    min_level = 200, -- level minimo permitido para entrar no evento
    wait_time = 3, -- tempo de espera para iniciar o evento, em minutos
    block_mc = false, -- false para permitir mcs no evento

    --Configuraçõe gerais
    delay_time = 10, -- tempo em segundos de delay ao morrer
    townid = {init = 1, blue = 3, red = 4}, -- init = templo da cidade, blue = templo do time azul, red = templo do time vermelho

    --Configurações dos premios
    reward_items = {6527, 6527},
    bonus_time = 240, -- experiencia bonus em minutos
    bonus_rate = 1, -- porcentagem de experiencia bonus: 1 = 100% | 0.3 = 30%

    --Configuração dos monstros
    monster = {
        pos = {
               --Monstros do time azul
            a1 = {x=396, y=1138, z=6, stackpos=253}, -- Blue supreme tower
            a2 = {x=429, y=1107, z=6, stackpos=253}, -- Blue top tower
            a3 = {x=430, y=1135, z=6, stackpos=253}, -- Blue middle tower
            a4 = {x=429, y=1167, z=6, stackpos=253}, -- Blue bottom tower
            -- Monstros do time vermelho
            b1 = {x=477, y=1138, z=6, stackpos=253}, -- Red supreme tower
            b2 = {x=447, y=1107, z=6, stackpos=253}, -- Red top tower
            b3 = {x=445, y=1139, z=6, stackpos=253}, -- Red middle tower
            b4 = {x=447, y=1167, z=6, stackpos=253}, -- Red bottom tower
            -- Monstros buff na jungle
               mbuff1 = {x=440, y=1122, z=6, stackpos=253}, -- Buff sorecer and paladin 1 + 2
            mbuff2 = {x=434, y=1155, z=6, stackpos=253}, -- Buff druid and knight 2 + 2
        },
        ---------------------------------------------------
        --NÃO MEXA DAQUI PRA BAIXO -----
        ------------------------------------------------
        name = {
            -- Azul
               a1 = "blue supreme tower", -- Base Tower
            a2 = "blue top tower", -- Top lane
            a3 = "blue middle tower", -- Middle lane
            a4 = "blue bottom tower", -- Bottom lane
            -- Vermelho
            b1 = "red supreme tower", -- Base Tower
            b2 = "red top tower", -- Top lane
            b3 = "red middle tower", -- Middle lane
            b4 = "red bottom tower", -- Bottom lane

            --Monstros Buff
            buff1 = "serpent of jungle",
            buff2 = "spider of jungle",
        },
    },

    --Storages alocadas
    storage = {
        win = 87771, -- GLOBAL STORAGE VENCEDOR
        kill_blue = 87775, -- GLobal storage frags team blue
        kill_red = 87776, -- GLobal storage frags team red
        tower_blue = 87777, -- GLobal storage towers team blue
        tower_red = 87778, -- GLobal storage towers team red
        team_blue = 9998, -- PLAYER STORAGE TIME A
        team_red = 9999, -- PLAYER STORAGE TIME A
        buffvoc1 = 7001, -- PLAYER STORAGE BUFF
        buffvoc2 = 7002, -- PLAYER STORAGE BUFF
        buffvoc3 = 7003, -- PLAYER STORAGE BUFF
        buffvoc4 = 7004, -- PLAYER STORAGE BUFF
        exp_bonus = 7005, --PLAYER STORAGE EXP BONUS
        delay = 7006, --PLAYER STORAGE DELAY
    },

    msg = {
        win_team_blue = "[Defend The Tower] O time azul acabou de derrotar a Suprema Torre Vermelha e vencer o evento.",
        win_team_red = "[Defend The Tower] O time vermelho acabou de derrotar a Suprema Torre Azul e vencer o evento. ",
        reward = "[Defend The Tower] Seu time Venceu, voce recebeu como premio o dobro de experiencia por 4 horas automaticamente e 80 event coins, desejamos parabens.",
        no_reward = "[Defend The Tower] Derrota, confira as estatisticas da partida no site, desejamos mais sorte na proxima.",
        warning = "[Defend The Tower] Acabou de abrir, acesse o teleporte do templo principal para participar. Inicia em minutos...",
        start = "[Defend The Tower] Fechou o teleporte de entrada e iniciou o evento boa sorte aos times.",
        cancel = "[Defend The Tower] Fechou o teleporte de entrada e cancelou o evento por falta de jogadores.",
        outfit = "[Defend The Tower] Voce nao pode trocar de outfit durante o evento.",
    },
}

local conditionBlue = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditionBlue, {lookType = 128, lookHead = 86, lookBody = 86, lookLegs = 86, lookFeet = 86})
local conditionRed = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditionRed, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditionRed, {lookType = 128, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})


--Metodos set
function dtt.setDelay(cid)
    doPlayerSetStorageValue(cid, dtt.storage.delay, os.time()+(60*dtt.delay_time))
    return true
end

function dtt.setBuff(storTeam, voc1, voc2)
    local storBuff1
    local storBuff2
    if (voc1 == 1) and (voc2 == 3) then
        storBuff1 = dtt.storage.buffvoc1
        storBuff2 = dtt.storage.buffvoc3
    end
    if (voc1 == 2) and (voc2 == 4) then
        storBuff1 = dtt.storage.buffvoc2
        storBuff2 = dtt.storage.buffvoc4
    end
    for _, index in ipairs(dtt.getPlayersInEvent()) do
        if getPlayerStorageValue(index.pid, storTeam) == 1 then
            if (isInArray({voc1, (voc1+4), (voc1+8)}, getPlayerVocation(index.pid))) then    
                doPlayerSetStorageValue(index.pid, storBuff1, 1)
            end
            if (isInArray({voc2, (voc2+4), (voc2+8)}, getPlayerVocation(index.pid))) then  
                doPlayerSetStorageValue(index.pid, storBuff2, 1)
            end
        end
    end
    return true
end

function dtt.setBonusExp(cid)
    doPlayerSetStorageValue(cid, dtt.storage.exp_bonus, os.time()+(60*dtt.bonus_time))
    return true
end

function dtt.setTeam()
    local tmp = 1
    local result = db.getResult("SELECT * FROM `dtt_players`;")
    if result:getID() ~= -1 then
        repeat
            pid = tonumber(result:getDataInt("pid"))
            if(tmp % 2 == 0) then
                db.query("UPDATE `dtt_players` SET `team` = '0' WHERE `pid` = "..pid..";")
                tmp = (tmp+1)
            else
                db.query("UPDATE `dtt_players` SET `team` = '1' WHERE `pid` = "..pid..";")
                tmp = (tmp+1)
            end
        until(not result:next())
    end
    result:free()
end

--Metodos GET
function dtt.getPlayersInEvent()
    local result = db.getResult("SELECT * FROM `dtt_players`;")
    CACHE_PLAYERS = {}
    if result:getID() ~= -1 then
        repeat
            pid  = tonumber(result:getDataInt("pid"))
            team  = tonumber(result:getDataInt("team")) -- 0 = blue, 1 = red
            ip  = tonumber(result:getDataInt("ip"))
            table.insert(CACHE_PLAYERS, {["pid"]=pid,["team"]=team,["ip"]=ip })
        until(not result:next())
        result:free()
        return CACHE_PLAYERS
    end
    return false
end


function dtt.getDelay(cid)
    local statsDelay = getPlayerStorageValue(cid, dtt.storage.delay)
    if (statsDelay - os.time() > 0) then
        local delay = 0
        local times = dtt.delay_time
        doCreatureSetNoMove(cid, true)
        for i = times, 0, -1 do
            if isPlayer(cid) then
                addEvent(doPlayerSendCancel, delay, cid, "[Defend The Tower] Volte para a arena em "..i..".")
            end
            delay = 2000 + delay                 
            if (i == 0) and (isPlayer(cid)) then
                addEvent(dtt.enableMove, (delay+1000), cid)
            end
         end
    else
        return false
    end
    return true
end

function dtt.getBonusExp(cid)
    local statsBonus = getPlayerStorageValue(cid, dtt.storage.exp_bonus)
    return statsBonus - os.time() > 0
end

--Outros métodos

function dtt.enableMove(cid)
    doCreatureSetNoMove(cid, false)
    doPlayerSendCancel(cid, "[Defend The Tower] GO GO GO! seu time o aguarda.")         
    setPlayerStorageValue(cid, dtt.storage.delay, 0)
    return true
end

function dtt.resetGlobalStorages()
    setGlobalStorageValue(dtt.storage.win, -1)
    setGlobalStorageValue(dtt.storage.kill_blue, 0)
    setGlobalStorageValue(dtt.storage.kill_red, 0)
    setGlobalStorageValue(dtt.storage.tower_blue, 0)
    setGlobalStorageValue(dtt.storage.tower_red, 0)
    print("[Defend The Tower] Todos os globais storages foram resetados...")
    return true
end

function dtt.resetPlayerStorages()
    if dtt.getPlayersInEvent() then
        for _, index in ipairs(dtt.getPlayersInEvent()) do
            doPlayerSetStorageValue(index.pid, dtt.storage.team_blue, 0)
            doPlayerSetStorageValue(index.pid, dtt.storage.team_red, 0)
            doPlayerSetStorageValue(index.pid, dtt.storage.buffvoc1, 0)
            doPlayerSetStorageValue(index.pid, dtt.storage.buffvoc2, 0)
            doPlayerSetStorageValue(index.pid, dtt.storage.buffvoc3, 0)
            doPlayerSetStorageValue(index.pid, dtt.storage.buffvoc4, 0)
        end
        print("[Defend The Tower] Todos os players storages foram resetados...")  
        return true
    else
        print("[Defend The Tower] Tabela vazia...")  
    end
    return true
end

function dtt.createMonsters()
    doSummonCreature(dtt.monster.name.a1, dtt.monster.pos.a1)
    doSummonCreature(dtt.monster.name.a2, dtt.monster.pos.a2)
    doSummonCreature(dtt.monster.name.a3, dtt.monster.pos.a3)
    doSummonCreature(dtt.monster.name.a4, dtt.monster.pos.a4)
    doSummonCreature(dtt.monster.name.b1, dtt.monster.pos.b1)
    doSummonCreature(dtt.monster.name.b2, dtt.monster.pos.b2)
    doSummonCreature(dtt.monster.name.b3, dtt.monster.pos.b3)
    doSummonCreature(dtt.monster.name.b4, dtt.monster.pos.b4)
    doSummonCreature(dtt.monster.name.buff1, dtt.monster.pos.mbuff1)
    doSummonCreature(dtt.monster.name.buff2, dtt.monster.pos.mbuff2)
    print("[Defend The Tower] Os monstros da arena battle foram sumonados...")  
    return true
end

function dtt.countPlayers()
    local result = db.getResult("SELECT * FROM `dtt_players`;")
    local qntPlayers = 0
    if result:getID() ~= -1 then
        repeat
            qntPlayers = (qntPlayers+1)
        until(not result:next())
    end
    return qntPlayers
end

function dtt.trucatePlayersInEvent()
    local result = db.getResult("SELECT * FROM `dtt_players`;")
    if result:getID() ~= -1 then
        db.query("TRUNCATE TABLE `dtt_players`;")  
        print("[Defend The Tower] Todos dados da tabela 'dtt_players' foram apagados...")
    end
    return true
end
        
-- FUNÇÕES PRINCIPAIS
-- ABERTURA DO EVENTO
function dtt.open()
    local time = os.date("*t")
    local timeopen1 = math.ceil(dtt.wait_time / 4)
    local timeopen2 = math.ceil(dtt.wait_time / 2)
    if (isInArray(dtt.days_open, time.wday)) then
    local tp = doCreateItem(1387, 1, dtt.pos.tp_create)
        doItemSetAttribute(tp, "aid", 9801)
        dtt.resetGlobalStorages()
        dtt.trucatePlayersInEvent()
        dtt.removeItemsTower()
        doBroadcastMessage(dtt.msg.warning)
        addEvent(doBroadcastMessage, timeopen1*1000*60, "[Defend The Tower] - Resta(m) ".. timeopen2 .." minuto(s) para iniciar o evento!")
        if (timeopen2 ~= timeopen1) then
            addEvent(doBroadcastMessage, timeopen2*1000*60, "[Defend The Tower] - Resta(m) ".. timeopen1 .." minuto(s) para iniciar o evento!")
        end
        addEvent(dtt.start, dtt.wait_time*1000*60,nil)
    end
    return true
end

-- COMEÇO DO EVENTO
function dtt.start()
    local tp = getTileItemById(dtt.pos.tp_create, 1387).uid
    doRemoveItem(tp)
    if (dtt.min_players <= dtt.countPlayers()) then
        dtt.createMonsters()
        dtt.sendPlayersToEvent()
        doBroadcastMessage(dtt.msg.start)
    else
        doBroadcastMessage(dtt.msg.cancel)
    end
    return true
end

-- FECHANDO O EVENTO
function dtt.close()
    for _, index in ipairs(dtt.getPlayersInEvent()) do
        doRemoveCondition(index.pid, CONDITION_OUTFIT)
        doRemoveCondition(index.pid, CONDITION_INFIGHT)
        doPlayerSetPzLocked(index.pid, false)
        if (getGlobalStorageValue(dtt.storage.win) == "blue") then
            if (index.team == 0) then
                doPlayerSetTown(index.pid, dtt.townid.init)   
                doTeleportThing(index.pid, getTownTemplePosition(dtt.townid.init))
                dtt.reward(index.pid)
            else
                doPlayerSetTown(index.pid, dtt.townid.init)   
                doTeleportThing(index.pid, getTownTemplePosition(dtt.townid.init))
                doPlayerSendTextMessage(index.pid, 25, dtt.msg.no_reward)
            end
        end
        if (getGlobalStorageValue(dtt.storage.win) == "red") then
            if (index.team == 1) then
                doPlayerSetTown(index.pid, dtt.townid.init)   
                doTeleportThing(index.pid, getTownTemplePosition(dtt.townid.init))
                dtt.reward(index.pid)
            else
                doPlayerSetTown(index.pid, dtt.townid.init)   
                doTeleportThing(index.pid, getTownTemplePosition(dtt.townid.init))
                doPlayerSendTextMessage(index.pid, 25, dtt.msg.no_reward)
            end
        end
    end
    --- limpando storage dos jogadores
    dtt.resetPlayerStorages()
    return true
end


function dtt.sendPlayersToEvent()
    dtt.setTeam()
    dtt.resetPlayerStorages()
    for _, index in ipairs(dtt.getPlayersInEvent()) do
        if (index.team == 0) then
            doAddCondition(index.pid, conditionBlue)
            doPlayerSetTown(index.pid, dtt.townid.blue)
            doTeleportThing(index.pid, getTownTemplePosition(dtt.townid.blue))
            doPlayerSetStorageValue(index.pid, dtt.storage.team_blue, 1)
        end
        if (index.team == 1) then
            doAddCondition(index.pid, conditionRed)
            doPlayerSetTown(index.pid, dtt.townid.red)
            doTeleportThing(index.pid, getTownTemplePosition(dtt.townid.red))
            doPlayerSetStorageValue(index.pid, dtt.storage.team_red, 1)
        end
    end    
    return true
end

function dtt.reward(pid)
    local random_item = dtt.reward_items[math.random(1, #dtt.reward_items)]
    doPlayerAddItem(pid, 6527, 80)
    dtt.setBonusExp(pid)
    doPlayerSendTextMessage(pid, 25, dtt.msg.reward)   
    return true
end

function dtt.removeItemsTower()
    if (getTileItemById(dtt.monster.pos.a2, 9596).uid) then
        doRemoveItem(getTileItemById(dtt.monster.pos.a2, 9596).uid)
        doRemoveItem(getTileItemById(dtt.monster.pos.a3, 9596).uid)
        doRemoveItem(getTileItemById(dtt.monster.pos.a4, 9596).uid)
        doRemoveItem(getTileItemById(dtt.monster.pos.b2, 9596).uid)
        doRemoveItem(getTileItemById(dtt.monster.pos.b3, 9596).uid)
        doRemoveItem(getTileItemById(dtt.monster.pos.b4, 9596).uid)
        print("[DEFEND THE TOWERS] Items torre limpos da arena de batalha...")
    else
        print("[DEFEND THE TOWERS] Nenhum item torre na arena de batalha...")
    end
    return true
end


function dtt.resultBattle()
    local frags_blue = getGlobalStorageValue(dtt.storage.kill_blue)
    local frags_red = getGlobalStorageValue(dtt.storage.kill_red)
    local towers_blue = getGlobalStorageValue(dtt.storage.tower_blue)
    local towers_red = getGlobalStorageValue(dtt.storage.tower_red)
    local hora = os.date("%X")
    local data = os.date("%x")
    db.query("INSERT INTO `dtt_results`  VALUES ('', ".. frags_blue ..  ",".. frags_red ..", ".. towers_blue ..", ".. towers_red ..", ".. db.escapeString(data) ..", ".. db.escapeString(hora) ..");")  
    return true
end

function dtt.warningAttack(cid, msg, storTeam)
    local lifePercent = 100 / (getCreatureMaxHealth(cid) / getCreatureHealth(cid))
    if (lifePercent <= 100) and (lifePercent >= 99.9) then
        for _, index in ipairs(dtt.getPlayersInEvent()) do
            if getPlayerStorageValue(index.pid, storTeam) == 1 then
                   doPlayerSendTextMessage(index.pid, 25, "[Defend The Tower] A torre "..msg.." esta sob ataque. Corra para defender!")  
               end
           end
    end
    if (lifePercent <= 50) and (lifePercent >= 49.9) then
        for _, index in ipairs(dtt.getPlayersInEvent()) do
            if getPlayerStorageValue(index.pid, storTeam) == 1 then
                   doPlayerSendTextMessage(index.pid, 25, "[Defend The Tower] A torre "..msg.." esta sob ataque. Corra para defender!")  
               end
           end
    end
    if (lifePercent <= 20) and (lifePercent >= 19.9) then
        for _, index in ipairs(dtt.getPlayersInEvent()) do
            if getPlayerStorageValue(index.pid, storTeam) == 1 then
                   doPlayerSendTextMessage(index.pid, 25, "[Defend The Tower] A torre "..msg.." esta sob ataque. Corra para defender!")  
               end
           end
    end
    return true
end

function dtt.removeMonsters()
    doRemoveCreature(getThingfromPos(dtt.monster.pos.a1).uid)
    doRemoveCreature(getThingfromPos(dtt.monster.pos.a2).uid)
    doRemoveCreature(getThingfromPos(dtt.monster.pos.a3).uid)
    doRemoveCreature(getThingfromPos(dtt.monster.pos.a4).uid)
    doRemoveCreature(getThingfromPos(dtt.monster.pos.b1).uid)
    doRemoveCreature(getThingfromPos(dtt.monster.pos.b2).uid)
    doRemoveCreature(getThingfromPos(dtt.monster.pos.b3).uid)
    doRemoveCreature(getThingfromPos(dtt.monster.pos.b4).uid)
    return true
end

function dtt.cleanPlayer(cid)
    doPlayerSetTown(cid, dtt.townid.init)   
    doTeleportThing(cid, getTownTemplePosition(dtt.townid.init))
    doPlayerSetStorageValue(cid, dtt.storage.team_blue, 0)
    doPlayerSetStorageValue(cid, dtt.storage.team_red, 0)
    doPlayerSetStorageValue(cid, dtt.storage.buffvoc1, 0)
    doPlayerSetStorageValue(cid, dtt.storage.buffvoc2, 0)
    doPlayerSetStorageValue(cid, dtt.storage.buffvoc3, 0)
    doPlayerSetStorageValue(cid, dtt.storage.buffvoc4, 0)
    return true
end

 

Você tem o código disponível? Se tiver publique-o aqui: 

 

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

 

Link para o post
Compartilhar em outros sites
  • 2 months later...
  • Moderador
Em 09/01/2022 em 19:55, kingdj22 disse:

.Qual servidor ou website você utiliza como base? 

OTX 2.6

Qual o motivo deste tópico? 

Meu evento "Defend The Towers" aparentemente funcionando porém apresenta erro na distro quando inicia, na função DoRemoveItem e DoRemoveCreature dizendo que nenhum dos dois existem... "not found"

Está surgindo algum erro? Se sim coloque-o aqui. 

 

Você tem o código disponível? Se tiver publique-o aqui: 


 

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

 



vi um post parecido com o seu, ve se isso resolve mano

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.


  • Conteúdo Similar

    • Por cloudrun2023
      CloudRun - Sua Melhor Escolha para Hospedagem de OTServer!
      Você está procurando a solução definitiva para hospedar seu OTServer com desempenho imbatível e segurança inigualável? Não procure mais! Apresentamos a CloudRun, sua parceira confiável em serviços de hospedagem na nuvem.
       
      Recursos Exclusivos - Proteção DDoS Avançada:
      Mantenha seu OTServer online e seguro com nossa robusta proteção DDoS, garantindo uma experiência de jogo ininterrupta para seus jogadores.
       
      Servidores Ryzen 7 Poderosos: Desfrute do poder de processamento superior dos servidores Ryzen 7 para garantir um desempenho excepcional do seu OTServer. Velocidade e estabilidade garantidas!
       
      Armazenamento NVMe de Alta Velocidade:
      Reduza o tempo de carregamento do jogo com nosso armazenamento NVMe ultrarrápido. Seus jogadores vão adorar a rapidez com que podem explorar o mundo do seu OTServer.
       
      Uplink de até 1GB:
      Oferecemos uma conexão de alta velocidade com até 1GB de largura de banda, garantindo uma experiência de jogo suave e livre de lag para todos os seus jogadores, mesmo nos momentos de pico.
       
      Suporte 24 Horas:
      Estamos sempre aqui para você! Nossa equipe de suporte está disponível 24 horas por dia, 7 dias por semana, para resolver qualquer problema ou responder a qualquer pergunta que você possa ter. Sua satisfação é a nossa prioridade.
       
      Fácil e Rápido de Começar:
      Configurar seu OTServer na CloudRun é simples e rápido. Concentre-se no desenvolvimento do seu jogo enquanto cuidamos da hospedagem.
       
      Entre em Contato Agora!
      Website: https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
      Email: [email protected]
      Telefone: (47) 99902-5147

      Não comprometa a qualidade da hospedagem do seu OTServer. Escolha a CloudRun e ofereça aos seus jogadores a melhor experiência de jogo possível. Visite nosso site hoje mesmo para conhecer nossos planos e começar!
       
      https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
       
      CloudRun - Onde a Velocidade Encontra a Confiabilidade!
       

    • Por FeeTads
      SALVE rapaziada do TK, esses dias vim pensando em novos scripts pro meu OT, e em um deles eu precisava que determinada area não contasse frag pro player que matasse outros, PORÉM eu precisava que os players que morressem nessa area ainda assim tivessem as penalidades da sua morte, procurei por ai, achei alguns scripts que apenas tiravam o SKULL e não realmente o FRAG do player.

      **script atualizado 22/10/2023** - melhorado e otimizado, levei o script pra puxar as infos por .lua / creatureScripts

      vou disponibilizar o code aqui, e o que fazer pra determinada area não contar frag.

      SOURCE OTX 2 / TFS 0.x, Funciona em TFS 1.x mudando as tags e ajeitando as sintaxes.

      vá em creatureevent.cpp

      procure por:
      else if(type == "preparedeath") _type = CREATURE_EVENT_PREPAREDEATH;
      Adiciona abaixo:
      else if(type == "nocountfrag") _type = CREATURE_EVENT_NOCOUNTFRAG;

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "onPrepareDeath";  
      Adicione abaixo: 
      case CREATURE_EVENT_NOCOUNTFRAG: return "noCountFragArea";

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "cid, deathList";
      Adicione abaixo:
      case CREATURE_EVENT_NOCOUNTFRAG: return "cid, target";

      agora no mesmo arquivo, vá até o final do arquivo e adicione essa função:
      uint32_t CreatureEvent::executeNoCountFragArea(Creature* creature, Creature* target) { //noCountFragArea(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::ostringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; if(m_scriptData) scriptstream << *m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::ostringstream desc; desc << creature->getName(); env->setEvent(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::noCountFragArea] Call stack overflow." << std::endl; return 0; } }

      agora vá em creatureevent.h

      procure por:
      CREATURE_EVENT_PREPAREDEATH
      adicione abaixo:
      CREATURE_EVENT_NOCOUNTFRAG

      procure por:
      uint32_t executePrepareDeath(Creature* creature, DeathList deathList);
      Adicione abaixo:
      uint32_t executeNoCountFragArea(Creature* creature, Creature* target);

      agora vá em player.cpp

      procure por:
      bool Player::onKilledCreature(Creature* target, DeathEntry& entry)
      abaixo de:
      War_t enemy; if(targetPlayer->getEnemy(this, enemy)) { if(entry.isLast()) IOGuild::getInstance()->updateWar(enemy); entry.setWar(enemy); }
      Adicione o seguinte código:
      if (targetPlayer){ CreatureEventList killEvents = getCreatureEvents(CREATURE_EVENT_NOCOUNTFRAG); for (const auto &event : killEvents) { if (!event->executeNoCountFragArea(this, target)) { return true; } } }

      //

      Feito isso, tudo completo na sua source, agora é necessário adicionar o creaturescript dentro do servidor

      vá até creaturescripts/scripts
      crie um arquivo chamado, "noCountFragInArea.lua"
      e dentro dele cole o código:
       
      --[[ script feito por feetads / TibiaKing ]]-- --[[ discord: feetads / FeeTads#0246 ]]-- -- Add positions here for which you do not want to count frags local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, -- from = area superior esquerda / to = area inferior direita (formando um quadrado) } local onlyKillerInArea = false -- only killer need to be in area? function noCountFragArea(cid, target) if not isCreature(cid) or not isCreature(target) then return true end local posKiller = getPlayerPosition(cid) local posTarget = getPlayerPosition(target) for i = 1, #areas do local area = areas[i] if isInArea(posKiller, area.from, area.to) then if onlyKillerInArea then return false elseif isInArea(posTarget, area.from, area.to) then return false end end end return true end
      agora em creaturescripts.xml
      <event type="nocountfrag" name="fragarea" event="script" value="noCountFragInArea.lua"/>
      agora em creaturescripts/scripts/login.lua
       procure por OU semelhante a esse:
      registerCreatureEvent(cid, "AdvanceSave")
      e abaixo adicione:
      registerCreatureEvent(cid, "fragarea")

      //


      Agora tudo certo, quando quiser adiciona uma area que não pega frag, vá até o script e apenas coloque a area, igual o demonstrado no script

      Exemplo:
      local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, [2] = {from = {x = 1000, y = 1000, z = 7}, to = {x = 1100, y = 1100, z = 7}}, }
      assim somente colocando a area no script e abrindo o server ou dando /reload, já funcionará a area como não pegar frag.
      Esse sistema pode ser bom pra areas de pvp ativo, onde você ainda quer que o player que morrer perca os atributos, como se fosse uma morte normal, porém não conta frag pra quem matar.
      Bom pra sistemas tipo castle 48h (guild war), onde há diversas mortes e risco de pegar red, atrapalhando a war.

      Façam bom proveito dos scripts, e deixem os créditos no script rsrs

      **Eu fiz as alterações e o simples código por isso vim disponibilizar, créditos meus**
    • Por Muvuka
      Abri canal a força creaturescript acho que funcione no creaturescript cria script creaturescript
       
      <channel id="9" name="HELP" logged="yes"/>
      <channel id="12" name="Report Bugs" logged="yes"/>
      <channel id="13" name="Loot" logged="yes"/>
      <channel id="14" name="Report Character Rules Tibia Rules" logged="yes"/>
      <channel id="15" name="Death Channel"/>
      <channel id="6548" name="DexSoft" level="1"/>
      <channel id="7" name="Reports" logged="yes"/>
       
      antes de 
              if(lastLogin > 0) then adicione isso:
                      doPlayerOpenChannel(cid, CHANNEL_HELP) doPlayerOpenChannel(cid, 1,  2, 3) = 1,2 ,3 Channels, entendeu? NÃO FUNCIONA EU QUERO UM MEIO DE ABRI SEM USA A SOURCE
       
      EU NÃO CONSEGUI ABRI EU NÃO TENHO SOURCE
       
       
    • Por bolachapancao
      Rapaziada seguinte preciso de um script que ao utilizar uma alavanca para até 4 jogadores.
      Os jogadores serão teleportados para hunt durante uma hora e depois de uma hora os jogadores serão teleportados de volta para o templo.
       
      Observação: caso o jogador morra ou saia da hunt o evento hunt é cancelado.

      Estou a base canary
      GitHub - opentibiabr/canary: Canary Server 13.x for OpenTibia community.
       
    • Por RAJADAO
      .Qual servidor ou website você utiliza como base? 
      Sabrehaven 8.0
      Qual o motivo deste tópico? 
      Ajuda com novos efeitos
       
      Olá amigos, gostaria de ajuda para introduzir os seguintes efeitos no meu servidor (usando o Sabrehaven 8.0 como base), adicionei algumas runas novas (avalanche, icicle, míssil sagrado, stoneshower & Thunderstorm) e alguns novos feitiços (exevo mas san, exori san, exori tera, exori frigo, exevo gran mas frigo, exevo gran mas tera, exevo tera hur, exevo frigo hur) mas nenhum dos efeitos dessas magias parece existir no servidor, alguém tem um link para um tutorial ou algo assim para que eu possa fazer isso funcionar?
      Desculpe pelo mau inglês, sou brasileiro.

      Obrigado!


      AVALANCHE RUNE id:3161 \/
      (COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

      STONESHOWER RUNE id:3175 \/
      (COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_STONES)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)

      THUNDERSTORM RUNE id:3202 \/
      (COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_E NERGYHIT)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)

      ICICLE RUNE id:3158 \/
      COMBAT_ICEDAMAGE
      CONST_ME_ICEAREA
      CONST_ANI_ICE

      SANTO MÍSSIL RUNA id:3182 \/
      (COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

      CONST_ME_PLANTATTACK (exevo gran mas tera)
      CONST_ME_ICETORNADO (exevo gran mas frigo)
      CONST_ME_SMALLPLANTS (exevo tera hur)
      CONST_ME_ICEAREA (exevo frigo hur)
      CONST_ME_ICEATTACK (exori frigo)
      CONST_ME_CARNIPHILA (exori tera)

      EXORI SAN \/
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
      CONST_ME_HOLYDAM IDADE

      EXEVO MAS SAN \/
      CONST_ME_HOLYAREA
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo