• 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 BOSS QUEST kick from area after time

  • Thread starter Thread starter Deleted member 141899
  • Start date Start date
D

Deleted member 141899

Guest
Hi guys,

Im working in add the bosses of roshamuul and fix jaul, etc..
Im using Tfs 1.0..
I need a script that when the player step in on teleport, and not manage to kill the boss at one time, it is kick the area, or if he can kill the boss and stay in the area, it is also kicked after 15 minutes.

If it turns out the area before 15min, not happen anything.

Can be any area to config..



help please! Thanks
 
Last edited by a moderator:
Hi guys,

Im working in add the bosses of roshamuul and fix jaul, etc..

I need a script that the player not manage to kill the boss at one time, it is kick the area, or if he can kill the boss and stay in the area, it is also kicked after 15 minutes.

If it turns out the area before 15min, not happen anything.



help please! Thanks
Tfs version? Also how big is the area?
 
Im using Tfs 1.0..Can be any area to config..
I was not asking for the location, I was asking how big the area. If it's a somewhat medium sized area, you can set the player storage using os.time when entering the boss area, then use an onThink for the specific boss to check the players in the area. This way you don't need to use a globalevent for one area.
 
I found this script, but is not working

Code:
local storage = 12007 -- storage for this quest

local positions = {
    [1] = {x = 33608, y = 32394, z = 11}, -- home position
    [2] = {x = 33574, y = 32415, z = 12}   -- boss room position
}

local coords = {
    [1] = 33560, -- upper left corner of room
    [2] = 33575, -- upper right corner "
    [3] = 32414, -- upper left corner "
    [4] = 32429, -- bottom left corner "
    [5] = 12    -- z position
}

function onStepIn(cid)
    local typemsg = MESSAGE_INFO_DESCR
    local isBoss
    if(getCreatureStorage(cid, storage) < 2) then
        for xPos = coords[1], coords[2] do
            for yPos = coords[3], coords[4] do
            pos = {x = xPos, y = yPos, z = coords[5]}
                local pid = getTopCreature(pos).uid
                if(isPlayer(pid)) then
                    msg = "Someone else is already doing this quest, wait a little longer."
                    doTeleport(cid, positions[1], msg, typemsg)
                elseif(isCreature(pid)) then
                    isBoss = true
                end
            end
        end
        if(isBoss) then
            typemsg = MESSAGE_STATUS_WARNING
            msg = "You have 1 minutes to defeat this boss, for you will be kicked out after that time passes."
            doTeleport(cid, positions[2], msg, typemsg)
            addEvent(bossTimer, 60*1000, cid)
        elseif(not isBoss) then
            msg = "This boss was just defeated, please wait for it to respawn."
            doTeleport(cid, positions[1], msg, typemsg)
        else
            msg = "You have already defeated this boss."
            doTeleport(cid, positions[1], msg, typemsg)
            return true
        end
    end
end

function bossTimer(cid)
    for xPos = coords[1], coords[2] do
        for yPos = coords[3], coords[4] do
            pos = {x = xPos, y = yPos, z = coords[5]}
            local pid = getTopCreature(pos).uid
            if(isPlayer(pid)) then
                if(cid == pid) then
                    doTeleport(pid, positions[1])
                end
            end
        end
    end
end


Here a necessary global function I use to make the script valid.
You could place it in your library:

Code:
function doTeleport(cid, position, msg, typemsg)
    if(msg ~= nil) then
        doPlayerSendTextMessage(cid, typemsg, msg)
    end
    doTeleportThing(cid, position, false)
    doSendMagicEffect(position, CONST_ME_TELEPORT)
end

i getting this error:

Atempt to call Global 'getCreatureStorage' a nil value

can you help me please?
 
Back
Top