ID:268846
 
        Del()
var/seed_drop = rand(-5,5)//Negative Number
while(seed_drop)
new drop (src.loc,src)
seed_drop--
..()


Okay, if I use a negative number, it laggeths. :9
How could I fix that? With an if statement?
Hell Ramen wrote:
>       Del()
> var/seed_drop = rand(-5,5)//Negative Number
> while(seed_drop)
> new drop (src.loc,src)
> seed_drop--
> ..()

Okay, if I use a negative number, it laggeths. :9
How could I fix that? With an if statement?

It's because seed_drop will never reach zero if it starts as a negative number, therefor creating an infinite loop. In the context that you're using while(seed_drop), it will only perform the loop until seed_drop equals zero (or null).

In such a situation, I'm not sure why you'd want a negative number anyways.
In response to Malver
So there's a bigger chance it won't drop anything. :p
I'll just use an if statement to make it zero.
In response to Hell Ramen
obj/Del()
if(prob(50)) //don't forget about prob, as it's a great function
var/seed_drop=rand(1,5)
for(var/index = 1 to seed_drop)
new /obj/seed(loc)
..()
In response to Loduwijk
Woah, that's a new function I didn't know anything about.
Thanks, Lod!