• 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.X+ How Tranform this script to random bosses?

myalitth

New Member
Joined
Jan 13, 2013
Messages
69
Reaction score
3
Now this script only summon a demon, can i change this to summon a random boss like (Demon, Orshaabal, etc)?

Lua:
local bossId = nil

function addBoss()
    local monster = Game.createMonster("Demon", Position(32201, 32198, 7), false, true)
    bossId = monster and monster:getId() or nil
end


function removeBoss()
    local monster = Monster(bossId)
    if monster then
        monster:remove()
    end
end

function bossExists()
    return Monster(bossId) and true or false
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not bossExists() then
        Game.broadcastMessage("You Have 15 minutes to kill him!", MESSAGE_STATUS_WARNING)
        addEvent(addBoss, 0 * 60 * 100)
        addEvent(removeBoss, 2 * 60 * 1000)
    else
        player:sendCancelMessage("The boss is already spawned!")
    end
    return true
end
 
Solution
E
okay:
Lua:
local bosses = {
    "rat",
    "dragon",
    "demon",
}
local bossId = nil

function addBoss()
    local monster = Game.createMonster(bosses[math.random(#bosses)], Position(32201, 32198, 7), false, true)
    bossId = monster and monster:getId() or nil
end


function removeBoss()
    local monster = Monster(bossId)
    if monster then
        monster:remove()
    end
end

function bossExists()
    return Monster(bossId) and true or false
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not bossExists() then
        Game.broadcastMessage("You Have 15 minutes to kill him!", MESSAGE_STATUS_WARNING)
        addEvent(addBoss, 0 * 60 * 100)
        addEvent(removeBoss, 2 * 60 * 1000)
    else...
okay:
Lua:
local bosses = {
    "rat",
    "dragon",
    "demon",
}
local bossId = nil

function addBoss()
    local monster = Game.createMonster(bosses[math.random(#bosses)], Position(32201, 32198, 7), false, true)
    bossId = monster and monster:getId() or nil
end


function removeBoss()
    local monster = Monster(bossId)
    if monster then
        monster:remove()
    end
end

function bossExists()
    return Monster(bossId) and true or false
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not bossExists() then
        Game.broadcastMessage("You Have 15 minutes to kill him!", MESSAGE_STATUS_WARNING)
        addEvent(addBoss, 0 * 60 * 100)
        addEvent(removeBoss, 2 * 60 * 1000)
    else
        player:sendCancelMessage("The boss is already spawned!")
    end
    return true
end
 
Solution
Back
Top