silveralol
Advanced OT User
- Joined
- Mar 16, 2010
- Messages
- 1,484
- Solutions
- 9
- Reaction score
- 217
hello, I'm making a script to summon some monsters
I want to make it summon just one boss per server start, never summon the same boss, how make it? with table ? inserting in the table and check if is there ir not
Code:
local config = {
[1] = {bossName = "boss1", bossPosition = Position(xxxxxx)},
[2] = {bossName = "boss2", bossPosition = Position(xxxxxx)},
[3] = {bossName = "boss3", bossPosition = Position(xxxxxx)}
}
function onThink(interval, lastExecution, thinkInterval)
if math.random(100) > 90 then
return true
end
local rand = config[math.random(3)]
local name = rand.bossName
local monster = Game.createMonster(rand.bossName, rand.bossPosition)
if not monster then
print('>> Failed to spawn '..name..' boss missing map.')
return true
end
print('>> The boss: ' ..monster:getName() .. ' was summoned.')
return true
end