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

Lua Spawn monster to a random area

Sigoles

Discord: @sigoles
Joined
Nov 20, 2015
Messages
1,209
Solutions
2
Reaction score
154
The monsters are spawning at the same sqm was died, help?

I'll use onDeath

tfs 1.3

LUA:
local config = {
   [1] = {30456, 30187, 7}, -- north west, upper floor
   [2] = {30550, 30272, 7} -- south east, lower floor
}

local function CreateMonsterX()
    local random_x, random_y, random_z = 0, 0, 0
    random_x = math.random(config[1][1], config[2][1])
    random_y = math.random(config[1][2], config[2][2])
    random_z = math.random(config[1][3], config[2][3])
    local monstro = Game.createMonster("DemonBos", Position(random_x, random_y, random_z), true, false)

        if not monstro then
            addEvent(CreateMonsterX, 5 * 1000)

            return true
        end
      
end
 
Back
Top