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

Help with Raids

julianfern94

New Member
Joined
Dec 26, 2012
Messages
168
Reaction score
4
How, i can make automatically raids, for example

the chance of spawn Undead Cavebear on lichhell is 30 of 60..


or where i can set time to raids execute automatically ?
 
Last edited by a moderator:
Use this script:

globalevents.xml
Code:
<globalevent name="raids" interval="60000" event="script" value="raid.lua"/>

raid.lua

LUA:
--[[
- hour should be exact SERVER hour
- to do the raid at clock 00 minutes 00
- to do the raid at exaxt date use type "exact"
- to do the raid weekly use type "weekly"
- days names are used only for weekly type and should be 
- "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"
- also should be inside a array -> {}
]]

local raids =
	{
		[1] = 
			{
				name = 'Morgaroth',
				type = 'exact',
				date = {day = 15, month = 08},
				hour = 16,
				minu = 27
			},
		[2] = 
			{
				name = 'Zulazza the Corruptor',
				type = 'weekly',
				days = {'monday'},
				hour = 20,
				minu = 00
			},
		[3] = 
			{
				name = 'RatsThais',
				type = 'exact',
				date = {day = 31, month = 07},
				hour = 03,
				minu = 00
			},
		[4] = 
			{
				name = 'OrcsThais',
				type = 'exact',
				date = {day = 03, month = 08},
				hour = 17,
				minu = 00
			},
		[5] = 
			{
				name = 'Barbarian',
				type = 'exact',
				date = {day = 05, month = 08},
				hour = 18,
				minu = 00
			},
		[6] = 
			{
				name = 'Demodras',
				type = 'exact',
				date = {day = 07, month = 08},
				hour = 19,
				minu = 00
			},
		[7] = 
			{
				name = 'Elfos',
				type = 'exact',
				date = {day = 09, month = 08},
				hour = 20,
				minu = 00
			},
		[8] = 
			{
				name = 'Ferumbras',
				type = 'exact',
				date = {day = 11, month = 08},
				hour = 21,
				minu = 00
			},
		[9] = 
			{
				name = 'Ghazbaran',
				type = 'exact',
				date = {day = 13, month = 08},
				hour = 22,
				minu = 00
			},
		[10] = 
			{
				name = 'Horned Fox',
				type = 'exact',
				date = {day = 17, month = 08},
				hour = 23,
				minu = 00
			},
		[11] = 
			{
				name = 'Necropharus',
				type = 'exact',
				date = {day = 19, month = 08},
				hour = 00,
				minu = 00
			},
		[12] = 
			{
				name = 'Nomads',
				type = 'exact',
				date = {day = 21, month = 08},
				hour = 01,
				minu = 00
			},
		[13] = 
			{
				name = 'Orshabaal',
				type = 'exact',
				date = {day = 23, month = 08},
				hour = 14,
				minu = 00
			},
		[14] = 
			{
				name = 'Pirates',
				type = 'exact',
				date = {day = 25, month = 08},
				hour = 15,
				minu = 00
			},
		[15] = 
			{
				name = 'Quaras',
				type = 'exact',
				date = {day = 27, month = 08},
				hour = 16,
				minu = 00
			},
		[16] = 
			{
				name = 'Scarabs',
				type = 'exact',
				date = {day = 29, month = 08},
				hour = 17,
				minu = 00
			},
		[17] = 
			{
				name = 'Old Widow',
				type = 'exact',
				date = {day = 31, month = 08},
				hour = 18,
				minu = 00
			},
		[18] = 
			{
				name = 'Undead Army',
				type = 'exact',
				date = {day = 02, month = 09},
				hour = 19,
				minu = 00
			},
		[19] = 
			{
				name = 'Undead Darashia',
				type = 'exact',
				date = {day = 04, month = 09},
				hour = 20,
				minu = 00
			},
		[20] = 
			{
				name = 'Sir Valorcrest',
				type = 'weekly',
				days = {'monday'},
				hour = 20,
				minu = 00
			},
		[21] = 
			{
				name = 'Zevelong Duskbringer',
				type = 'weekly',
				days = {'tuesday'},
				hour = 20,
				minu = 00
			},
		[22] = 
			{
				name = 'Diblis The Fair',
				type = 'weekly',
				days = {'thursday'},
				hour = 20,
				minu = 00
			},
		[23] = 
			{
				name = 'Arachir the Ancient One',
				type = 'weekly',
				days = {'saturday'},
				hour = 20,
				minu = 00
			},
		[24] = 
			{
				name = 'Halloween Hare',
				type = 'exact',
				date = {day = 31, month = 10},
				hour = 16,
				minu = 00
			}	
	}
	
local last_execsutes = {}

function onThink(interval, lastExecution, thinkInterval)
	local static_time = os.time()
	for k, raid in ipairs(raids) do
		if (raid.type == 'weekly') then
			local day = os.date("%A", static_time):lower()
			if isInArray(raid.days, day) then
				local hour = tonumber(os.date("%H", static_time))
				if (raid.hour == hour) then
					local minute = tonumber(os.date("%M", static_time))
					if (raid.minu == minute) then
						local day_number = tonumber(os.date("%d", static_time))
						if (last_execsutes[k] ~= day_number) then
							last_execsutes[k] = day_number
							doExecuteRaid(raid.name)
						end
					end
				end
			end
		elseif (raid.type == 'exact') then
			local month = tonumber(os.date("%m", static_time))
			if (raid.date.month == month) then
				local day = tonumber(os.date("%d", static_time))
				if (raid.date.day == day) then
					local hour = tonumber(os.date("%H", static_time))
					if (raid.hour == hour) then
						local minute = tonumber(os.date("%M", static_time))
						if (raid.minu == minute) then
							if (last_execsutes[k] ~= day) then
								last_execsutes[k] = day
								doExecuteRaid(raid.name)
							end
						end
					end
				end
			end
		end
	end
	return true
end

Stolen from Masiyah datapack though..
 
Back
Top