enemy code making game laggy in Developer Help
|
|
Code:
mob/monster var/horny var/hunger Slurry_Goggler icon = 'monsters.dmi' icon_state = "testmonster" New() spawn() Hunt() proc/Hunt(var/mob/M) while(src) if(M in oview(3)) if(M.client) if(src.hunger <= 5) step_towards(src,M) sleep(5) step_towards(src,M) sleep(5) step_towards(src,M) else return else if(istype(M,/mob/monster/Slurry_Goggler)) if(src.horny<= 5) step_towards(src,M) sleep(5) step_towards(src,M) sleep(5) step_towards(src,M) else return
|
Problem description:
I coded a monster AI doesn't work and lags the game up. It take approximately 20 seconds longer to load with the code.
|
You've got something infinite loop there. Try setting hunt to background proc.