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

Easy Boss Event

BugaS

Donżuan
Joined
Mar 12, 2009
Messages
1,219
Reaction score
9
Location
NYC
Hey guys!

Anyone got an event which works like that:

Two times in each day event is comming. How it's works? 10 minutes before is a message "Beware! Weird guest is comming to Boss Cave..."

Then, the system is randomly choosing the boss from the monsters I set and when the boss is appear there is a message: " (Name of Monster) is here! Go to Boss Cave and defeat him!"
 
Hey guys!

Anyone got an event which works like that:

Two times in each day event is comming. How it's works? 10 minutes before is a message "Beware! Weird guest is comming to Boss Cave..."

Then, the system is randomly choosing the boss from the monsters I set and when the boss is appear there is a message: " (Name of Monster) is here! Go to Boss Cave and defeat him!"

I have not tested the script yet. but i will try to help you get it to work.
Right now it will select a random boss, and there is a 25% chance it summon a boss every 4 hour. (change interval to 7200 to make it every 2 hours and so on) Note: interval calculating may be different on your TFS
If nobody kill the boss it will despawn after 4 hours. (mainly to make it impossible to summon more than one boss inside the cave)

inside globalevent.xml
add
XML:
<globalevent name="bossCave" interval="14400" event="script" value="bosscave.lua"/> <!-- 14400 = 4 hour, script will be run every 4 hours whit this config. But only 25% chance it will spawn a boss -->

bosscave.lua
LUA:
local config = {
   events = 600,   -- 600 * 1000 = 10 min
   deSummon = 3600 * 4, -- 3600 * 4 = 4 hours
   bossPos = {x=32000, y=32000, z=7},   -- position where boss should spawn
   eventMsg = "Beware! Weird guest is comming to Boss Cave..."
}

local bosses = {
   -- Name of the bosses
   boss1 =   "Ferumbras",
   boss2 = "Morgaroth",
   boss3 =   "Orshabaal"
}

local function deSummonBoss()
   -- remove the boss if 4 hours have passed
   if (getCreatureByName(summonBoss)) then
       doRemoveCreature(getCreatureByName(summonBoss))
       print(">> Nobody did kill " .. summonBoss .. " System did deSpawn the boss")
   end
end

local function summonBoss()
   summonBoss = bosses[math.random(0, #bosses - 1)]
   local text = "" .. summonBoss .. " is here! Go to Boss Cave and defeat him!"
   doBroadcastMessage(text)
   doCreateMonster(summonBoss, bossPos)
   doSendMagicEffect(bossPos, CONST_ME_TELEPORT)
   addEvent(deSummonBoss, config.deSummon * 1000)
end

function onThink(interval, lastExecution, thinkInterval)
   if(math.random(1, 4) >= 4) then   -- 25% to summon a random boss
       doBroadcastMessage(eventMsg)
       addEvent(summonBoss, config.events * 1000)
   end
   return true
end
 
I have not tested the script yet. but i will try to help you get it to work.
Right now it will select a random boss, and there is a 25% chance it summon a boss every 4 hour. (change interval to 7200 to make it every 2 hours and so on) Note: interval calculating may be different on your TFS
If nobody kill the boss it will despawn after 4 hours. (mainly to make it impossible to summon more than one boss inside the cave)

inside globalevent.xml
add
XML:
<globalevent name="bossCave" interval="14400" event="script" value="bosscave.lua"/> <!-- 14400 = 4 hour, script will be run every 4 hours whit this config. But only 25% chance it will spawn a boss -->

bosscave.lua
LUA:
local config = {
   events = 600,   -- 600 * 1000 = 10 min
   deSummon = 3600 * 4, -- 3600 * 4 = 4 hours
   bossPos = {x=32000, y=32000, z=7},   -- position where boss should spawn
   eventMsg = "Beware! Weird guest is comming to Boss Cave..."
}

local bosses = {
   -- Name of the bosses
   boss1 =   "Ferumbras",
   boss2 = "Morgaroth",
   boss3 =   "Orshabaal"
}

local function deSummonBoss()
   -- remove the boss if 4 hours have passed
   if (getCreatureByName(summonBoss)) then
       doRemoveCreature(getCreatureByName(summonBoss))
       print(">> Nobody did kill " .. summonBoss .. " System did deSpawn the boss")
   end
end

local function summonBoss()
   summonBoss = bosses[math.random(0, #bosses - 1)]
   local text = "" .. summonBoss .. " is here! Go to Boss Cave and defeat him!"
   doBroadcastMessage(text)
   doCreateMonster(summonBoss, bossPos)
   doSendMagicEffect(bossPos, CONST_ME_TELEPORT)
   addEvent(deSummonBoss, config.deSummon * 1000)
end

function onThink(interval, lastExecution, thinkInterval)
   if(math.random(1, 4) >= 4) then   -- 25% to summon a random boss
       doBroadcastMessage(eventMsg)
       addEvent(summonBoss, config.events * 1000)
   end
   return true
end
When loading script:
[23:2:07.981] [Error - GlobalEvent Interface]
[23:2:07.987] data/globalevents/scripts/bosscave.lua:onThink
[23:2:07.991] Description:
[23:2:07.994] data/lib/050-function.lua:493: attempt to concatenate local 'text' (a nil value)
[23:2:08.001] stack traceback:
[23:2:08.008] data/lib/050-function.lua:493: in function 'doBroadcastMessage'
[23:2:08.013] data/globalevents/scripts/bosscave.lua:34: in function <data/globalevents/scripts/bosscave.lua:32>
[23:2:08.016] [Error - GlobalEvents::think] Couldn't execute event: bossCave
 
Back
Top