Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Boa galera estou com um erro em actions.lua do meu servidor tfs 1.3 preciso de ajuda não consegui resolver esse erro.

action.lua

Citar

local groundIds = {354, 355} -- pick usable ground
local sandIds = {231, 9059} -- desert sand
local holeId = { -- usable rope holes, for rope spots see global.lua
    294, 369, 370, 383, 392, 408, 409, 410, 427, 428, 429, 430, 462, 469, 470, 482,
    484, 485, 489, 924, 1369, 3135, 3136, 4835, 4837, 7933, 7938, 8170, 8249, 8250,
    8251, 8252, 8254, 8255, 8256, 8276, 8277, 8279, 8281, 8284, 8285, 8286, 8323,
    8567, 8585, 8595, 8596, 8972, 9606, 9625, 13190, 14461, 19519, 21536, 23713,
    26020
}
local holes = {468, 481, 483, 7932, 23712} -- holes opened by shovel

local JUNGLE_GRASS = { 2782, 3985, 19433 }
local WILD_GROWTH = { 1499, 11099, 2101, 1775, 1447, 1446}

local fruits = {2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, 2682, 2684, 2685, 5097, 8839, 8840, 8841}

local lava = {
    Position(32808, 32336, 11),
    Position(32809, 32336, 11),
    Position(32810, 32336, 11),
    Position(32808, 32334, 11),
    Position(32807, 32334, 11),
    Position(32807, 32335, 11),
    Position(32807, 32336, 11),
    Position(32807, 32337, 11),
    Position(32806, 32337, 11),
    Position(32805, 32337, 11),
    Position(32805, 32338, 11),
    Position(32805, 32339, 11),
    Position(32806, 32339, 11),
    Position(32806, 32338, 11),
    Position(32807, 32338, 11),
    Position(32808, 32338, 11),
    Position(32808, 32337, 11),
    Position(32809, 32337, 11),
    Position(32810, 32337, 11),
    Position(32811, 32337, 11),
    Position(32811, 32338, 11),
    Position(32806, 32338, 11),
    Position(32810, 32338, 11),
    Position(32810, 32339, 11),
    Position(32809, 32339, 11),
    Position(32809, 32338, 11),
    Position(32811, 32336, 11),
    Position(32811, 32335, 11),
    Position(32810, 32335, 11),
    Position(32809, 32335, 11),
    Position(32808, 32335, 11),
    Position(32809, 32334, 11),
    Position(32809, 32333, 11),
    Position(32810, 32333, 11),
    Position(32811, 32333, 11),
    Position(32806, 32338, 11),
    Position(32810, 32334, 11),
    Position(32811, 32334, 11),
    Position(32812, 32334, 11),
    Position(32813, 32334, 11),
    Position(32814, 32334, 11),
    Position(32812, 32333, 11),
    Position(32810, 32334, 11),
    Position(32812, 32335, 11),
    Position(32813, 32335, 11),
    Position(32814, 32335, 11),
    Position(32814, 32333, 11),
    Position(32813, 32333, 11)
}

local function revertItem(position, itemId, transformId)
    local item = Tile(position):getItemById(itemId)
    if item then
        item:transform(transformId)
    end
end

local function removeRemains(toPosition)
    local item = Tile(toPosition):getItemById(2248)
    if item then
        item:remove()
    end
end

local function revertCask(position)
    local caskItem = Tile(position):getItemById(2249)
    if caskItem then
        caskItem:transform(5539)
        position:sendMagicEffect(CONST_ME_MAGIC_GREEN)
    end
end

local cutItems = {
    [3794] = 3959, [3795] = 3959, [3796] = 3958, [3797] = 3958, [3798] = 3958, [3799] = 3958,
    [1614] = 2251, [1615] = 2251, [1616] = 2251, [1619] = 2251, [1650] = 2253, [1651] = 2253,
    [1652] = 2253, [1653] = 2253, [1658] = 2252, [1659] = 2252, [1660] = 2252, [1661] = 2252,
    [1666] = 2252, [1667] = 2252, [1668] = 2252, [1669] = 2252, [1670] = 2252, [1671] = 2252,
    [1672] = 2252, [1673] = 2252, [1674] = 2253, [1676] = 2252, [1677] = 2253, [1714] = 2251,
    [1715] = 2251, [1716] = 2251, [1724] = 2252, [1725] = 2252, [1726] = 2252, [1727] = 2252,
    [1728] = 2254, [1729] = 2254, [1730] = 2254, [1731] = 2254, [1732] = 2254, [1733] = 2254,
    [1735] = 2254, [1775] = 2250, [2034] = 2252, [4996] = 2252, [2116] = 2254, [2116] = 2254,
    [2117] = 2254, [2118] = 2254, [2119] = 2254, [6123] = 2254, [2080] = 2254, [2081] = 2254,
    [2082] = 2254, [2083] = 2254, [2084] = 2254, [2085] = 2254, [2093] = 2250, [2094] = 2250,
    [2095] = 2250, [2098] = 2250, [2099] = 2250, [2101] = 2250, [2106] = 2250, [2105] = 2250,
    [2562] = 2257, [2581] = 2258, [2582] = 2258, [2582] = 2258, [2583] = 2258, [3805] = 6267,
    [3806] = 6267, [3807] = 2252, [3808] = 2252, [3809] = 2252, [3810] = 2252, [3811] = 2255,
    [3812] = 6267, [3813] = 2252, [3814] = 2252, [3815] = 2252, [3816] = 2252, [3817] = 2252,
    [3818] = 2252, [3819] = 2252, [3820] = 2252, [3821] = 2255, [3832] = 2255, [3833] = 2255,
    [3834] = 2255, [3835] = 2255, [6356] = 2257, [6357] = 2257, [6358] = 2257, [6359] = 2257,
    [6360] = 2257, [6361] = 2257, [6363] = 2257, [6368] = 2250, [6369] = 2250, [6370] = 2250,
    [6371] = 2250, [1738] = 2250, [1739] = 2251, [1740] = 2250, [1741] = 2255, [1747] = 2250,
    [1748] = 2250, [1749] = 1750, [1750] = 2254, [1751] = 2254, [1752] = 2254, [1753] = 2254,
    [1770] = 2251, [1774] = 2250, [6085] = 2254, [7481] = 2251, [7482] = 2251, [7483] = 2251,
    [7484] = 2250, [7706] = 2251, [7707] = 2251, [1738] = 2250, [1739] = 2251, [6109] = 2254,
    [6110] = 2254, [6111] = 2254, [6112] = 2254, [7538] = 7544, [7539] = 7545, [7585] = 7586,
    [29087] = 0, [29088] = 0
}

local function containsId(table, id)
    for i, v in pairs(table) do
        if (i == id) then
            return true
        end
    end

    return false
end

function onDestroyItem(player, item, fromPosition, target, toPosition, isHotkey)
    if not target or type(target) ~= "userdata" or not target:isItem() then
        return false
    end

    if target:hasAttribute(ITEM_ATTRIBUTE_UNIQUEID) or target:hasAttribute(ITEM_ATTRIBUTE_ACTIONID) then
        return false
    end

    if toPosition.x == CONTAINER_POSITION then
        player:sendCancelMessage(Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
        return true
    end

    local targetId = target.itemid
    local destroyId = cutItems[targetId] or ItemType(targetId):getDestroyId()
    if destroyId == 0 then
        if targetId ~= 29087 and targetId ~= 29088 then
            return false
        end
    end

    if math.random(7) == 1 then
        local item = Game.createItem(destroyId, 1, toPosition)
        if item ~= nil then
            item:decay()
        end

        -- Against The Spider Cult (Spider Eggs)
        if targetId == 7585 then
            local eggStorage = player:getStorageValue(Storage.TibiaTales.AgainstTheSpiderCult)
            if eggStorage >= 1 and eggStorage < 5 then
                player:setStorageValue(Storage.TibiaTales.AgainstTheSpiderCult, math.max(1, eggStorage) + 1)
            end

            Game.createMonster("Giant Spider", Position(33181, 31869, 12))
        end

        -- Move items outside the container
        if target:isContainer() then
            for i = target:getSize() - 1, 0, -1 do
                   local containerItem = target:getItem(i)
                if containerItem then
                    containerItem:moveTo(toPosition)
                end
            end
        end
        if targetId == 29087 or targetId == 29088 then -- energy barrier na threatned dreams quest (feyrist)
            addEvent(Game.createItem, math.random(13000, 17000), targetId, 1, toPosition)
        end
        target:remove(1)
    end

    toPosition:sendMagicEffect(CONST_ME_POFF)
    return true
end

function onUseRope(player, item, fromPosition, target, toPosition, isHotkey)
    if toPosition.x == CONTAINER_POSITION then
        return false
    end

    local targetId = target.itemid

    local tile = Tile(toPosition)
    local ground = tile:getGround()
    if ground and isInArray(ropeSpots, ground.itemid) or tile:getItemById(14435) then
        player:teleportTo(toPosition:moveUpstairs())
        if targetId == 8592 then
            if player:getStorageValue(Storage.RookgaardTutorialIsland.tutorialHintsStorage) < 22 then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have successfully used your rope to climb out of the hole. Congratulations! Now continue to the east.')
            end
        end
        return true
    elseif isInArray(holeId, targetId) then
        toPosition.z = toPosition.z + 1
        tile = Tile(toPosition)
        if tile then
            local thing = tile:getTopVisibleThing()
            if thing:isItem() and thing:getType():isMovable() then
                return thing:moveTo(toPosition:moveUpstairs())
            elseif thing:isCreature() and thing:isPlayer() then
                return thing:teleportTo(toPosition:moveUpstairs())
            end
        end

        player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return true
    end

    return false
end

function onUseShovel(player, item, fromPosition, target, toPosition, isHotkey)
    local tile = Tile(toPosition)
    if not tile then
        return false
    end

    local ground = tile:getGround()
    if not ground then
        return false
    end

    local targetId = target.itemid
    local groundId = ground:getId()

    if table.contains(holes, targetId) then
        target:transform(targetId + 1)
        target:decay()
        toPosition.z = toPosition.z + 1
        tile:relocateTo(toPosition)

    elseif table.contains(sandIds, groundId) then
        local randomValue = math.random(1, 100)
        if target.actionid == 100 and randomValue <= 20 then
            ground:transform(489)
            ground:decay()
        elseif randomValue == 1 then
            Game.createItem(2159, 1, toPosition)
        elseif randomValue > 95 then
            Game.createMonster("Scarab", toPosition)
        end
        toPosition:sendMagicEffect(CONST_ME_POFF)

        -- Wrath of the emperor quest
    elseif targetId == 351 and targetActionId == 8024 then
        player:addItem(12297, 1)
        player:say("You dig out a handful of earth from this sacred place.", TALKTYPE_MONSTER_SAY)

    -- RookgaardTutorialIsland
    elseif targetId == 8579 and player:getStorageValue(Storage.RookgaardTutorialIsland.tutorialHintsStorage) < 20 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You dug a hole! Walk onto it as long as it is open to jump down into the forest cave.')
        player:setStorageValue(Storage.RookgaardTutorialIsland.tutorialHintsStorage, 19)
        Position(32070, 32266, 7):sendMagicEffect(CONST_ME_TUTORIALARROW)
        Position(32070, 32266, 7):sendMagicEffect(CONST_ME_TUTORIALSQUARE)
        target:transform(469)
        addEvent(revertItem, 30 * 1000, toPosition, 469, 8579)

    -- Gravedigger Quest
    elseif targetActionId == 3076 and player:getStorageValue(Storage.GravediggerOfDrefia.Mission14a) == 1 and player:getStorageValue(Storage.GravediggerOfDrefia.Mission14b) < 1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You found a dragon tear. This one is warm to the touch and burns in a fiery light.')
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        player:addItem(21401, 1)
        player:setStorageValue(Storage.GravediggerOfDrefia.Mission14b, 1)
    elseif targetActionId == 3077 and player:getStorageValue(Storage.GravediggerOfDrefia.Mission14b) == 1 and player:getStorageValue(Storage.GravediggerOfDrefia.Mission14c) < 1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You found a dragon tear. This one shines and shimmers as if still liquid.')
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        player:addItem(21401, 1)
        player:setStorageValue(Storage.GravediggerOfDrefia.Mission14c, 1)
    elseif targetActionId == 3075 and player:getStorageValue(Storage.GravediggerOfDrefia.Mission14c) == 1 and player:getStorageValue(Storage.GravediggerOfDrefia.Mission14) < 1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You found a dragon tear. It glows in an unearthli orange light.')
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        player:addItem(21401, 1)
        player:setStorageValue(Storage.GravediggerOfDrefia.Mission14, 1)
    elseif targetActionId == 4654 and player:getStorageValue(Storage.GravediggerOfDrefia.Mission49) == 1 and player:getStorageValue(Storage.GravediggerOfDrefia.Mission50) < 1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You found a piece of the scroll. You pocket it quickly.')
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        player:addItem(21250, 1)
        player:setStorageValue(Storage.GravediggerOfDrefia.Mission50, 1)

    elseif targetActionId == 4668 and player:getStorageValue(Storage.GravediggerOfDrefia.Mission69) == 1 and player:getStorageValue(Storage.GravediggerOfDrefia.Mission70) < 1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'A torn scroll piece emerges. Probably gnawed off by rats.')
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        player:addItem(21250, 1)
        player:setStorageValue(Storage.GravediggerOfDrefia.Mission70, 1)

    -- ferumbras ascendant
    elseif targetActionId == 53803 then
        if player:getStorageValue(Storage.FerumbrasAscension.Ring) >= 1 then
            return false
        end
        player:addItem(24826, 1)
        player:setStorageValue(Storage.FerumbrasAscension.Ring, 1)

    -- ???
    elseif targetActionId == 50118 then
        local wagonItem = Tile(Position(32717, 31492, 11)):getItemById(7131)
        if wagonItem then
            Game.createItem(8749, 1, wagonItem:getPosition())
            toPosition:sendMagicEffect(CONST_ME_POFF)
        end

    elseif targetId == 8749 then
        local coalItem = Tile(Position(32699, 31492, 11)):getItemById(8749)
        if coalItem then
            coalItem:remove(1)
            toPosition:sendMagicEffect(CONST_ME_POFF)

            local crucibleItem = Tile(Position(32699, 31494, 11)):getItemById(8642)
            if crucibleItem then
                crucibleItem:setActionId(50119)
            end
        end

    elseif isInArray({9632, 20230, 17672, 18586, 18580}, targetId) then
        if player:getStorageValue(Storage.SwampDiggingTimeout) >= os.time() then
            toPosition:sendMagicEffect(CONST_ME_POFF)
            return false
        end

        local config = { {from = 1, to = 39, itemId = 2817}, {from = 40, to = 79, itemId = 2145}, {from = 80, to = 100, itemId = 20138} }
        local chance = math.random(100)

        for i = 1, #config do
            local randItem = config
            if chance >= randItem.from and chance <= randItem.to then
                player:addItem(randItem.itemId, 1)
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You dug up a ' .. ItemType(randItem.itemId):getName() .. '.')
                player:setStorageValue(Storage.SwampDiggingTimeout, os.time() + 604800)
                toPosition:sendMagicEffect(CONST_ME_GREEN_RINGS)
                break
            end
        end


    elseif targetId == 22674 then
        if not player:removeItem(5091, 1) then
            return false
        end

        target:transform(5731)
        target:decay()
        toPosition:sendMagicEffect(CONST_ME_POFF)
    else
        return false
    end

    return true
end

function onUsePick(player, item, fromPosition, target, toPosition, isHotkey)
    local stonePos = Position(32648, 32134, 10)
    if (toPosition == stonePos) then
        local tile = Tile(stonePos)
        local stone = tile:getItemById(1285)
        if (stone) then
            stone:remove(1)
            toPosition:sendMagicEffect(CONST_ME_POFF)
            addEvent(function() Game.createItem(1285, 1, stonePos) end, 20000)

            return true
        end
    end

    local targetId, targetActionId = target.itemid, target.actionid
    if isInArray({354, 355}, targetId) and (target:hasAttribute(ITEM_ATTRIBUTE_UNIQUEID) or target:hasAttribute(ITEM_ATTRIBUTE_ACTIONID)) then
        target:transform(392)
        target:decay()
        toPosition:sendMagicEffect(CONST_ME_POFF)
        
    elseif targetId == 23759 then
        target:remove()
        toPosition:sendMagicEffect(CONST_ME_POFF)
        player:addItem(23760, 1)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You picked a beautiful lion's mane flower.")

    -- shiny stone refining
    elseif target.itemid == 11227 then
        local chance = math.random(1,100)

        if chance == 1 then
            player:addItem(2160, 1) -- 1% chance of getting crystal coin
        elseif chance <= 6 then
            player:addItem(2148, 1) -- 5% chance of getting gold coin
        elseif chance <= 51 then
            player:addItem(2152, 1) -- 45% chance of getting platinum coin
        else
            player:addItem(2145, 1) -- 49% chance of getting small diamond
        end
        target:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT)
        target:remove(1)

    elseif targetId == 11227 then
        target:remove(1)
        toPosition:sendMagicEffect(CONST_ME_POFF)
        player:addItem(2152, 10)

    elseif targetId == 7200 then
        target:transform(7236)
        target:decay()
        toPosition:sendMagicEffect(CONST_ME_HITAREA)

    elseif targetId == 468 then
        target:transform(469)
        target:decay()
        toPosition:sendMagicEffect(CONST_ME_HITAREA)

    elseif targetId == 6299 then
        target:transform(482)
        target:decay()
        toPosition:sendMagicEffect(CONST_ME_HITAREA)

    elseif targetId == 23712 then
        target:transform(23713)
        target:decay()
        toPosition:sendMagicEffect(CONST_ME_HITAREA)

    elseif targetId == 481 then
        target:transform(482)
        target:decay()
        toPosition:sendMagicEffect(CONST_ME_HITAREA)

    elseif targetId == 483 then
        target:transform(484)
        target:decay()
        toPosition:sendMagicEffect(CONST_ME_HITAREA)

    elseif targetId == 7932 then
        target:transform(7933)
        target:decay()
        toPosition:sendMagicEffect(CONST_ME_HITAREA)

    elseif targetId == 103 and targetActionId == 4205 then
        if player:getStorageValue(Storage.TibiaTales.IntoTheBonePit) ~= 1 then
            return false
        end

        local remains = Game.createItem(2248, 1, toPosition)
        if remains then
            remains:setActionId(4206)
        end
        toPosition:sendMagicEffect(CONST_ME_HITAREA)
        addEvent(removeRemains, 60000, toPosition)

    --sea of light
    elseif targetId == 8634 then
        if target.actionid == 4224 then
            if player:getStorageValue(Storage.SeaOfLightQuest.Questline) == 4 and player:getStorageValue(target.actionid) ~= 1 then
                player:addItem(10614, 1)
                toPosition:sendMagicEffect(CONST_ME_ENERGYHIT)
                player:setStorageValue(target.actionid, 1)
                player:setStorageValue(Storage.SeaOfLightQuest.Questline, 5)
                player:say("*crush*", TALKTYPE_MONSTER_SAY)
            end
        end

    -- Shadows of Yalahar
    elseif targetId == 8933 then
        if player:getStorageValue(Storage.ShadownofYalahar.Questline) == 10 then
        player:sendTextMessage(TALKTYPE_ORANGE_1, 'You have unearthed a crystal!')
        player:addItem(10169, 1)
        toPosition:sendMagicEffect(CONST_ME_POFF)
        end

    -- grimvale quest
    elseif targetId == 24731 then
        if player:getStorageValue(Storage.Grimvale.SilverVein) < os.time() then
            local chance = math.random(1, 10)
            if chance >= 5 then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Even after a thorough and frustrating search you could not find enough liquified silver in this vein to fill a flask.')
            elseif chance <= 4 then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Carefully you gather some of the liquified silver from this vein in a small flask. You now feel strangely affected to the moon.')
                player:addItem(24714)
                target:transform(4475)
                addEvent(revertItem, 10 * 60 * 1000, toPosition, 4475, 24731)
            end
            player:setStorageValue(Storage.Grimvale.SilverVein, os.time() + 2 * 60)
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You are still exhausted from earlier attempts. Getting liquid silver out of the mountain needs concentration and a steady hand.')
        end

    --The Ice Islands Quest, Nibelor 1: Breaking the Ice
    elseif targetId == 3621 and targetActionId == 12026 then
        local missionProgress, pickAmount = player:getStorageValue(Storage.TheIceIslands.Mission02), player:getStorageValue(Storage.TheIceIslands.PickAmount)
        if missionProgress < 1 or pickAmount >= 3 or player:getStorageValue(Storage.TheIceIslands.Questline) ~= 3 then
            return false
        end

        player:setStorageValue(Storage.TheIceIslands.PickAmount, math.max(0, pickAmount) + 1)
        player:setStorageValue(Storage.TheIceIslands.Mission02, missionProgress + 1) -- Questlog The Ice Islands Quest, Nibelor 1: Breaking the Ice

        if pickAmount >= 2 then
            player:setStorageValue(Storage.TheIceIslands.Questline, 4)
            player:setStorageValue(Storage.TheIceIslands.Mission02, 4) -- Questlog The Ice Islands Quest, Nibelor 1: Breaking the Ice
        end

        local crackItem = Tile(toPosition):getItemById(7185)
        if crackItem then
            crackItem:transform(7186)
            addEvent(revertItem, 60 * 1000, toPosition, 7186, 7185)
        end

        local chakoyas = {"chakoya toolshaper", "chakoya tribewarden", "chakoya windcaller"}
        Game.createMonster(chakoyas[math.random(#chakoyas)], toPosition)
        toPosition:sendMagicEffect(CONST_ME_TELEPORT)

    elseif targetId == 1304 then
    --The Pits of Inferno Quest
        if target.uid == 1022 then
            for i = 1, #lava do
                Game.createItem(5815, 1, lava)
            end
            target:transform(2256)
            toPosition:sendMagicEffect(CONST_ME_SMOKE)

    -- naginata quest
        elseif targetActionId == 50058 then
            local stoneStorage = Game.getStorageValue(GlobalStorage.NaginataStone)
            if stoneStorage ~= 5 then
                Game.setStorageValue(GlobalStorage.NaginataStone, math.max(0, stoneStorage) + 1)
            elseif stoneStorage == 5 then
                target:remove(1)
                Game.setStorageValue(GlobalStorage.NaginataStone)
            end
            toPosition:sendMagicEffect(CONST_ME_POFF)
            doTargetCombatHealth(0, player, COMBAT_PHYSICALDAMAGE, -31, -39, CONST_ME_NONE)
        end

     --The Banshee Quest
    elseif targetId == 9025 and targetActionId == 101 then
        target:transform(392)
        target:decay()
        toPosition:sendMagicEffect(CONST_ME_POFF)

     -- The Hidden City of Beregar Quest
    elseif targetActionId == 50090 then
        if player:getStorageValue(Storage.hiddenCityOfBeregar.WayToBeregar) == 1 then
            player:teleportTo(Position(32566, 31338, 10))
        end

    elseif targetActionId == 50114 then
        if Tile(Position(32617, 31513, 9)):getItemById(1027) and Tile(Position(32617, 31514, 9)):getItemById(1205) then
            local rubbleItem = Tile(Position(32619, 31514, 9)):getItemById(5709)
            if rubbleItem then
                rubbleItem:remove(1)
            end
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can't remove this pile since it's currently holding up the tunnel.")
        end

    -- Pythius The Rotten (Firewalker Boots)
    elseif targetActionId == 50127 then
        if player:getStorageValue(Storage.QuestChests.FirewalkerBoots) == 1 then
            return false
        end
        target:remove(1)

        local stoneItem = Tile(toPosition):getItemById(1304)
        if stoneItem then
            stoneItem:remove(1)
        end

        iterateArea(
            function(position)
                local groundItem = Tile(position):getGround()
                if groundItem and groundItem.itemid == 598 then
                    groundItem:transform(5815)
                end
            end,
            Position(32550, 31373, 15),
            Position(32551, 31379, 15)
        )
        iterateArea(
            function(position)
                position:sendMagicEffect(CONST_ME_POFF)
            end,
            Position(32551, 31374, 15),
            Position(32551, 31379, 15)
        )

        local portal = Game.createItem(1387, 1, Position(32551, 31376, 15))
        if portal then
            portal:setActionId(50126)
        end

        -- The Asure
    elseif targetActionId == 50091 then
        player:teleportTo(Position(32960, 32676, 4))

        -- Wrath of the emperor quest
    elseif targetId == 12296 then
        player:addItem(12295, 1)
        player:say("The cracked part of the table lets you cut out a large chunk of wood with your pick.", TALKTYPE_MONSTER_SAY)

    elseif targetId == 22671 then
        target:transform(392)
        target:decay()
    end
--Lower Roshamuul
if (target ~= nil) and target:isItem() and (target:getId() == 22469) then
    if math.random(100) > 50 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Crushing the stone produces some fine gravel.")
        target:transform(22467)
        target:decay()
    else
        Game.createMonster("Frazzlemaw", toPosition)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Crushing the stone yields nothing but slightly finer, yet still unusable rubber.")
        target:transform(22468)
        target:decay()
    end
        return true
    end
    return true
end

function onUseMachete(player, item, fromPosition, target, toPosition, isHotkey)
    local targetId = target.itemid
    if isInArray(JUNGLE_GRASS, targetId) then
        target:transform(targetId == 19433 and 19431 or targetId - 1)
        target:decay()
        return true
    end

    if isInArray(WILD_GROWTH, targetId) then
        toPosition:sendMagicEffect(CONST_ME_POFF)
        target:remove()
        return true
    end

    return onDestroyItem(player, item, fromPosition, target, toPosition, isHotkey)
end

function onUseCrowbar(player, item, fromPosition, target, toPosition, isHotkey)
    if not isInArray({2416, 10515}, item.itemid) then
        return false
    end

    local targetActionId, targetUniqueId = target.actionid, target.uid

    -- In Service Of Yalahar Quest
    if targetUniqueId == 3071 then
        if player:getStorageValue(Storage.InServiceofYalahar.SewerPipe01) < 1 then
--            doSetMonsterOutfit(player, 'skeleton', 3 * 1000)
            fromPosition:sendMagicEffect(CONST_ME_ENERGYHIT)
            player:setStorageValue(Storage.InServiceofYalahar.SewerPipe01, 1)
            player:setStorageValue(Storage.InServiceofYalahar.Mission01, player:getStorageValue(Storage.InServiceofYalahar.Mission01) + 1) -- StorageValue for Questlog 'Mission 01: Something Rotten'
            local position = player:getPosition()
            for x = -1, 1 do
                for y = -1, 1 do
                    position = position + Position(x, y, 0)
                    position:sendMagicEffect(CONST_ME_YELLOWENERGY)
                end
            end
        end

    elseif targetUniqueId == 3072 then
        if player:getStorageValue(Storage.InServiceofYalahar.SewerPipe02) < 1 then
            player:setStorageValue(Storage.InServiceofYalahar.SewerPipe02, 1)
            player:setStorageValue(Storage.InServiceofYalahar.Mission01, player:getStorageValue(Storage.InServiceofYalahar.Mission01) + 1) -- StorageValue for Questlog 'Mission 01: Something Rotten'
            local position = player:getPosition()
            for x = -1, 1 do
                for y = -1, 1 do
                    if math.random(2) == 2 then
                        position = position + Position(x, y, 0)
                        Game.createMonster('rat', position)
                        position:sendMagicEffect(CONST_ME_TELEPORT)
                    end
                end
            end
        end

    elseif targetUniqueId == 3073 then
        if player:getStorageValue(Storage.InServiceofYalahar.SewerPipe03) < 1 then
            player:say('You have used the crowbar on a grate.', TALKTYPE_MONSTER_SAY)
            player:setStorageValue(Storage.InServiceofYalahar.SewerPipe03, 1)
            player:setStorageValue(Storage.InServiceofYalahar.Mission01, player:getStorageValue(Storage.InServiceofYalahar.Mission01) + 1) -- StorageValue for Questlog 'Mission 01: Something Rotten'
        end

    elseif targetUniqueId == 3074 then
        if player:getStorageValue(Storage.InServiceofYalahar.SewerPipe04) < 1 then
--            doSetMonsterOutfit(player, 'bog raider', 5 * 1000)
            player:say('You have used the crowbar on a knot.', TALKTYPE_MONSTER_SAY)
            player:setStorageValue(Storage.InServiceofYalahar.SewerPipe04, 1)
            player:setStorageValue(Storage.InServiceofYalahar.Mission01, player:getStorageValue(Storage.InServiceofYalahar.Mission01) + 1) -- StorageValue for Questlog 'Mission 01: Something Rotten'
        end

    elseif targetActionId == 100 then
        local targetId = target.itemid

        -- Postman Quest
        if targetId == 2593 then
            if player:getStorageValue(Storage.postman.Mission02) == 1 then
                player:setStorageValue(Storage.postman.Mission02, 2)
                toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            end

        -- The Ape City - Mission 7
        elseif targetId == 5539 then
            local cStorage = player:getStorageValue(Storage.TheApeCity.Casks)
            if cStorage < 3 then
                player:setStorageValue(Storage.TheApeCity.Casks, math.max(0, cStorage) + 1)
                target:transform(2249)
                toPosition:sendMagicEffect(CONST_ME_EXPLOSIONAREA)
                addEvent(revertCask, 3 * 60 * 1000, toPosition)
            end
        end

    -- Secret Service Quest
    elseif targetActionId == 12566 and player:getStorageValue(Storage.secretService.TBIMission06) == 1 then
        local yellPosition = Position(32204, 31157, <em><em>?</em></em>
        if player:getOutfit().lookType == 137 then -- amazon lookType
            player:setStorageValue(Storage.secretService.TBIMission06, 2)
            Game.createMonster('barbarian skullhunter', yellPosition) -- say
            player:say("Nooooo! What have you done??", TALKTYPE_MONSTER_SAY, false, 0, yellPosition)
            yellPosition.y = yellPosition.y - 1
            Game.createMonster('barbarian skullhunter', yellPosition)
        end
    else
        return false
    end

    return true
end

function onUseSpoon(player, item, fromPosition, target, toPosition, isHotkey)
    local targetId = target.itemid

    --The Ice Islands Quest
    if targetId == 388 then
        if player:getStorageValue(Storage.TheIceIslands.Questline) >= 20 then
            if player:getStorageValue(Storage.TheIceIslands.SulphurLava) < 1 then
                player:addItem(7247, 1) -- fine sulphur
                player:setStorageValue(Storage.TheIceIslands.SulphurLava, 1)
                toPosition:sendMagicEffect(CONST_ME_MAGIC_RED)
                player:say('You retrive a fine sulphur from a lava hole.', TALKTYPE_MONSTER_SAY)
            end
        end

    elseif targetId == 4184 then
        if player:getStorageValue(Storage.TheIceIslands.Questline) >= 20 then
            if player:getStorageValue(Storage.TheIceIslands.SporesMushroom) < 1 then
                player:addItem(7251, 1)
                player:setStorageValue(Storage.TheIceIslands.SporesMushroom, 1)
                toPosition:sendMagicEffect(CONST_ME_MAGIC_RED)
                player:say('You retrive spores from a mushroom.', TALKTYPE_MONSTER_SAY)
            end
        end

    -- What a foolish Quest - Mission 8 (Sulphur)
    elseif targetId == 8573 or targetId == 388 then
        if player:getStorageValue(Storage.WhatAFoolishQuest.Questline) ~= 21
                or player:getStorageValue(Storage.WhatAFoolishQuest.InflammableSulphur) == 1 then
            return false
        end

        player:setStorageValue(Storage.WhatAFoolishQuest.InflammableSulphur, 1)
        player:addItem(8204, 1) -- easily inflammable sulphur
        toPosition:sendMagicEffect(CONST_ME_YELLOW_RINGS)
    else
        return false
    end

    return true
end

function onUseScythe(player, item, fromPosition, target, toPosition, isHotkey)
    if not isInArray({2550, 10513}, item.itemid) then
        return false
    end

    local targetId, targetActionId = target.itemid, target.actionid
    if targetId == 5465 then
        target:transform(5464)
        target:decay()
        Game.createItem(5467, 1, toPosition)
        return true
    end

    if targetId == 2739 then
        target:transform(2737)
        target:decay()
        Game.createItem(2694, 1, toPosition)
        return true
    end
        -- Secret Library
    if targetActionId == 64028 then
        player:teleportTo(Position(32515, 32535, 12))
        return true
    end

    return onDestroyItem(player, item, fromPosition, target, toPosition, isHotkey)
end

function onUseSickle(player, item, fromPosition, target, toPosition, isHotkey)
    if target.itemid == 5465 then
        target:transform(5464)
        target:decay()
        Game.createItem(5467, 1, toPosition)
    end
    return true
end

function onUseKitchenKnife(player, item, fromPosition, target, toPosition, isHotkey)
    if not isInArray({2566, 10511, 10515}, item.itemid) then
        return false
    end

    local targetId = target.itemid

    -- by vikingtibia
    if targetId == 2992 then
        --if player:getStorageValue(Storage.TheIceIslands.Questline) >= 21 then
            --if player:getStorageValue(cid, 41600) >= 0  then
                player:addItem(13159, 1)
                target:transform(2993)
                --player:setStorageValue(Storage.TheIceIslands.FrostbiteHerb, 1)
                toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
                player:say('You cut a Rabbits Foot from a rabbit.', TALKTYPE_MONSTER_SAY)

        end

    --The Ice Islands Quest
    if targetId == 7261 then
        if player:getStorageValue(Storage.TheIceIslands.Questline) >= 20 then
            if player:getStorageValue(Storage.TheIceIslands.FrostbiteHerb) < 1 then
                player:addItem(7248, 1)
                player:setStorageValue(Storage.TheIceIslands.FrostbiteHerb, 1)
                toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
                player:say('You cut a leaf from a frostbite herb.', TALKTYPE_MONSTER_SAY)
            end
        end

    elseif targetId == 2733 then
        if player:getStorageValue(Storage.TheIceIslands.Questline) >= 20 then
            if player:getStorageValue(Storage.TheIceIslands.FlowerCactus) < 1 then
                player:addItem(7245, 1)
                player:setStorageValue(Storage.TheIceIslands.FlowerCactus, 1)
                target:transform(2723)
                addEvent(revertItem, 60 * 1000, toPosition, 2723, 2733)
                toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN)
                player:say('You cut a flower from a cactus.', TALKTYPE_MONSTER_SAY)
            end
        end

    elseif targetId == 4017 then
        if player:getStorageValue(Storage.TheIceIslands.Questline) >= 20 then
            if player:getStorageValue(Storage.TheIceIslands.FlowerBush) < 1 then
                player:addItem(7249, 1)
                player:setStorageValue(Storage.TheIceIslands.FlowerBush, 1)
                target:transform(4014)
                addEvent(revertItem, 60 * 1000, toPosition, 4014, 4017)
                toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN)
                player:say('You cut a flower from a bush.', TALKTYPE_MONSTER_SAY)
            end
        end

    -- What a foolish Quest (Mission 1)
    elseif target.actionid == 4200 then
        if toPosition.x == 32349 and toPosition.y == 32361 and toPosition.z == 7 then
            player:addItem(7476, 1)
            player:say('The stubborn flower has ruined your knife but at least you got it.', TALKTYPE_MONSTER_SAY, false, player, toPosition)
            item:remove(1)
        else
            player:say('This flower is too pathetic.', TALKTYPE_MONSTER_SAY, false, player, toPosition)
        end

    -- What a foolish Quest (Mission 5)
    elseif targetId == 7480 then
        if player:getStorageValue(Storage.WhatAFoolishQuest.EmperorBeardShave) == 1 then
            player:say('God shave the emperor. Some fool already did it.', TALKTYPE_MONSTER_SAY)
            return true
        end

        player:setStorageValue(Storage.WhatAFoolishQuest.EmperorBeardShave, 1)
        player:say('This is probably the most foolish thing you\'ve ever done!', TALKTYPE_MONSTER_SAY)
        player:addItem(7479, 1)
        Game.createMonster('dwarf guard', Position(32656, 31853, 13))

    -- What a foolish Quest (Mission <em><em>?</em></em>
    elseif targetId == 4008 then
        if player:getStorageValue(Storage.WhatAFoolishQuest.Questline) ~= 22
                or player:getStorageValue(Storage.WhatAFoolishQuest.SpecialLeaves) == 1 then
            return false
        end

        player:setStorageValue(Storage.WhatAFoolishQuest.SpecialLeaves, 1)
        player:addItem(8109, 1)
        toPosition:sendMagicEffect(CONST_ME_BLOCKHIT)

    elseif isInArray(fruits, targetId) and player:removeItem(6278, 1) then
        target:remove(1)
        player:addItem(6279, 1)
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    else
        return false
    end

    return true
end

 

Erro:

Lua Script Error: [Action Interface]
data/actions/scripts/tools/shovel.lua:onUse
data/actions/lib/actions.lua:322: attempt to index local 'player' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/actions/lib/actions.lua:322: in function <data/actions/lib/actions.
lua:219> 

 

Alguém me da essa força tem meu like vlw.

 

Link para o post
Compartilhar em outros sites

 Boaa

 

Em  data/actions/lib/actions.lua Substitua o código na linha 219: tente assim:

 

function onUseShovel(player, item, fromPosition, target, toPosition, isHotkey)
    local tile = Tile(toPosition)
    if not tile then
        return false
    end

 

Substitua o código na linha 322 tente assim:

 

    elseif isInArray({9632, 20230, 17672, 18586, 18580}, targetId) then
        if player:getStorageValue(Storage.SwampDiggingTimeout) >= os.time() then
            toPosition:sendMagicEffect(CONST_ME_POFF)
            return false
        end

 

 

E em Items data/actions/scripts/tools/shovel.lua vc Substitua por esse:

 

shovel.lua

 

Abçç! 

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

 Boaa

 

Em  data/actions/lib/actions.lua Substitua o código na linha 219: tente assim:

 

function onUseShovel(player, item, fromPosition, target, toPosition, isHotkey)
    local tile = Tile(toPosition)
    if not tile then
        return false
    end

 

Substitua o código na linha 322 tente assim:

 

    elseif isInArray({9632, 20230, 17672, 18586, 18580}, targetId) then
        if player:getStorageValue(Storage.SwampDiggingTimeout) >= os.time() then
            toPosition:sendMagicEffect(CONST_ME_POFF)
            return false
        end

 

 

E em Items data/actions/scripts/tools/shovel.lua vc Substitua por esse:

 

shovel.lua 144 B · 1 download

 

Abçç! 

Boa amigo eu ja estou usando esses códigos. o erro é na 322 no actions.lua

Link para o post
Compartilhar em outros sites

Boa tarde! Segue um script funcional... actions/tools/shovel

local config = {
    swampId = {20230, 18589, 18584, 18141}, -- ids dos tiles de swamp que pode ser usado a shovel
    itemGain = {{itemId = 2818, quantGain = 1}, -- itemid que ganha, e quantidade maxima do msm.
                {itemId = 2145, quantGain = 1},
                {itemId = 20138, quantGain = 1}
                }
}

local exhausth = 3600 --em quantos segundos podera usar denovo


local holes = {468, 481, 483, 7932, 23712}
local pools = {2016, 2017, 2018, 2019, 2020, 2021, 2025, 2026, 2027, 2028, 2029, 2030}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray(pools, itemEx.itemid) then
        itemEx = Tile(toPosition):getGround()
    end
    if(isInArray(config.swampId, itemEx.itemid)) then
        if (getPlayerStorageValue(cid, 32901) <= os.time()) then
        if math.random(0,500) > 255 then
            local posGain = math.random(1, #config.itemGain)
            local quantGain = math.random(1,config.itemGain[posGain].quantGain)
            doPlayerAddItem(cid, config.itemGain[posGain].itemId, quantGain)
            doSendMagicEffect(toPosition, 8)
            doCreatureSay(cid,  "You dug up ".. quantGain .." ".. getItemName(config.itemGain[posGain].itemId) ..".", TALKTYPE_ORANGE_1)  
            setPlayerStorageValue(cid, 32901, os.time()+exhausth)  
        end
    else
            doPlayerSendCancel(cid, "You are exhausted, use again in 1 hour.")
        end
    else
        return shovelNormal(cid, item, fromPosition, itemEx, toPosition)
    end
    return true
end

function shovelNormal(cid, item, fromPosition, itemEx, toPosition)
local target = itemEx
    local player = Player(cid)
    local iEx = Item(itemEx.uid)
    if isInArray(holes, itemEx.itemid) then
        iEx:transform(itemEx.itemid + 1)
        iEx:decay()
 elseif isInArray(pools, target.itemid) then
        local hole = 0
        for i = 1, #holes do
            local tile = Tile(target:getPosition()):getItemById(holes[i])
            if tile then
                hole = tile
            end
        end
        if hole ~= 0 then
            hole:transform(hole:getId() + 1)
            hole:decay()
        else
            return false
        end   
    elseif itemEx.itemid == 231 or itemEx.itemid == 9059 or itemEx.itemid == 22672 then
        local rand = math.random(1, 100)
        if(itemEx.actionid  == 100 and rand <= 20) then
        iEx:transform(489)
        iEx:decay()
        elseif rand == 1 then
            Game.createItem(2159, 1, toPosition)
        elseif rand > 95 then
            Game.createMonster("Scarab", toPosition)
        end
        toPosition:sendMagicEffect(CONST_ME_POFF)
    elseif itemEx.actionid == 4654 and player:getStorageValue(9925) == 1 and player:getStorageValue(9926) < 1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You found a piece of the scroll. You pocket it quickly.')
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        player:addItem(21250, 1)
        player:setStorageValue(9926, 1)
    elseif itemEx.actionid == 4668 and player:getStorageValue(12902) == 1 and player:getStorageValue(12903) < 1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'A torn scroll piece emerges. Probably gnawed off by rats.')
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        player:addItem(21250, 1)
        player:setStorageValue(12903, 1)
    else
        return false
    end
    return true
end

 

Espero ter ajudado

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