Just use this funcion MakeFog() wenever you want to use fog.
function MakeFog() { camera.fog_start = 8000; //Distance camera.fog_end = 10000; //Max range of the fog fog_color = 1; d3d_fogcolor1.red = 64; //Choose the colors d3d_fogcolor1.green = 64; //Choose the colors d3d_fogcolor1.blue = 64; //Choose the colors }