Kodak
Member
- Joined
- Jun 7, 2007
- Messages
- 36
- Reaction score
- 6
So I'm working on fixing an ORTS issue I've ran into with the Third Seal of the Banshee quest. The levers don't move, have proper uid, but are not working. I've messed with it and can't figure it out. Searched around some, nothing I could find on OTland, but there was a report on the ORTS GitHub about the problem but it just got brushed off as another user reported "Works fine for me". It references a storage value "switchNum" but it wasn't listed in the associated storage values, so I added it but it didn't fix things. No errors appear in the console. Thanks for any help provided.
Here's the scripts
Lever Script:
Related Movement Script:
Associated Storage Values:
Here's the scripts
Lever Script:
Lua:
local function doTransformCoalBasins(cbPos)
local tile = Position(cbPos):getTile()
if tile then
local thing = tile:getItemById(1485)
if thing then
thing:transform(1484)
end
end
end
local config = {
[0] = 50015,
[1] = 50016,
[2] = 50017,
[3] = 50018,
[4] = 50019,
coalBasins = {
{x = 32214, y = 31850, z = 15},
{x = 32215, y = 31850, z = 15},
{x = 32216, y = 31850, z = 15}
},
effects = {
[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)
local switchNum = Game.getStorageValue("switchNum")
if switchNum == -1 then
Game.setStorageValue("switchNum", 0)
end
local table = config[switchNum]
if not table then
return true
end
if player:getStorageValue(Storage.QueenOfBansheesQuest.ThirdSeal) == -1 then
if item.uid == table then
item:transform(1945)
Game.setStorageValue("switchNum", math.max(1, Game.getStorageValue("switchNum") + 1))
toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
for i = 1, #config.effects[switchNum] do
Position(config.effects[switchNum][i]):sendMagicEffect(CONST_ME_ENERGYHIT)
end
if Game.getStorageValue("switchNum") == 5 then
for i = 1, #config.coalBasins do
doTransformCoalBasins(config.coalBasins[i])
end
end
else
toPosition:sendMagicEffect(CONST_ME_ENERGYHIT)
end
else
return false
end
return true
end
Related Movement Script:
Lua:
local config = {
[0] = 50015,
[1] = 50016,
[2] = 50017,
[3] = 50018,
[4] = 50019,
basinPositions = {
Position(32214, 31850, 15),
Position(32215, 31850, 15),
Position(32216, 31850, 15)
},
switchPositions = {
Position(32220, 31846, 15),
Position(32220, 31845, 15),
Position(32220, 31844, 15),
Position(32220, 31843, 15),
Position(32220, 31842, 15)
},
destination = Position(32271, 31857, 15)
}
local function resetItem(position, itemId, transformId)
local item = Tile(position):getItemById(itemId)
if item then
item:transform(transformId)
end
end
function onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
return true
end
if player:getStorageValue(Storage.QueenOfBansheesQuest.ThirdSeal) >= 1 or Game.getStorageValue('switchNum') ~= 5 then
player:teleportTo(fromPosition)
fromPosition:sendMagicEffect(CONST_ME_TELEPORT)
return true
end
player:setStorageValue(Storage.QueenOfBansheesQuest.ThirdSeal, 1)
Game.setStorageValue('switchNum', 0)
player:teleportTo(config.destination)
config.destination:sendMagicEffect(CONST_ME_TELEPORT)
for i = 1, #config.basinPositions do
resetItem(config.basinPositions[i], 1484, 1485)
end
for i = 1, #config.switchPositions do
resetItem(config.switchPositions[i], 1945, 1946)
end
return true
end
Associated Storage Values:
Lua:
QueenOfBansheesQuest = {
FirstSeal = 50013,
SecondSeal = 50019,
ThirdSeal = 50018,
FourthSeal = 50016,
FifthSeal = 50015,
SixthSeal = 50014,
LastSeal = 50021,
ThirdSealWarlocks = 50017,
Kiss = 50020
},