New()
set background = 1
..()
while(1) // Infinite loop for attacking
for(var/mob/M in oview(1)) // For every mob in 1 space within the slime
if(src.npc_atk == 1) // If the monster is set to 'attack'
view() << "[src.name] attacks [M.name]!"
M.hp -= rand(min_dmg, max_dmg) // Attack with an amount of damage specified by min_dmg and max_dmg
src.npc_atk = 0 // Set the attack back to 0
if(M.hp <= 0)
death(M)
continue // Continue with the loop
Problem description:
When the game is run, it SEVERELY lags due to the infinite loop in the monster code. The problem is, I can't figure out how to do this without an infinite loop. I set the proc in the background to stop it from slowing down the loading process, but it still lags.
Just because without delays, it could loop infinite times in no time.