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

Teleport open when Event starts Script?

You are meant to edit the green code, here we go:

globalevent.xml
Code:
<globalevent name="spawnGhazbaran" interval="7200000" script="spawnGhazbaran.lua"/>

spawnGhazbaran.lua
Code:
[COLOR="#008000"]local config = {
	createTeleportPos = {x = 980, y = 433, z = 8},
	teleportToPos = {x = 984, y = 431, z = 8},
	timeBeforeTeleportDisappear = 2 * 60 * 1000,
	
	roomUpperLeftPos = {x = 980, y = 428, z = 8},
	roomLowerRightPos = {x = 986, y = 433, z = 8},
	
	bossSpawnPos = {x = 982, y = 430, z = 8},
	bossName = "Ghazbaran",
	bossSpawnMsg = "Time to go and loot Ghazbaran!"
}[/COLOR]

local function removeBossMonsterFromRoom()
	for _x = config.roomUpperLeftPos.x, config.roomLowerRightPos.x do
		for _y = config.roomUpperLeftPos.y, config.roomLowerRightPos.y do
			for _z = config.roomUpperLeftPos.z, config.roomLowerRightPos.z do
				local position = {x = _x, y = _y, z = _z}
				local creature = getTopCreature(position)
				
				if creature.type == 2 and getCreatureName(creature.uid) == config.bossName then
					doRemoveCreature(creature.uid)
				end
			end
		end
	end
end

local function removeTeleport()
	local teleportItem = getTileItemById(config.createTeleportPos, 1387)
	if teleportItem.itemid == 1387 then
		doRemoveItem(teleportItem.uid, 1)
		doSendMagicEffect(config.createTeleportPos, CONST_ME_POFF)
	end
end

function onThink(cid, interval, lastExecution)
	removeBossMonsterFromRoom()
	doSummonCreature(config.bossName, config.bossSpawnPos)
	
	doCreateTeleport(1387, config.teleportToPos, config.createTeleportPos)
	addEvent(removeTeleport, config.timeBeforeTeleportDisappear)
	
	broadcastMessage(config.bossSpawnMsg, MESSAGE_STATUS_WARNING)
	
	return TRUE
end
 
Back
Top