• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Banshee Quest lever

Xarah

Member
Joined
Apr 18, 2018
Messages
42
Reaction score
8
Hey, I need help with a script for the Banshee Quest, the levers are not responding.
1727089169614.webp

data\actions\scripts\lua:

LUA:
local function doTransformCoalBasins(cbPos)
    local tile = Tile(cbPos)
    if tile then
        local thing = tile:getItemById(1485) -- We are checking if there is an item with ID 1485
        if thing then
            thing:transform(1484) -- We are transforming the item to ID 1484
        end
    end
end

local config = {
    [0] = 50015, -- UID of the lever
    [1] = 50016,
    [2] = 50017,
    [3] = 50018,
    [4] = 50019,
    coalBasins = { -- Positions of the coal basins
        {x = 32214, y = 31850, z = 15},
        {x = 32215, y = 31850, z = 15},
        {x = 32216, y = 31850, z = 15}
    },
    effects = { -- Visual effects after activating the lever
        [0] = {
            {x = 32217, y = 31845, z = 14},
            {x = 32218, y = 31845, z = 14},
            {x = 32219, y = 31845, z = 14},
            {x = 32220, y = 31845, z = 14},
            {x = 32217, y = 31843, z = 14},
            {x = 32218, y = 31842, z = 14},
            {x = 32219, y = 31841, z = 14}
        },
        [1] = {
            {x = 32217, y = 31844, z = 14},
            {x = 32218, y = 31844, z = 14},
            {x = 32219, y = 31843, z = 14},
            {x = 32220, y = 31845, z = 14},
            {x = 32219, y = 31845, z = 14}
        },
        [2] = {
            {x = 32217, y = 31842, z = 14},
            {x = 32219, y = 31843, z = 14},
            {x = 32219, y = 31845, z = 14},
            {x = 32218, y = 31844, z = 14},
            {x = 32217, y = 31844, z = 14},
            {x = 32217, y = 31845, z = 14}
        },
        [3] = {
            {x = 32217, y = 31845, z = 14},
            {x = 32218, y = 31846, z = 14},
            {x = 32218, y = 31844, z = 14},
            {x = 32219, y = 31845, z = 14},
            {x = 32220, y = 31846, z = 14}
        },
        [4] = {
            {x = 32219, y = 31841, z = 14},
            {x = 32219, y = 31842, z = 14},
            {x = 32219, y = 31846, z = 14},
            {x = 32217, y = 31843, z = 14},
            {x = 32217, y = 31844, z = 14},
            {x = 32217, y = 31845, z = 14},
            {x = 32218, y = 31843, z = 14},
            {x = 32218, y = 31845, z = 14}
        }
    }
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    -- We retrieve the stored value of switchNum
    local switchNum = Game.getStorageValue("switchNum")
    if switchNum == -1 or switchNum == nil then
        switchNum = 0
        Game.setStorageValue("switchNum", 0)
    end

    -- We retrieve the UID of the lever from the config table.
    local currentUID = config[switchNum]
    if not currentUID then
        return true
    end

    -- We check if the player has already completed this stage of the quest.
    if player:getStorageValue(Storage.QueenOfBansheesQuest.ThirdSeal) < 1 then
        -- If the UID of the lever matches, we activate it.
        if item.uid == currentUID then
            item:transform(1945) -- We change the state of the lever
            Game.setStorageValue("switchNum", Game.getStorageValue("switchNum") + 1) -- We increase the count of activated levers
            toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE) -- A magic effect at the lever's position
            
            -- We send visual effects to the specified positions
            for i = 1, #config.effects[switchNum] do
                Position(config.effects[switchNum][i]):sendMagicEffect(CONST_ME_ENERGYHIT)
            end

            -- If all levers have been activated (5 levers)
            if Game.getStorageValue("switchNum") == 5 then
                -- We transform the coal basins
                for i = 1, #config.coalBasins do
                    doTransformCoalBasins(config.coalBasins[i])
                end
            end
        else
            toPosition:sendMagicEffect(CONST_ME_ENERGYHIT) -- Effect if the UID of the lever does not match
        end
    else
        return false -- If the player has already completed this stage, the script does not respond
    end
    return true
end



XML:
<action fromuid="50015" touid="50019" script="quests/the queen of the banshees/theThirdSeal.lua" />


The levers aren't responding at all and aren't changing their position. What could be the cause? Thanks for any suggestions.
 
Perhaps your storage value is incorrect for the player you are trying to test with. You should use prints to see what your code is doing.

try adding:
print("Started") under the function onUse line so you can make sure the code is actually executing.
 
1727095321322.webp
warlockpiso = 9020 movements
seals5 = actionid="32996" = movements
<action uniqueid="1878;1879;1880;1881;1882" script="banshee/levers_banshee.lua" /> <!--selo warlock-->
levers banshee
Post automatically merged:

now adjust the storages
 

Attachments

Thanks for your response. Using your scripts, I adjusted my action IDs (aid) and unique IDs (uid), but it still didn’t work. Then I did exactly as you suggested, and it still didn’t work. The problem is that the script doesn't run at all, and the levers don't change their position. It behaves as if the script is not being recognized.
 

Similar threads

Replies
16
Views
481
Back
Top