The effect of the ambient plasma conditions on the variation of charge on dust grains