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

RevScripts Kroazur bug: Someone is fighting against the boss!

Hyagosrs

Member
Joined
Mar 10, 2018
Messages
88
Solutions
1
Reaction score
8
if I go into the teleport and leave, the kroazur is born and stays inside the boss's room, but the next time I try to enter, and he is inside, says this message: Someone is fighting against the boss! You need wait awhile.

this is my script:
Lua:
local config = {
    [24900] = {
        timer = Storage.ThreatenedDreams.KroazurTimer,
        range = 20,
        newPos = Position(33591, 32315, 10),
        bossName = 'Kroazur',
        bossPos = Position(33591, 32305, 10)
    }
}

local kroazurEntrance = MoveEvent()

function kroazurEntrance.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return
    end

    local teleport = config[item.actionid]
    if not teleport then
        return
    end

    if player:getStorageValue(teleport.timer) > os.time() then
        position:sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(fromPosition, true)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:say('You have to wait to challenge this enemy again!', TALKTYPE_MONSTER_SAY)
        return true
    end

    if roomIsOccupied(teleport.bossPos, teleport.range, teleport.range) then
        position:sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(fromPosition, true)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:say('Someone is fighting against the boss! You need wait awhile.', TALKTYPE_MONSTER_SAY)
        return true
    end
    clearRoom(teleport.bossPos, teleport.range, teleport.range, fromPosition)
    local monster = Game.createMonster(teleport.bossName, teleport.bossPos, true, true)
    if not monster then
        return true
    end

    position:sendMagicEffect(CONST_ME_TELEPORT)
    player:teleportTo(teleport.newPos)
    player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    player:say(
        'You have ten minutes to kill and loot this boss. \z
        Otherwise you will lose that chance and will be kicked out.', TALKTYPE_MONSTER_SAY)
    addEvent(clearBossRoom, 60 * 10 * 1000, player.uid, monster.uid, teleport.bossPos, teleport.range, teleport.range, fromPosition)
    player:setStorageValue(teleport.timer, os.time() + 2 * 3600)
    return true
end

kroazurEntrance:type("stepin")
kroazurEntrance:aid(24900)
kroazurEntrance:register()

does anyone have an idea?
 

Fortera Global

Intermediate OT User
Joined
Nov 20, 2015
Messages
1,147
Solutions
2
Reaction score
107
Lua:
local config = {
    [24900] = {
        timer = Storage.ThreatenedDreams.KroazurTimer,
        range = 16,
        newPos = Position(33591, 32315, 10),
        bossName = 'Kroazur',
        bossPos = Position(33593, 32307, 10) 
    }
}

local kroazurEntrance = MoveEvent()

function kroazurEntrance.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return
    end

    local teleport = config[item.actionid]
    if not teleport then
        return
    end

    if player:getStorageValue(teleport.timer) > os.time() then
        position:sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(fromPosition, true)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:say('You have to wait to challenge this enemy again!', TALKTYPE_MONSTER_SAY)
        return true
    end

    if roomIsOccupied(teleport.bossPos, teleport.range, teleport.range) then
        position:sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(fromPosition, true)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:say('Someone is fighting against the boss! You need wait awhile.', TALKTYPE_MONSTER_SAY)
        return true
    end
    clearRoom(teleport.bossPos, teleport.range, teleport.range, fromPosition)
    local monster = Game.createMonster(teleport.bossName, teleport.bossPos, true, true)
    if not monster then
        return true
    end

    position:sendMagicEffect(CONST_ME_TELEPORT)
    player:teleportTo(teleport.newPos)
    player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    player:say(
        'You have ten minutes to kill and loot this boss. \z
        Otherwise you will lose that chance and will be kicked out.', TALKTYPE_MONSTER_SAY)
    addEvent(clearBossRoom, 60 * 10 * 1000, player.uid, monster.uid, teleport.bossPos, teleport.range, teleport.range, fromPosition)
    player:setStorageValue(teleport.timer, os.time() + 2 * 3600)
    return true
end

kroazurEntrance:type("stepin")
kroazurEntrance:aid(24900)
kroazurEntrance:register()
 
Top