ID:1598357
 
(See the best response by Lugia319.)
Code:
            if(src.Summon_Speed)
var/A=1+src.Summon_Limit
while(A>=0)
var/mob/Bugs/Kekkai/S=new();src.Konchuu-=10
src.BugsInWorld.Add(S)
A++
if(S)
S.Vitality=25+(src.Destruction_Bug_Health*20);S.Max_Stamina=25+(src.Destruction_Bug_Health*20);S.Max_Vitality=S.Vitality
S.Owner=src
S.Physique=rand(20,50)
S.loc=locate(src.x, src.y, src.z)
S.pixel_x+=rand(-15,15);S.pixel_y+=rand(-15,15)
A--
sleep(2)


Problem description: I've tried few ways of trying to get the loop to cut off, but it doesn't seem to help :/ Overall the loop goes on and on spawning in hundreds of mobs at once, and it crashes the game.

Best response
You start the loop with A >= 0. You always add one, you always subtract 1. You effectively add 0 to the starting conditions. Since no change occurs, the loop continues
Edit: Didn't seem to cut the loop off.
Let's simplify your code to what's going on in the loop.

var/x = 0 // Let's just say it's 0 since the loop is satisfied if it is
while(x >= 0) // x = 0 at the start so it goes through here
x++ // Add 1 to x (x = 1)
x-- // Subtract 1 from x (x = 0)
// x = 0 at the end of the loop, so it goes through again
he is trying to tell you to remove the

A++


line.
Thanks for the help.
No problem, but you do understand why there was an infinite loop, right?