every 2 weeks I get a nocturnal emission but without the dream. when I wake up I can see a spot of semen on my clothes and that's it. I heard that if you engage in masturbation or sexual activity, this can be avoided. so is it halal if I masturbate to avoid this?
absolutely not, i would not suggest you to masturbate, having nocturnal emission can be unpleasant, yes, but you should absolutely never masturbate to avoid this, since not only is it haram, but it will also give you even more haram desires and you might even get addicted to masturbation, which is much worse.