It only happens when the pressure of nitrogen is high. If the pressure is kept low by staying at a shallower depth it will not happen. If the breathing gas has less nitrogen it will only start at a deeper depth. Helium gas can be used in place of nitrogen in breathing gas for divers to make it less likely to have nitrogen narcosis.