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

Script (globalevents) to spawn...

viking

Member
Joined
Aug 20, 2015
Messages
323
Reaction score
22
Request:

One script to spawn one monster 15:00 and spawn again in 10 min after die.
 
Code:
<globalevent name="Spawn" time="15:00:00" script="spawn.lua" />

Code:
local config = {
    monsterName = "Demon",
    spawnPosition = Position(1000, 1000, 7)
}

function onTime(interval)
    local monster = Game.createMonster(config.monsterName, config.spawnPosition, false, true)
    if monster then
        Game.broadcastMessage("Boss has been spawned.", MESSAGE_STATUS_WARNING)
    end

    return true
end

Code:
<event type="death" name="onDeath" script="death.lua" />

Code:
local function onRespawn(name, position)
    local monster = Game.createMonster(name, position, false, true)
    if monster then
        position:sendMagicEffect(CONST_ME_TELEPORT)
    end
end

function onDeath(monster, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    addEvent(onRespawn, 15 * 60 * 1000, monster:getName(), monster:getPosition())
    return true
end

make sure to register the event on the monster.
 
Back
Top