• 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 Task boss room

Competitibia

Pain & Glory WHole
Joined
Apr 1, 2021
Messages
545
Solutions
3
Reaction score
210
Code does not give 10 minutes it never kicks
Lua:
local monster = "The Horned Fox"
function onStepIn(cid, item, frompos, item2, topos)
    local room = { -- room with Hide
    fromX = 33300,
    fromY = 32277,
    fromZ = 13,
    toX = 33316,
    toY = 32293,
    toZ = 13}
    local config = {
bosspos = {
{x=33308,y=32280,z=13}, -- position where boss first spawns
},
boss = "The Horned Fox", -- name of the boss
from = {{x = 33300, y = 32277, z = 13}},
to = {{x = 33316, y = 32293, z = 13}},
}
    local player_pos = {x=33308, y=32288, z=13}
    local cansel_pos = {x=33308, y=32285, z=12}

    if item.uid == 34254 then
    killedhide = getPlayerStorageValue(cid,34254)
        if killedhide == -1 then
        local monster_room = false
        local monsters = {}
        local i = 1
            for x = room.fromX, room.toX do
                for y = room.fromY, room.toY do
                    for z = room.fromZ, room.toZ do
                        local pos = {x=x, y=y, z=z,stackpos = 253}
                        local thing = getThingfromPos(pos)
                        if isPlayer(thing.uid) then
                            doPlayerSendTextMessage(cid,19,"There is already some one in the quest room.") 
                            return true
                        elseif isMonster(thing.uid) then
                            monsters[i] = getThingfromPos({x=x,y=y,z=areaposrightdown.z,stackpos=253})
                            i = i+1
                            monster_room = true                               
                        end
                    end
                end
            end       
            if monster_room then
                for r = 1, #monsters do
                    doRemoveCreature(monsters[r].uid)
                end
            end
    
        doTeleportThing(cid, player_pos)
        doSummonCreature(config.boss, config.bosspos[1])
        doPlayerSetStorageValue (cid, 34254, 1)
        doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have ten minutes to kill and loot this boss, else you will lose that chance and will be kicked out.')
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You did not complete the task Quest or you have already fought the boss!')
            doTeleportThing(cid, cansel_pos)
        end
    end
    return true
end
 
Last edited:
Solution
Lua:
local room = { -- room with Hide
    fromX = 33300,
    fromY = 32277,
    fromZ = 13,
    toX = 33316,
    toY = 32293,
    toZ = 13}
local config = {
bosspos = {
{x=33308,y=32280,z=13}, -- position where boss first spawns
},
boss = "The Horned Fox", -- name of the boss
from = {{x = 33300, y = 32277, z = 13}},
to = {{x = 33316, y = 32293, z = 13}},
}

local player_pos = {x=33308, y=32288, z=13}
local cansel_pos = {x=33308, y=32285, z=12}

local monster = "The Horned Fox"
function onStepIn(cid, item, frompos, item2, topos)

    if item.uid == 34254 then
    killedboss = getPlayerStorageValue(cid,34254)
        if killedboss == -1 then
        local monster_room = false
        local monsters = {}
        local i = 1
            for x...
Lua:
local room = { -- room with Hide
    fromX = 33300,
    fromY = 32277,
    fromZ = 13,
    toX = 33316,
    toY = 32293,
    toZ = 13}
local config = {
bosspos = {
{x=33308,y=32280,z=13}, -- position where boss first spawns
},
boss = "The Horned Fox", -- name of the boss
from = {{x = 33300, y = 32277, z = 13}},
to = {{x = 33316, y = 32293, z = 13}},
}

local player_pos = {x=33308, y=32288, z=13}
local cansel_pos = {x=33308, y=32285, z=12}

local monster = "The Horned Fox"
function onStepIn(cid, item, frompos, item2, topos)

    if item.uid == 34254 then
    killedboss = getPlayerStorageValue(cid,34254)
        if killedboss == -1 then
        local monster_room = false
        local monsters = {}
        local i = 1
            for x = room.fromX, room.toX do
                for y = room.fromY, room.toY do
                    for z = room.fromZ, room.toZ do
                        local pos = {x=x, y=y, z=z,stackpos = 253}
                        local thing = getThingfromPos(pos)
                        if isPlayer(thing.uid) then
                            doPlayerSendTextMessage(cid,19,"The room is currently occupied.") 
                            return true
                        elseif isMonster(thing.uid) then
                            monsters[i] = getThingfromPos({x=x,y=y,z=z,stackpos=253})
                            i = i+1
                            monster_room = true                               
                        end
                    end
                end
            end       
            if monster_room then
                for r = 1, #monsters do
                    doRemoveCreature(monsters[r].uid)
                end
            end
    
        doTeleportThing(cid, player_pos)
        doSummonCreature(config.boss, config.bosspos[1])
        doPlayerSetStorageValue (cid, 34254, 1)
        doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have ten minutes to kill and loot this boss, else you will lose that chance and will be kicked out.')
        addEvent(checkRoom, 600000, {})
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You did not complete the task Quest or you have already fought the boss!')
            doTeleportThing(cid, cansel_pos)
        end
    end
    return true
end



function checkRoom(param)

            for x = room.fromX, room.toX do
                for y = room.fromY, room.toY do
                    for z = room.fromZ, room.toZ do
                        local pos = {x=x, y=y, z=z,stackpos = 253}
                        local thing = getThingfromPos(pos)
                        if isPlayer(thing.uid) then
                            doPlayerSendTextMessage(thing.uid,MESSAGE_EVENT_ADVANCE,"Your time has passed.")
                            doTeleportThing(thing.uid, cansel_pos)
                            return true
                        end
                    end
                end
            end
end
 
Solution
Back
Top