Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.7 kB
9
Indexable
Never
-- <globalevent name="Zumbi_Event" time="03:46:00" script="ZE_globalevents.lua"/>

dofile('data/lib/ZE_config.lua')

zeArenaFromPosition = Position(770, 1224, 6) --pos of top left corner {x = 770, y = 1224, z = 6}
zeArenaToPosition = Position(800, 1243, 6) --pos of bottom right corner {x = 800, y = 1243, z = 6}

local function ZE_Verifica()
	local tile = Tile(ZE.tpOpen)
	if tile then
		local item = tile:getItemById(27716)
		if item then
			item:remove()
			broadcastMessage("el evento zombie empezo ahora!", MESSAGE_STATUS_WARNING)
			doSummonCreature("Zumbi", ZE.posEnterEvent, false, true)
		else			
			broadcastMessage("The Zombie event acaba de abrir cierra en ".. ZE.tpTimeOpen .." minutos.", MESSAGE_STATUS_WARNING)
			setGlobalStorageValue(ZE.storage, 0)
			
			local teleport = Game.createItem(27716, 1, ZE.tpOpen)
			if teleport then
				teleport:setActionId(45110)
			end
		end
	end
end

local function warnEvents(i)
	Game.broadcastMessage("The Zombie event esta abierto la entrada esta en la montaña de eventos!")
	if i > 1 then
		addEvent(warnEvents, 2 * 60 * 1000, i - 1)
	end
end


--- TESTE
local function SumonarZumbis(b)

Game.createMonster("Zumbi", {x = math.random(zeArenaFromPosition.x, zeArenaToPosition.x), y = math.random(zeArenaFromPosition.y, zeArenaToPosition.y), z = math.random(zeArenaFromPosition.z, zeArenaToPosition.z)}, false, true)

if b > 1 then
		addEvent(SumonarZumbis, 1 * 60 * 1000, b - 1)
	end
end
-- TESTE 

function onTime(interval)

	ZE_Verifica()
	addEvent(ZE_Verifica, ZE.tpTimeOpen * 60 * 1000)
	addEvent(warnEvents, 2 * 60 * 1000, 4)
	addEvent(SumonarZumbis, 10 * 60 * 1000, 16)
	return true
end