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

TFS 1.4.2 small boss room issue

Mr Noxi

Noxus Otserver
Joined
May 13, 2010
Messages
272
Solutions
3
Reaction score
95
Location
Sweden
Hey there!

So i've got this script for boss room in revscripys that works perfectly as long as i dont duplicate it.

EDIT: Script taken from Otland ofc Link to script

I have tripple checked the xyz positions, changed lever Ids, Storage Ids, the script works as i get entered into the boss room and able to kill the boss but no teleport is spawned after the "boss" is dead. the script gets loaded without any issues and no errors upon console eaither

Even tried to change
Code:
local creatureEvent = CreatureEvent("bossSystemDeathBossOne")
to another name if that even matters, the first copy of the script has
Code:
local creatureEvent = CreatureEvent("bossSystemDeath")
but even with same name of "bossSystemDeath" it wont work and am out of solutions.. why does the first copy of the script with diffrent xyz work but the second one does not?

Help me please!! Frustration level 100.

Code below
Lua:
local config = {
    actionId = 30016, -- ActionID to use in the lever
    bossName = "Ragiaz",
    bossPosition = Position(682, 1319, 7),    -- Position where the boss will appear
    bossArea = {
        fromPos = Position(678, 1312, 7), -- Upper left corner of the room
        toPos = Position(690, 1326, 7), -- Lower right corner of the room

        entrancePos = Position(685, 1319, 7), -- Position where players will be teleported when they enter
        exitPosition = Position(693, 1336, 7) -- If the participants take too long they will be kicked from the room to this position
    },

    participantsPos = {
        Position(692, 1335, 7), -- Player 1, this player should be the one to pull the lever
        Position(691, 1335, 7), -- Player 2
        Position(691, 1336, 7), -- Player 3
        Position(691, 1337, 7) -- Player 4
    },
    attempts = {
        level = 100, -- Level required to enter
        storage = 1251, -- Storage where we keep the waiting time
        seconds = 1 -- 20 hours
    },
    createTeleportPos = Position(681, 1319, 7), -- Position where the teleport is created when the boss dies
    teleportToPosition = Position(676, 1340, 7), -- Position where the teleport created by the boss will take you when you die
    teleportRemoveSeconds = 1000, -- seconds
    kickParticipantAfterSeconds = 60 * 10, -- 10 minutes
    leverIds = {1945, 1946} -- Lever animation, on/off
}

local function getSpectators()
    if not config.centerPosition then
        config.diffX = math.ceil((config.bossArea.toPos.x - config.bossArea.fromPos.x) / 2)
        config.diffY = math.ceil((config.bossArea.toPos.y - config.bossArea.fromPos.y) / 2)
        config.centerPosition = config.bossArea.fromPos + Position(config.diffX, config.diffY, 0)
    end
    return Game.getSpectators(config.centerPosition, false, false, config.diffX, config.diffX, config.diffY, config.diffY)
end

local action = Action()

function action.onUse(player, item, fromPos, target, toPos, isHotkey)
    local participants = {}
    for index, pos in pairs(config.participantsPos) do
        local tile = Tile(pos)
        if not tile then error("[Warning - Tile not found]") end
        local participant = tile:getTopVisibleCreature(player)
        if participant and participant:isPlayer() then
            if index == 1 and participant ~= player then
                player:sendCancelMessage("Only the first participant can pull the lever.")
                return true
            end

            if participant:getStorageValue(config.attempts.storage) >= os.time() then
                player:sendCancelMessage(string.format("The player %s must wait a while before being able to enter again.", participant:getName()))
                return true
            elseif participant:getLevel() < config.attempts.level then
                player:sendCancelMessage(string.format("The player %s is not level %d.", participant:getName(), config.attempts.level))
                return true
            end

            participants[#participants +1] = participant
        elseif not participantsAllowAnyCount then
            player:sendCancelMessage("Participants are missing.")
            return true
        end
    end

    local spectators = getSpectators()
    for _, spectator in pairs(spectators) do
        if spectator:isPlayer() then
            player:sendCancelMessage("At this time the room is occupied, please try again later.")
            return true
        end
    end

    for _, spectator in pairs(spectators) do spectator:remove() end
    local boss = Game.createMonster(config.bossName, config.bossPosition)
    if not boss then error(Game.getReturnMessage(RETURNVALUE_NOTENOUGHROOM)) end
    boss:registerEvent("bossSystemDeath")
    for index, participant in pairs(participants) do
        config.participantsPos[index]:sendMagicEffect(CONST_ME_POFF)
        participant:teleportTo(config.bossArea.entrancePos, false)
        config.bossArea.entrancePos:sendMagicEffect(CONST_ME_TELEPORT)
        participant:setStorageValue(config.attempts.storage, os.time() + config.attempts.seconds)
    end

    config.kickEventId = addEvent(function ()
        for _, spectator in pairs(getSpectators()) do
            if spectator:isPlayer() then
                spectator:getPosition():sendMagicEffect(CONST_ME_POFF)
                spectator:teleportTo(config.bossArea.exitPosition, false)
                config.bossArea.exitPosition:sendMagicEffect(CONST_ME_TELEPORT)
                spectator:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The boss was not killed within the time. Feel free to try again.")
            else
                spectator:remove()
            end
        end
    end, config.kickParticipantAfterSeconds * 1000)

    item:transform(item:getId() == config.leverIds[1] and config.leverIds[2] or config.leverIds[1])
    return true
end

action:aid(config.actionId)
action:register()

local creatureEvent = CreatureEvent("bossSystemDeathBossOne")

function creatureEvent.onDeath()
    stopEvent(config.kickEventId)
    local teleport = Game.createItem(1387, 1, config.createTeleportPos)
    if teleport then
        teleport:setDestination(config.teleportToPosition)
        addEvent(function ()
            local tile = Tile(config.createTeleportPos)
            if tile then
                local teleport = tile:getItemById(1387)
                if teleport then
                    teleport:remove()
                    config.teleportToPosition:sendMagicEffect(CONST_ME_POFF)
                end
            end

            for _, spectator in pairs(getSpectators()) do
                if spectator:isPlayer() then
                    spectator:getPosition():sendMagicEffect(CONST_ME_POFF)
                    spectator:teleportTo(config.teleportToPosition, false)
                    config.teleportToPosition:sendMagicEffect(CONST_ME_TELEPORT)
                end
            end
        end, config.teleportRemoveSeconds * 1000)
    end
    return true
end

creatureEvent:register()
Post automatically merged:

Hey there!

So i've got this script for boss room in revscripys that works perfectly as long as i dont duplicate it.

EDIT: Script taken from Otland ofc Link to script

I have tripple checked the xyz positions, changed lever Ids, Storage Ids, the script works as i get entered into the boss room and able to kill the boss but no teleport is spawned after the "boss" is dead. the script gets loaded without any issues and no errors upon console eaither

Even tried to change
Code:
local creatureEvent = CreatureEvent("bossSystemDeathBossOne")
to another name if that even matters, the first copy of the script has
Code:
local creatureEvent = CreatureEvent("bossSystemDeath")
but even with same name of "bossSystemDeath" it wont work and am out of solutions.. why does the first copy of the script with diffrent xyz work but the second one does not?

Help me please!! Frustration level 100.

Code below
Lua:
local config = {
    actionId = 30016, -- ActionID to use in the lever
    bossName = "Ragiaz",
    bossPosition = Position(682, 1319, 7),    -- Position where the boss will appear
    bossArea = {
        fromPos = Position(678, 1312, 7), -- Upper left corner of the room
        toPos = Position(690, 1326, 7), -- Lower right corner of the room

        entrancePos = Position(685, 1319, 7), -- Position where players will be teleported when they enter
        exitPosition = Position(693, 1336, 7) -- If the participants take too long they will be kicked from the room to this position
    },

    participantsPos = {
        Position(692, 1335, 7), -- Player 1, this player should be the one to pull the lever
        Position(691, 1335, 7), -- Player 2
        Position(691, 1336, 7), -- Player 3
        Position(691, 1337, 7) -- Player 4
    },
    attempts = {
        level = 100, -- Level required to enter
        storage = 1251, -- Storage where we keep the waiting time
        seconds = 1 -- 20 hours
    },
    createTeleportPos = Position(681, 1319, 7), -- Position where the teleport is created when the boss dies
    teleportToPosition = Position(676, 1340, 7), -- Position where the teleport created by the boss will take you when you die
    teleportRemoveSeconds = 1000, -- seconds
    kickParticipantAfterSeconds = 60 * 10, -- 10 minutes
    leverIds = {1945, 1946} -- Lever animation, on/off
}

local function getSpectators()
    if not config.centerPosition then
        config.diffX = math.ceil((config.bossArea.toPos.x - config.bossArea.fromPos.x) / 2)
        config.diffY = math.ceil((config.bossArea.toPos.y - config.bossArea.fromPos.y) / 2)
        config.centerPosition = config.bossArea.fromPos + Position(config.diffX, config.diffY, 0)
    end
    return Game.getSpectators(config.centerPosition, false, false, config.diffX, config.diffX, config.diffY, config.diffY)
end

local action = Action()

function action.onUse(player, item, fromPos, target, toPos, isHotkey)
    local participants = {}
    for index, pos in pairs(config.participantsPos) do
        local tile = Tile(pos)
        if not tile then error("[Warning - Tile not found]") end
        local participant = tile:getTopVisibleCreature(player)
        if participant and participant:isPlayer() then
            if index == 1 and participant ~= player then
                player:sendCancelMessage("Only the first participant can pull the lever.")
                return true
            end

            if participant:getStorageValue(config.attempts.storage) >= os.time() then
                player:sendCancelMessage(string.format("The player %s must wait a while before being able to enter again.", participant:getName()))
                return true
            elseif participant:getLevel() < config.attempts.level then
                player:sendCancelMessage(string.format("The player %s is not level %d.", participant:getName(), config.attempts.level))
                return true
            end

            participants[#participants +1] = participant
        elseif not participantsAllowAnyCount then
            player:sendCancelMessage("Participants are missing.")
            return true
        end
    end

    local spectators = getSpectators()
    for _, spectator in pairs(spectators) do
        if spectator:isPlayer() then
            player:sendCancelMessage("At this time the room is occupied, please try again later.")
            return true
        end
    end

    for _, spectator in pairs(spectators) do spectator:remove() end
    local boss = Game.createMonster(config.bossName, config.bossPosition)
    if not boss then error(Game.getReturnMessage(RETURNVALUE_NOTENOUGHROOM)) end
    boss:registerEvent("bossSystemDeath")
    for index, participant in pairs(participants) do
        config.participantsPos[index]:sendMagicEffect(CONST_ME_POFF)
        participant:teleportTo(config.bossArea.entrancePos, false)
        config.bossArea.entrancePos:sendMagicEffect(CONST_ME_TELEPORT)
        participant:setStorageValue(config.attempts.storage, os.time() + config.attempts.seconds)
    end

    config.kickEventId = addEvent(function ()
        for _, spectator in pairs(getSpectators()) do
            if spectator:isPlayer() then
                spectator:getPosition():sendMagicEffect(CONST_ME_POFF)
                spectator:teleportTo(config.bossArea.exitPosition, false)
                config.bossArea.exitPosition:sendMagicEffect(CONST_ME_TELEPORT)
                spectator:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The boss was not killed within the time. Feel free to try again.")
            else
                spectator:remove()
            end
        end
    end, config.kickParticipantAfterSeconds * 1000)

    item:transform(item:getId() == config.leverIds[1] and config.leverIds[2] or config.leverIds[1])
    return true
end

action:aid(config.actionId)
action:register()

local creatureEvent = CreatureEvent("bossSystemDeathBossOne")

function creatureEvent.onDeath()
    stopEvent(config.kickEventId)
    local teleport = Game.createItem(1387, 1, config.createTeleportPos)
    if teleport then
        teleport:setDestination(config.teleportToPosition)
        addEvent(function ()
            local tile = Tile(config.createTeleportPos)
            if tile then
                local teleport = tile:getItemById(1387)
                if teleport then
                    teleport:remove()
                    config.teleportToPosition:sendMagicEffect(CONST_ME_POFF)
                end
            end

            for _, spectator in pairs(getSpectators()) do
                if spectator:isPlayer() then
                    spectator:getPosition():sendMagicEffect(CONST_ME_POFF)
                    spectator:teleportTo(config.teleportToPosition, false)
                    config.teleportToPosition:sendMagicEffect(CONST_ME_TELEPORT)
                end
            end
        end, config.teleportRemoveSeconds * 1000)
    end
    return true
end

creatureEvent:register()
Fixed the issue,

Apperently there was another register
Lua:
    boss:registerEvent("bossSystemDeath")
at line 80 that i totaly missed xD

3 hours and a single line was the issue
frustrated chloe sevigny GIF by Portlandia
 
Last edited:
Back
Top