;'Timed call script for the hunters'

MAP = GetUserMap(#PARAM1)
X = GetUserX(#PARAM1)
Y = GetUserY(#PARAM1)

If GetMapType(MAP) = #MAPTYPE_FRIENDLY 
	GoTo END
EndIf

If IsOnline(#PARAM1) = 0
	GoTo END
EndIf

If #PARAM2 = 0
	SendMessageToMap(MAP,"The howls of dogs can be heard in the distance.",#MSG_EMOTE)
	Timer(249,10000,#PARAM1,1,0)
ElseIf #PARAM2 = 1
	SendMessageToMap(MAP,"Hounds of the hunt attack you!",#MSG_CRITICAL)
	SpawnMonster(MAP,75,X,Y-2)
	SpawnMonster(MAP,75,X-3,Y)
	SpawnMonster(MAP,75,X+2,Y+1)
	Timer(249,45000,#PARAM1,2,0)
ElseIf #PARAM2 = 2
	SendMessageToMap(MAP,"Hunters appear and surround you!",#MSG_CRITICAL)
	SpawnMonster(MAP,77,X+1,Y+2)
	SpawnMonster(MAP,77,X-1,Y-1)
	SpawnMonster(MAP,77,X+2,Y)
	SpawnMonster(MAP,77,X-2,Y-1)
	SpawnMonster(MAP,77,X-2,Y+1)
	Timer(249,45000,#PARAM1,3,0)
ElseIf #PARAM2 = 3
	SendMessageToMap(MAP,"More hunters appear, intent on slaying their prey.",#MSG_CRITICAL)
	SpawnMonster(MAP,77,X-2,Y-2)
	SpawnMonster(MAP,77,X+1,Y-3)
	SpawnMonster(MAP,77,X-2,Y+1)
	SpawnMonster(MAP,75,X+3,Y+2)
	SpawnMonster(MAP,75,X-2,Y)
	SpawnMonster(MAP,77,X-3,Y-1)
	Timer(249,90000,#PARAM1,4,0)
ElseIf #PARAM2 = 4
	SendMessageToMap(MAP,"The Hunter himself appears, and wishes to test your might.",#MSG_CRITICAL)
	SpawnMonster(MAP,77,X-1,Y+2)
	SpawnMonster(MAP,77,X+1,Y+2)
	SpawnMonster(MAP,77,X,Y+2)
	SpawnMonster(MAP,77,X-1,Y-2)
	SpawnMonster(MAP,77,X+1,Y-2)
	SpawnMonster(MAP,76,X,Y-3)
EndIf

i = 8
While i < 16
	SetMonsterTarget(MAP,i,#PARAM1)
	i=i+1
Wend

Label END

Continue = 1