• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Raid -> IF not killed in X Mins remove monster

Solution
Since its onThink it can prolly be optimised, but it works. Coded this for Quest OTs (TFS 0.3) couple years ago.

Register the boss monsters with a creaturescript that will kill it after x seconds:
LUA:
-- How many seconds shall monster stay alive?
seconds = 4

-- Do you want people to be able to loot monster
-- after its dead? 0 = NO, 1 = YES.
loot = 0


function onThink(cid)
    addEvent(fuckmylife,1000*seconds, {cid=cid})
    return true
end
function fuckmylife(cid)
local cid = cid.cid
    if isCreature(cid) then
        if loot > 0 then
            doCreatureAddHealth(cid, -getCreatureHealth(cid))
            return true
        else
            doRemoveCreature(cid)
            return true
        end
    end
    return true
end
Since its onThink it can prolly be optimised, but it works. Coded this for Quest OTs (TFS 0.3) couple years ago.

Register the boss monsters with a creaturescript that will kill it after x seconds:
LUA:
-- How many seconds shall monster stay alive?
seconds = 4

-- Do you want people to be able to loot monster
-- after its dead? 0 = NO, 1 = YES.
loot = 0


function onThink(cid)
    addEvent(fuckmylife,1000*seconds, {cid=cid})
    return true
end
function fuckmylife(cid)
local cid = cid.cid
    if isCreature(cid) then
        if loot > 0 then
            doCreatureAddHealth(cid, -getCreatureHealth(cid))
            return true
        else
            doRemoveCreature(cid)
            return true
        end
    end
    return true
end
 
Solution
Register the boss monsters with a creaturescript that will kill it after x seconds:

-- How many seconds shall monster stay alive?
seconds = 4

-- Do you want people to be able to loot monster
-- after its dead? 0 = NO, 1 = YES.
loot = 0


function onThink(cid)
addEvent(fuckmylife,1000*seconds, {cid=cid})
return true
end
function fuckmylife(cid)
local cid = cid.cid
if isCreature(cid) then
if loot > 0 then
doCreatureAddHealth(cid, -getCreatureHealth(cid))
return true
else
doRemoveCreature(cid)
return true
end
end
return true
end

lol :)
 
Back
Top