ID:172158
 
Okay in a game I'm helping my friend make, theres a problem where Monsters wouldnt attack more than once, so I tried to make a test monster, but the test monster litterally, CRASHES Dream Seeker when it gets spawned into the game. Any help? Here's the code:
mob
NPC
Testo
name = "Test Stupid Head"
icon = 'Blobs.dmi'
icon_state = "Green Blob"
Health = 1000
Max_Health = 1000
Strength = 10
Defense = 10
Knowledge = 10
Wisdom = 10
Experience_give = 3
Gold_give = 30
var/mob/P
New()
.=..()
spawn()
Wander()
proc/Wander()
spawn while(1)
for(var/mob/player/S in view())
step_to(src,S,5)
Bump(atom/movable/A)
if(ismob(A))
var/mob/M = A
Attack(M)
proc/Attack(mob/M)
if(src.attackwait == 0)
src.attackwait = 1
if(M.Class == null)return
if (!M) return
flick("Gold_Blob_attack",src)
sleep(2)
var/damage = Strength-M.Defense+rand(10,20)
if(damage < 1) damage = 1
M.Health -= damage
view(src) << "[src] attacks [M]!"
view(src) << "[damage] damage!"
Death(M)
sleep(15)
src.attackwait = 0

obj/Testo
var/My_Spawned
New()
spawn()
SpawnCycle()
proc/SpawnCycle()
if(My_Spawned == null)
sleep(100)
var/M = new /mob/NPC/Testo (src.loc)
My_Spawned = M
M:Spawned_By = src
spawn(10)
SpawnCycle()

It was built off of the other monsters, because I dont really have the time to make a new monster off scratch, so it might have some referances to other monsters. Please help!
It freezes Dream Seeker because you have a loop in there which does not sleep.
while(1)
//your step_towards stuff here

Put a sleep in there.
for(var/mob/player/S in view())

Go directly to jail. Do not pass go. Do not collect $200.