• 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 Add event problem

mRefaat

Marketing and Coding
Joined
Jan 18, 2014
Messages
854
Solutions
3
Reaction score
141
Location
Egypt
I am using this script and get this error sometimes in console

Code:
[14:5:00.453] [Error - GlobalEvent Interface]
[14:5:00.453] data/globalevents/scripts/bossevent.lua:onTime
[14:5:00.453] Description:
[14:5:00.453] (LuaInterface::luaAddEvent) Callback parameter should be a function

and script
Lua:
local config = {
   events = 60,   -- 60 * 1000 = 1 min
   bossPos = {x=1788, y=2408, z=7}   -- position where boss should spawn
}

local bosses = {
   -- Name of the bosses
   "[Boss] Curselich",
   "[Boss] Taintstrike",
   "[Boss] Terrorfreak",
   "[Boss] Vamphag"    
}


function summonBoss()
    summonBoss = bosses[math.random(#bosses)]
    doBroadcastMessage("[Boss Event] " .. summonBoss .. " is spawned in boss event! You have 15 minutes to kill it!")   
    doSummonCreature(summonBoss, config.bossPos)
    doSendMagicEffect(config.bossPos, CONST_ME_TELEPORT)
end

function onTime()
    doBroadcastMessage("[Boss Event] Boss will spawn in 1 minute.")
    addEvent(summonBoss, config.events * 1000)
   return true
end

Tfs 0.3.7 rev5969
 
Solution
Of course, because you're literally overwriting the entire function with a separate variable type, making summonBoss a string instead of a function used in your addEvent. Change the variable name for your global boss name.
Of course, because you're literally overwriting the entire function with a separate variable type, making summonBoss a string instead of a function used in your addEvent. Change the variable name for your global boss name.
 
Solution
Of course, because you're literally overwriting the entire function with a separate variable type, making summonBoss a string instead of a function used in your addEvent. Change the variable name for your global boss name.
I found this script on otland and changed a bit in it.
And sorry I didn’t understand what you are saying


Updated:
Do you mean i change this summonboss ?
summonBoss = bosses[math.random(#bosses)]
 
Last edited:
I found this script on otland and changed a bit in it.
And sorry I didn’t understand what you are saying


Updated:
Do you mean i change this summonboss ?
summonBoss = bosses[math.random(#bosses)]
Yes, that's exactly what I said.
 
Back
Top