Ir para conteúdo
  • Cadastre-se

Rogeriok

Membro
  • Total de itens

    141
  • Registro em

  • Última visita

Posts postados por Rogeriok

  1. Como eu faço, para que o sistema guarde as descrições especiais de cada item. Exemplo, se o item tiver uma descrição modificada por um sistema de refinamento/upgrade ou simplesmente pela função  abaixo.

    doItemSetAttribute(item1, "defense", 42)

     Como pego esses valores novamente no item, quando algum player realiza a compra no trade off?

  2. To queimando os milholos aqui tbm para add as montarias, já progredi um pouco. Eu consegui fazer com que o player monte, para isso tive que adicionar todas sprites dos addons já montados. Ainda tentando fazer o script, não manjo muito.

    image.thumb.png.1cae4a83238d1ec4747efe0d9149ac48.png

  3. @Shiuns blz. Já fiz algumas mudanças e conseguir avançar, porém eu não to conseguindo fazer com que a função OnDeath veja a boss_area na tabela t.days, por que a ação irá acontecer depois que o Boss morrer. Alguém ai me dá uma dica..

     

     

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <mod name="Invasion Event" version="1.0" author="Dwarfer" contact="tibiaking.com" enabled="yes">
    <config name="Inv_func"><![CDATA[
    t = {
    tp_id = 1387,
    tp_goboss = {time_before = {60, "sec"}, create_pos = {x = 997, y = 1176, z = 7}},
    msg_time = true,
    tp_goreward = {x = 668, y = 1595, z = 6}, 
    removetp_time = {120, "sec"},
    
    days = {
    [{13, "18:06"}] = {name = "Gaz'haragoth", create_pos = {x = 358, y = 996, z = 11}, to_arena = {x = 717, y = 985, z = 7}, remove_time = {true, {60, "sec"}}, boss_area = {{x = 709, y = 961, z = 4}, {x = 725, y = 975, z = 4}}},
    [{13, "22:05"}] = {name = "Ferumbras Boss", create_pos = {x = 717, y = 963, z = 4}, to_arena = {x = 717, y = 985, z = 7}, remove_time = {true, {60, "sec"}}, boss_area = {{x = 709, y = 961, z = 4}, {x = 725, y = 975, z = 4}}},
    [{16, "18:06"}] = {name = "Gaz'haragoth", create_pos = {x = 358, y = 996, z = 11}, to_arena = {x = 717, y = 985, z = 7}, remove_time = {true, {60, "sec"}}, boss_area = {{x = 709, y = 961, z = 4}, {x = 725, y = 975, z = 4}}}
    }}
    
    function mathtime(table) -- by dwarfer
    local unit = {"sec", "min", "hour", "day"}
    for i, v in pairs(unit) do
    if v == table[2] then
    return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1)
    end
    end
    return "Error: Bad declaration in mathtime function."
    end
    
    function isHour(a, b)
    for i, k in pairs(t.days) do
    if i[1] == a and i[2] == b then
    return true
    end
    end
    return false
    end
    
    function getTable(a,b)
    for i, k in pairs(t.days) do
    if i[1] == a and i[2] == b then
    return k
    end
    end
    end
    
    function doRemoveMonster(uid)
    if isMonster(uid) then
    doBroadcastMessage(getCreatureName(uid) .. " returned to its covil stronger than before!", MESSAGE_EVENT_ADVANCE)
    doRemoveCreature(uid)
    end
    end
    
    function getPlayersInArea(fromPos, toPos)
    local players = {}
    for _, pid in ipairs(getPlayersOnline()) do
    if isInRange(getPlayerPosition(pid), fromPos, toPos) then
    table.insert(players, pid)
    end
    end
    return players
    end
    
    function removeAll(tp_pos, area)
    doRemoveItem(getTileItemById(tp_pos,t.tp_id).uid)
    local p = getPlayersInArea(area[1], area[2]) 
    if #p > 0 then
    for i = 1, #p do
    doTeleportThing(p[i], getTownTemplePosition(getPlayerTown(p[i])))
    end
    end
    end]]></config>
    <globalevent name="InvasionEvent" interval="60000" event="script"><![CDATA[
    domodlib('Inv_func')
    function onThink(interval, lastExecution)
    if isHour(tonumber(os.date("%d")), os.date("%X", os.time() + mathtime(t.tp_goboss.time_before)):sub(1,5)) then
    local m1 = getTable(tonumber(os.date("%d")), os.date("%X", os.time() + mathtime(t.tp_goboss.time_before)):sub(1,5))
    if t.msg_time then
            doBroadcastMessage("An evil soul seems to be coming to this land. Teleport appeared at Event Room! It will be there for " .. t.tp_goboss.time_before[1] .. " " .. t.tp_goboss.time_before[2] .. ".")
        end
    	 doCleanTile(t.tp_goboss.create_pos)
        doCreateTeleport(t.tp_id, m1.to_arena, t.tp_goboss.create_pos)
    end
    
    if isHour(tonumber(os.date("%d")), os.date("%X"):sub(1,5)) then
    local m = getTable(tonumber(os.date("%d")),os.date("%X"):sub(1,5))
       doRemoveItem(getTileItemById(t.tp_goboss.create_pos, t.tp_id).uid)
        local text = "It will be there for " .. m.remove_time[2][1] .. " " .. m.remove_time[2][2] .."!"
        doBroadcastMessage(m.name .. " appeared in the Boss Area. Kill it if you are able to! " .. (m.remove_time[1] == true and text or ""), MESSAGE_EVENT_ADVANCE)
        local monster = doSummonCreature(m.name, m.create_pos)
        if m.remove_time[1] then
            addEvent(doRemoveMonster, mathtime(m.remove_time[2])*1000, monster)
        end
    end
    return true
    end]]></globalevent>
    <event type="death" name="InvasionBossDeath" event="script"><![CDATA[
    domodlib('Inv_func')
    function onDeath(cid)
    local p = getCreaturePosition(cid)
    if isInRange(p, t.boss_area[1], t.boss_area[2]) then
        doCreatureSay(cid, "LOST NOW, BUT I WILL BACK HAHAHAHA! Teleport ends in " .. t.removetp_time[1] .." " .. t.removetp_time[2] .. ".", TALKTYPE_ORANGE_1)
        addEvent(function()
        doCleanTile(p)
        doSendMagicEffect(p, CONST_ME_TELEPORT)
        doCreateTeleport(t.tp_id, t.tp_goreward,p)
        end, 1)
        addEvent(removeAll,  mathtime(t.removetp_time)*1000, p, t.boss_area)
    end
    return true
    end
    ]]></event>
    </mod>

     

  4. Em 02/09/2017 em 22:01, Dwarfer disse:

    Segue o mod:

     

      Mostrar conteúdo oculto
    
    
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <mod name="Invasion Event" version="1.0" author="Dwarfer" contact="tibiaking.com" enabled="yes">
    <config name="Inv_func"><![CDATA[
    t = {
    tp_id = 1387,
    
    boss_area = {{x=1,y=1,z=1}, {x=1,y=1,z=1}},
    tp_goboss = {time_before = {5, "min"}, create_pos = {x = 1, y = 1, z = 1}, goTo = {x = 1, y = 1, z = 1}},
    msg_time = true,
    tp_goreward = {x = 1, y = 1, z = 1}, 
    removetp_time = {5, "min"},
    
    days = {
    [{"Tuesday", "10:34"}] = {name = "Dwarf", create_pos = {x = 1, y = 1, z = 1}, remove_time = {true, {3, "min"}}},
    [{"Wednesday", "15:00"}] = {name = "Dwarf Soldier", create_pos = {x = 1, y = 1, z = 1}, remove_time = {true, {1, "hour"}}},
    [{"Friday", "12:32"}] = {name = "Dwarf Guard", create_pos = {x = 1, y = 1, z = 1}, remove_time = {true, {1, "hour"}}},
    [{"Monday", "20:55"}] = {name = "Dwarf Geomancer", create_pos = {x = 1, y = 1, z = 1}, remove_time = {true, {1, "hour"}}}
    }}
    
    function mathtime(table) -- by dwarfer
    local unit = {"sec", "min", "hour", "day"}
    for i, v in pairs(unit) do
    if v == table[2] then
    return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1)
    end
    end
    return "Error: Bad declaration in mathtime function."
    end
    
    function isHour(a, b)
    for i, k in pairs(t.days) do
    if i[1] == a and i[2] == b then
    return true
    end
    end
    return false
    end
    
    function getTable(a,b)
    for i, k in pairs(t.days) do
    if i[1] == a and i[2] == b then
    return k
    end
    end
    end
    
    function doRemoveMonster(uid)
    if isMonster(uid) then
    doBroadcastMessage(getCreatureName(uid) .. " returned to its covil stronger than before!", MESSAGE_EVENT_ADVANCE)
    doRemoveCreature(uid)
    end
    end
    
    function getPlayersInArea(fromPos, toPos)
    local players = {}
    for _, pid in ipairs(getPlayersOnline()) do
    if isInRange(getPlayerPosition(pid), fromPos, toPos) then
    table.insert(players, pid)
    end
    end
    return players
    end
    
    function removeAll(tp_pos, area)
    doRemoveItem(getTileItemById(tp_pos,t.tp_id).uid)
    local p = getPlayersInArea(area[1], area[2]) 
    if #p > 0 then
    for i = 1, #p do
    doTeleportThing(p[i], getTownTemplePosition(getPlayerTown(p[i])))
    end
    end
    end]]></config>
    <globalevent name="InvasionEvent" interval="60000" event="script"><![CDATA[
    domodlib('Inv_func')
    function onThink(interval, lastExecution)
    
    if isHour( os.date("%A"), os.date("%X", os.time() + mathtime(t.tp_goboss.time_before)):sub(1,5)) then
        if t.msg_time then
            doBroadcastMessage("An evil soul seems to be coming to this land. Teleport appeared at Event Room! It will be there for " .. t.tp_goboss.time_before[1] .. " " .. t.tp_goboss.time_before[2] .. ".", MESSAGE_EVENT_ADVANCE)
        end
        doCleanTile(t.tp_goboss.create_pos)
        doCreateTeleport(t.tp_id, t.tp_goboss.goTo, t.tp_goboss.create_pos)
    end
    
    if isHour(os.date("%A"), os.date("%X"):sub(1,5)) then
        local m = getTable(os.date("%A"),os.date("%X"):sub(1,5))
        doRemoveItem(getTileItemById(t.tp_goboss.create_pos, t.tp_id).uid)
        local text = "It will be there for " .. m.remove_time[2][1] .. " " .. m.remove_time[2][2] .."!"
        doBroadcastMessage(m.name .. " appeared in the Boss Area. Kill it if you are able to! " .. (m.remove_time[1] == true and text or ""), MESSAGE_EVENT_ADVANCE)
        local monster = doSummonCreature(m.name, m.create_pos)
        if m.remove_time[1] then
            addEvent(doRemoveMonster, mathtime(m.remove_time[2])*1000, monster)
        end
    end
    return true
    end]]></globalevent>
    <event type="death" name="InvasionBossDeath" event="script"><![CDATA[
    domodlib('Inv_func')
    function onDeath(cid)
    local p = getCreaturePosition(cid)
    if isInRange(p, t.boss_area[1], t.boss_area[2]) then
        doCreatureSay(cid, "LOST NOW, BUT I WILL BACK HAHAHAHA! Teleport ends in " .. t.removetp_time[1] .." " .. t.removetp_time[2] .. ".", TALKTYPE_ORANGE_1)
        addEvent(function()
        doCleanTile(p)
        doSendMagicEffect(p, CONST_ME_TELEPORT)
        doCreateTeleport(t.tp_id, t.tp_goreward,p)
        end, 1)
        addEvent(removeAll,  mathtime(t.removetp_time)*1000, p, t.boss_area)
    end
    return true
    end]]></event>
    </mod>

     

     

     

    A configuração é autoexplicativa, mesmo assim, para que não restem dúvidas:

     

      Ocultar conteúdo
    
    
    t = {
    tp_id = 1387,
    
    boss_area = {{x=1,y=1,z=1}, {x=1,y=1,z=1}}, -- canto superior esquerdo, canto inferior direito da área de boss
    
    tp_goboss = {time_before = {5, "min"}, create_pos = {x = 1, y = 1, z = 1}, goTo = {x = 1, y = 1, z = 1}}, 
    
    -- time_before: quanto tempo antes do horário o teleporte da área de eventos será criado 
    -- create_pos: a posição na qual o teleporte será criado
    -- goTo: posição para qual o teleporte levará
    
    msg_time = true, -- true vai mandar a mensagem quando o teleporte for criado, false não
    
    tp_goreward = {x = 1, y = 1, z = 1},  -- posição para qual o teleporte do boss levará
    
    removetp_time = {5, "min"}, -- tempo para remover o teleporte do boss
    
    [{"Tuesday", "10:34"}] = {name = "Dwarf", create_pos = {x = 1, y = 1, z = 1}, remove_time = {true, {3, "min"}}},
    
    --- create_pos: posição na qual o boss será criado
    --- remove_time: true caso queira remover o boss, false se não, {tempo para remover o boss}

     

     

     

    Adicione no arquivo do boss que será criado na boss area, antes de </monster>:

     

    
     <script>
     <event name = "InvasionBossDeath"/>
     </script>

     

    Lembrando que o evento só será executado caso o boss esteja dentro da boss area. 

    Como faço para o Boss aparecer no 1º  e 15º dia de cada mês?

  5.  

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

    local onSell = function(cid, item, subType, amount, ignoreCap, inBackpacks)  
    if items[item].sellPrice ~= 0 then  
    doPlayerAddMoney(cid, items[item].sellPrice * amount)  
    doPlayerRemoveItem(cid, items[item].item_id, amount)  
    end 
    end 

     

    Quero que quando o player efetue uma venda, o item que vai server vendido seja os que estão na bag. Da maneira que está, faz a contagem de todos os items e se o player estiver usando o mesmo item em algum slot, o item está sendo vendido.

     

  6. Fiz esse aqui em OTX 2, vê se da pra adaptar.

    Spoiler

    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

    function onGetFormulaValues(cid, level, maglevel)
        min = -level/5 - maglevel*3.3-10
        max = -level/5 - maglevel*4.5-20
        
        return min, max
    end
    setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

    function onCastSpell1(parameters)
              doCombat(parameters.cid, combat, parameters.var)
    end
     
    function onCastSpell(cid, var)
        if exhaustion.check(cid, 23006) == false then
                exhaustion.set(cid, 23006, 5)
                local parameters = { cid = cid, var = var, combat = combat}
                    addEvent(onCastSpell1, 500, parameters)
                    addEvent(onCastSpell1, 1000, parameters)
                    addEvent(onCastSpell1, 2000, parameters)
                    addEvent(onCastSpell1, 3000, parameters)
                    return addEvent(onCastSpell1, 5000, parameters)
                        else
                  doPlayerSendCancel(cid, "You are exhausted. [" ..exhaustion.get(cid, 23006).."]")
                    return FALSE
              end
    end
              

     

  7. Tive esses erros.

    Spoiler

    item.cpp: In static member function ‘static std::__cxx11::string Item::getDescription(const ItemType&, int32_t, const Item*, int32_t, bool)’:
    item.cpp:999:4: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
        else
        ^~~~
    item.cpp:1001:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
         s << "Crit Chance:" << std::showpos << int32_t(item ? item->getCriticalHitChance() : it.criticalHitChance) << "%"<< std::noshowpos;
         ^
    item.cpp:1011:4: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
        else
        ^~~~
    item.cpp:1013:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
         s << "Dodge Chance:" << std::showpos << int32_t(item ? item->getDodgeChance() : it.dodgeChance) << "%"<< std::noshowpos;
         ^
    item.cpp:1023:4: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
        else
        ^~~~
    item.cpp:1025:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
         s << "Life Absorb:" << std::showpos << int32_t(item ? item->getLifeAbsorb() : it.lifeAbsorb) << "%"<< std::noshowpos;
         ^
    item.cpp:1035:4: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
        else
        ^~~~
    item.cpp:1037:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
         s << "Mana Absorb:" << std::showpos << int32_t(item ? item->getManaAbsorb() : it.manaAbsorb) << "%"<< std::noshowpos;
         ^
    item.cpp:1047:4: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
        else
        ^~~~
    item.cpp:1049:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
         s << "Life Leech:" << std::showpos << int32_t(item ? item->getLifeLeech() : it.lifeLeech) << "%"<< std::noshowpos;
         ^
    item.cpp:1059:4: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
        else
        ^~~~
    item.cpp:1061:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
         s << "Mana Leech:" << std::showpos << int32_t(item ? item->getManaLeech() : it.manaLeech) << "%"<< std::noshowpos;
         ^
    item.cpp:1364:4: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
        else
        ^~~~
    item.cpp:1366:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
         s << "Crit Chance:" << std::showpos << int32_t(item ? item->getCriticalHitChance() : it.criticalHitChance) << "%"<< std::noshowpos;
         ^
    item.cpp:1376:4: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
        else
        ^~~~
    item.cpp:1378:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
         s << "Dodge Chance:" << std::showpos << int32_t(item ? item->getDodgeChance() : it.dodgeChance) << "%"<< std::noshowpos;
         ^
    item.cpp:1388:4: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
        else
        ^~~~
    item.cpp:1390:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
         s << "Life Absorb:" << std::showpos << int32_t(item ? item->getLifeAbsorb() : it.lifeAbsorb) << "%"<< std::noshowpos;
         ^
    item.cpp:1400:4: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
        else
        ^~~~
    item.cpp:1402:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
         s << "Mana Absorb:" << std::showpos << int32_t(item ? item->getManaAbsorb() : it.manaAbsorb) << "%"<< std::noshowpos;
         ^
    item.cpp:1412:4: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
        else
        ^~~~
    item.cpp:1414:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
         s << "Life Leech:" << std::showpos << int32_t(item ? item->getLifeLeech() : it.lifeLeech) << "%"<< std::noshowpos;
         ^
    item.cpp:1424:4: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]
        else
        ^~~~
    item.cpp:1426:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
         s << "Mana Leech:" << std::showpos << int32_t(item ? item->getManaLeech() : it.manaLeech) << "%"<< std::noshowpos;
         ^
    cc1plus: all warnings being treated as errors
    Makefile:40: recipe for target 'obj/item.o' failed
    make: *** [obj/item.o] Error 1

     

     

  8. Hey man, como eu posso solucionar esse erro?

    Spoiler


    [Error - NpcScript Interface]
    data/npc/scripts/simple_task.lua:onCreatureSay
    Description:
    data/npc/scripts/simple_task.lua:20: attempt to index global 'tasktabble' (a nil value)
    stack traceback:
            data/npc/scripts/simple_task.lua:20: in function 'callback'
            data/npc/lib/npcsystem/npchandler.lua:459: in function 'onCreatureSay'
            data/npc/scripts/simple_task.lua:8: in function <data/npc/scripts/simple_task.lua:8>

    [Error - NpcScript Interface]
    data/npc/scripts/simple_task.lua:onCreatureSay
    Description:
    data/npc/scripts/simple_task.lua:20: attempt to index global 'tasktabble' (a nil value)
    stack traceback:
            data/npc/scripts/simple_task.lua:20: in function 'callback'
            data/npc/lib/npcsystem/npchandler.lua:459: in function 'onCreatureSay'
            data/npc/scripts/simple_task.lua:8: in function <data/npc/scripts/simple_task.lua:8>

    [Error - NpcScript Interface]
    data/npc/scripts/simple_task.lua:onCreatureSay
    Description:
    data/npc/scripts/simple_task.lua:20: attempt to index global 'tasktabble' (a nil value)
    stack traceback:
            data/npc/scripts/simple_task.lua:20: in function 'callback'
            data/npc/lib/npcsystem/npchandler.lua:459: in function 'onCreatureSay'
            data/npc/scripts/simple_task.lua:8: in function <data/npc/scripts/simple_task.lua:8>

    [Error - NpcScript Interface]
    data/npc/scripts/simple_task.lua:onCreatureSay
    Description:
    data/npc/scripts/simple_task.lua:20: attempt to index global 'tasktabble' (a nil value)
    stack traceback:
            data/npc/scripts/simple_task.lua:20: in function 'callback'
            data/npc/lib/npcsystem/npchandler.lua:459: in function 'onCreatureSay'
            data/npc/scripts/simple_task.lua:8: in function <data/npc/scripts/simple_task.lua:8>

     

  9. .Qual servidor ou website você utiliza como base? 

    Tfs 0.4 e Otx  - 8.60

    Qual o motivo deste tópico? 

    Olá galera do TK, tudo bem?

    Vamos lá, tenho andado por aí testando alguns servidores tfs 0.4, otx, etc. E me deparei com o seguinte problema, as potions de todos otservs existem um exhausted enorme que prejudica a jogabilidade, ou seja, no momento que que o player está potando não é possivel subir em escadas, abrir bps ou descer bueiros.
    Já troquei scripts,configurei o config.lua,  li e revi alguns scripts de potions de outros ots, porém são basicamente a mesma coisa, não consegui nenhum exito.
    Então a dúvida é o seguinte, como eu faço para o exhausted do heal das potions ficarem igual a das magias de healing? Pois, quando se usa exura, por exemplo, o player pode fazer todas as ações mensionadas acima.

     

    Att Roger.

     

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo