;Four Corners - Event
LoseCorner=Random(1,4)

If GetUserFlag(0,11)=0
	SetUserFlag(0,11,1)
	SendMessageToMap(#PARAM1,"Try not be be eliminated. Stay in the corners!", #MSG_EMOTE)
	Timer(182,30000,552,0,0)
	Goto End
Endif

If GetMapPlayerCount(#PARAM1)=0
	Goto EventEnd
Endif

If GetUserFlag(0,11)=2
	Goto EventEnd
Endif
	
CreateEffect(0,500,0,#DIR_UP,#PARAM1,6,10,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,6,10),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,7,10,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,7,10),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,8,10,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,8,10),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,9,10,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,9,10),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,10,10,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,10,10),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,11,10,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,11,10),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,12,10,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,12,10),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,13,10,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,13,10),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,14,10,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,14,10),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,10,6,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,10,6),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,10,7,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,10,7),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,10,8,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,10,8),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,10,9,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,10,9),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,10,11,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,10,11),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,10,12,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,10,12),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,10,13,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,10,13),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,10,14,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,10,14),509,10,11)


If LoseCorner=1
CreateEffect(0,500,0,#DIR_UP,#PARAM1,6,6,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,6,6),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,7,6,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,7,6),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,8,6,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,8,6),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,9,6,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,9,6),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,6,7,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,6,7),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,7,7,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,7,7),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,8,7,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,8,7),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,9,7,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,9,7),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,6,8,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,6,8),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,7,8,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,7,8),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,8,8,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,8,8),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,9,8,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,9,8),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,6,9,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,6,9),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,7,9,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,7,9),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,8,9,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,8,9),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,9,9,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,9,9),509,10,11)
Endif

If LoseCorner=2
CreateEffect(0,500,0,#DIR_UP,#PARAM1,11,6,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,11,6),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,12,6,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,12,6),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,13,6,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,13,6),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,14,6,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,14,6),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,11,7,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,11,7),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,12,7,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,12,7),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,13,7,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,13,7),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,14,7,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,14,7),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,11,8,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,11,8),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,12,8,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,12,8),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,13,8,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,13,8),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,14,8,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,14,8),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,11,9,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,11,9),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,12,9,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,12,9),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,13,9,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,13,9),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,14,9,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,14,9),509,10,11)
Endif

If LoseCorner=3
CreateEffect(0,500,0,#DIR_UP,#PARAM1,6,11,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,6,11),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,7,11,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,7,11),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,8,11,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,8,11),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,9,11,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,9,11),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,6,12,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,6,12),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,7,12,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,7,12),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,8,12,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,8,12),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,9,12,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,9,12),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,6,13,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,6,13),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,7,13,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,7,13),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,8,13,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,8,13),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,9,13,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,9,13),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,6,14,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,6,14),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,7,14,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,7,14),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,8,14,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,8,14),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,9,14,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,9,14),509,10,11)
Endif

If LoseCorner=4
CreateEffect(0,500,0,#DIR_UP,#PARAM1,11,11,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,11,11),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,12,11,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,12,11),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,13,11,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,13,11),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,14,11,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,14,11),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,11,12,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,11,12),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,12,12,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,12,12),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,13,12,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,13,12),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,14,12,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,14,12),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,11,13,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,11,13),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,12,13,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,12,13),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,13,13,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,13,13),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,14,13,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,14,13),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,11,14,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,11,14),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,12,14,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,12,14),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,13,14,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,13,14),509,10,11)
CreateEffect(0,500,0,#DIR_UP,#PARAM1,14,14,0,0,0)
WarpUser(GetUserAtXY(#PARAM1,14,14),509,10,11)
Endif

If GetMapPlayerCount(#PARAM1)=1
	SendMessageToMap(#PARAM1,"You are the last player.", #MSG_EMOTE)
	Goto EventEnd
Endif

SendMessageToMap(#PARAM1,"There are "+GetMapPlayerCount(#PARAM1)+" players left.", #MSG_SERVER)
Timer(182,30000,552,0,0)
Goto End


Label EventEnd
If GetUserFlag(0,11)=2
	Goto End
Else
	SetUserFlag(0,11,2)
	SendMessageToAll("Four Corners has ended.", #MSG_SERVER)
	SendMessageToMap(#PARAM1,"You have won the event. Go into the portal to retrieve your reward.", #MSG_TELL)
Endif
Goto End


Label End

Continue = 1

