;"Will o' Wisp" enemy spawn point

;The number of the Will o' Wisp enemy
WISP = 32

i = 7
While i < 16
   i = i + 1
   If GetMonsterType(#MAPID, i) = WISP
      GoTo END
   EndIf
Wend

;Spawn the wisps
If IsNight() = 1
   SpawnChance = GetTime() 
   If Mod(SpawnChance,12) = 0
      SendMessageToUser(#USERID,"A Will o' Wisp attacks you!",#MSG_CRITICAL)

      SpawnMonster(#MAPID,WISP,#XPOS - 2,#YPOS)
      
      If Mod(SpawnChance,21) = 0
         SpawnMonster(#MAPID,WISP,#XPOS + 2,#YPOS)
      EndIf
   EndIf
EndIf

;Make the wisps attack the player
i = 7
While i < 16
   i = i + 1
   If GetMonsterType(#MAPID, i) = WISP
      SetMonsterTarget(#MAPID, i, #USERID)
   EndIf
Wend

Label END

Continue = 1