Well, for that I'd just write a script that makes the target entity always at the same location as the enemy (but a litte bit forward so it isn't clipped) and then just write a code that says if(something is targeted) { fire the weapon in the direction of the target and not the regular direction }

If you want your weapons to lock onto the target and "seek" it, that's deceptively easy as well. Just call vec_to_angle every frame during the movement function of the weapon.

If you want any examples or anything please let me know.