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

GlobalEvent Santa event

Erikas Kontenis

Board Moderator
Staff member
Board Moderator
Joined
Jul 3, 2009
Messages
1,864
Reaction score
567
Location
Lithuania
Small event from Jigen Server, I want to release christmas present for otlanders.

Its a small event wich requires santa claus in your server, in my server is carpet and a santa, copy cordinates of left corner and right corner and items will start drop automaticly and random positions also santa claus will start talking, in config you can choose how much peapol need to stand in carpet to get free items.

Lua:
local config = {	
	fromPosition = {x = 32351, y = 32222, z = 6}, -- top left cornor of the playground (random items drop)
    toPosition = {x = 32358, y = 32227, z = 6}, -- bottom right cornor of the playground (random items drop)
	
	minPlayers = 1, -- min players to start event
	npcName = "Santa Claus",
	prize = {2148,2152,2687,6501,6574,6569,2688,6506,6507,6508,6509,6510,6511} -- rewards
}
 
function onThink(interval, lastExecution, thinkInterval)
	local players = {}
	for x = (config.fromPosition).x, (config.toPosition).x do
		for y = (config.fromPosition).y, (config.toPosition).y do
			for z = (config.fromPosition).z, (config.toPosition).z do
				if(isPlayer(getTopCreature({x = x, y = y, z = z}).uid)) then
					table.insert(players, getTopCreature({x = x, y = y, z = z}).uid)
				end
			end
		end
	end
	
	if(table.maxn(players) >= config.minPlayers) then
		local function senelis()
		pos = {x = math.random(config.fromPosition.x, config.toPosition.x), y = math.random(config.fromPosition.y, config.toPosition.y), z = math.random(config.fromPosition.z, config.toPosition.z)}
		local randomChanceItem = math.random(1, #config.prize)		
		doCreateItem(config.prize[randomChanceItem], 1, pos)
		doSendMagicEffect(pos, 55)
		end
		addEvent(doCreatureSay, 1000, getCreatureByName(config.npcName), "Ho ho ho, Merry Christmas Jigen folks!", TALKTYPE_ORANGE_1)
		addEvent(senelis, 2000)
		addEvent(senelis, 3000)
		addEvent(senelis, 4000)
		addEvent(senelis, 5000)
		addEvent(senelis, 6000)
		addEvent(doCreatureSay, 7000, getCreatureByName(config.npcName), "Ho ho ho, Merry Christmas Jigen folks!", TALKTYPE_ORANGE_1)
		end
	return true
end

Code:
<globalevent name="freeitenz" interval="60000" event="script" value="freeitenz.lua"/>

Picture:

mr2s.png


Tested trunk.5106
 
Last edited:
Back
Top