if(i_grass_array_index >= 1000)&&(i_max_grass >= 200){define_nearest_pos();}//IF its has finished defining and creating ...
Well heres a mistake, should give a compile error. you close the if but youre not done with your statement yet.
Code:
if(i_grass_array_index >= 1000&&i_max_grass >= 200){define_nearest_pos();}//IF its has finished defining and creating ...
You do not need the IF at all anyway, for you will only reach the call to function define_nearest_pos() if the while loops are completed.
I don't think it will work if I look to the rest of your code, but ;et's first see what happens now...
EDIT
Where do you fill the variable grass_index at all? Only in the function put_grass and surely nowhere else?