• 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!

Lua Erro Boss Duke Krule TFS 1.5 downgrade 8.6

Azerty

Active Member
Joined
Apr 15, 2022
Messages
318
Solutions
4
Reaction score
34
Can anyone help me with this error?

1713006854879.png

Lua:
local levers = {
    {leverPos = {x = 33515, y = 31444, z = 13}, teleportTo = Position({x = 33489, y = 31441, z = 13}), bossName = "Earl Osam", bossPos = Position({x = 33488, y = 31435, z = 13})},--Cormaya
    {leverPos = {x = 33454, y = 31413, z = 13}, teleportTo = Position({x = 33457, y = 31442, z = 13}), bossName = "Count Vlarkorth", bossPos = Position({x = 33457, y = 31433, z = 13})},--Edron
    {leverPos = {x = 33421, y = 31493, z = 13}, teleportTo = Position({x = 33425, y = 31480, z = 13}), bossName = "Lord Azaram", bossPos = Position({x = 33425, y = 31466, z = 13})},--Ghostland
    {leverPos = {x = 33423, y = 31413, z = 13}, teleportTo = Position({x = 33425, y = 31431, z = 13}), bossNames = {"Sir Baeloc", "Sir Nictros"}, bossPos = {Position({x = 33422, y = 31428, z = 13}), Position({x = 33427, y = 31428, z = 13})}},--Darashia
    {leverPos = {x = 33454, y = 31493, z = 13}, teleportTo = Position({x = 33456, y = 31477, z = 13}), bossName = "Duke Krule", bossPos = Position({x = 33456, y = 31468, z = 13})}--Thais
}

local function StartBattle(bossPos)
    local boss = Tile(bossPos):getTopCreature()
    if boss and boss:isMonster() then
        boss:teleportTo(Position({x = 33427, y = 31436, z = 13}))
    end
end

local lever = Action()
function lever.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    for b = 1, #levers do
        if item:getPosition() == Position(levers[b].leverPos) then
            for c = levers[b].leverPos.x + 1, levers[b].leverPos.x + 5 do
                local adventurers = Tile(Position(c, levers[b].leverPos.y, levers[b].leverPos.z)):getTopCreature()
                if adventurers and adventurers:isPlayer() then
                    adventurers:teleportTo(levers[b].teleportTo)
                end
            end
            if levers[b].bossNames then
                Game.createMonster(levers[b].bossNames[1], levers[b].bossPos[1]):registerEvent("SirBaelocThink")
                Game.createMonster(levers[b].bossNames[2], levers[b].bossPos[2]):registerEvent("SirNictrosThink")
                addEvent(StartBattle, 15 * 1000, levers[b].bossPos[2])
            else
                Game.createMonster(levers[b].bossName, levers[b].bossPos)
            end
        end
    end
    return true
end

for a = 1, #levers do
    lever:position(levers[a].leverPos)
end
lever:register()
 
Basically you're using Position incorrectly.

incorrect
Lua:
Position({x = 33489, y = 31441, z = 13})
correct
Lua:
Position(33489, 31441, 13)

So throughout your code, you need to update all your position data to the correct usage.
 
same error

Lua:
local levers = {
    {leverPos = Position(33515, 31444, 13), teleportTo = Position(33489, 31441, 13), bossName = "Earl Osam", bossPos = Position(33488, 31435, 13)}, -- Cormaya
    {leverPos = Position(33454, 31413, 13), teleportTo = Position(33457, 31442, 13), bossName = "Count Vlarkorth", bossPos = Position(33457, 31433, 13)}, -- Edron
    {leverPos = Position(33421, 31493, 13), teleportTo = Position(33425, 31480, 13), bossName = "Lord Azaram", bossPos = Position(33425, 31466, 13)}, -- Ghostland
    {leverPos = Position(33423, 31413, 13), teleportTo = Position(33425, 31431, 13), bossNames = {"Sir Baeloc", "Sir Nictros"}, bossPos = {Position(33422, 31428, 13), Position(33427, 31428, 13)}}, -- Darashia
    {leverPos = Position(33454, 31493, 13), teleportTo = Position(33456, 31477, 13), bossName = "Duke Krule", bossPos = Position(33456, 31468, 13)} -- Thais
}

local function StartBattle(bossPos)
    local boss = Tile(bossPos):getTopCreature()
    if boss and boss:isMonster() then
        boss:teleportTo(Position(33427, 31436, 13))
    end
end

local lever = Action()
function lever.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    for b = 1, #levers do
        if item:getPosition() == levers[b].leverPos then
            for c = levers[b].leverPos.x + 1, levers[b].leverPos.x + 5 do
                local adventurers = Tile(Position(c, levers[b].leverPos.y, levers[b].leverPos.z)):getTopCreature()
                if adventurers and adventurers:isPlayer() then
                    adventurers:teleportTo(levers[b].teleportTo)
                end
            end
            if levers[b].bossNames then
                Game.createMonster(levers[b].bossNames[1], levers[b].bossPos[1]):registerEvent("SirBaelocThink")
                Game.createMonster(levers[b].bossNames[2], levers[b].bossPos[2]):registerEvent("SirNictrosThink")
                addEvent(StartBattle, 15 * 1000, levers[b].bossPos[2])
            else
                Game.createMonster(levers[b].bossName, levers[b].bossPos)
            end
        end
    end
    return true
end

for a = 1, #levers do
    lever:position(levers[a].leverPos)
end
lever:register()
Post automatically merged:

Basically you're using Position incorrectly.

incorrect
Lua:
Position({x = 33489, y = 31441, z = 13})
correct
Lua:
Position(33489, 31441, 13)

So throughout your code, you need to update all your position data to the correct usage.
same error
 
same error

Lua:
local levers = {
    {leverPos = Position(33515, 31444, 13), teleportTo = Position(33489, 31441, 13), bossName = "Earl Osam", bossPos = Position(33488, 31435, 13)}, -- Cormaya
    {leverPos = Position(33454, 31413, 13), teleportTo = Position(33457, 31442, 13), bossName = "Count Vlarkorth", bossPos = Position(33457, 31433, 13)}, -- Edron
    {leverPos = Position(33421, 31493, 13), teleportTo = Position(33425, 31480, 13), bossName = "Lord Azaram", bossPos = Position(33425, 31466, 13)}, -- Ghostland
    {leverPos = Position(33423, 31413, 13), teleportTo = Position(33425, 31431, 13), bossNames = {"Sir Baeloc", "Sir Nictros"}, bossPos = {Position(33422, 31428, 13), Position(33427, 31428, 13)}}, -- Darashia
    {leverPos = Position(33454, 31493, 13), teleportTo = Position(33456, 31477, 13), bossName = "Duke Krule", bossPos = Position(33456, 31468, 13)} -- Thais
}

local function StartBattle(bossPos)
    local boss = Tile(bossPos):getTopCreature()
    if boss and boss:isMonster() then
        boss:teleportTo(Position(33427, 31436, 13))
    end
end

local lever = Action()
function lever.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    for b = 1, #levers do
        if item:getPosition() == levers[b].leverPos then
            for c = levers[b].leverPos.x + 1, levers[b].leverPos.x + 5 do
                local adventurers = Tile(Position(c, levers[b].leverPos.y, levers[b].leverPos.z)):getTopCreature()
                if adventurers and adventurers:isPlayer() then
                    adventurers:teleportTo(levers[b].teleportTo)
                end
            end
            if levers[b].bossNames then
                Game.createMonster(levers[b].bossNames[1], levers[b].bossPos[1]):registerEvent("SirBaelocThink")
                Game.createMonster(levers[b].bossNames[2], levers[b].bossPos[2]):registerEvent("SirNictrosThink")
                addEvent(StartBattle, 15 * 1000, levers[b].bossPos[2])
            else
                Game.createMonster(levers[b].bossName, levers[b].bossPos)
            end
        end
    end
    return true
end

for a = 1, #levers do
    lever:position(levers[a].leverPos)
end
lever:register()
Post automatically merged:


same error
Ah I see.
It is an action script.. So you can't use the position of the lever to register it.
You would need to register it with an aid instead, which would be unique to each lever.
 
Ah I see.
It is an action script.. So you can't use the position of the lever to register it.
You would need to register it with an aid instead, which would be unique to each lever.
Oh, it's beyond my knowledge hahaha
 
Oh, it's beyond my knowledge hahaha
If you need to click on an item to interact with it, what can be used to identify the item being used?
The position of the item won't help you figure that out.

You need something more specific.


It's just like your actions.xml file.
It only accepts specific methods.

In this case, actionId's (aid) would be the best way to distinguish the levers from each other.
 
Back
Top