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.

data\actions\scripts\lua:
The levers aren't responding at all and aren't changing their position. What could be the cause? Thanks for any suggestions.

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.