In any project where I have an object follow another object, I create a couple of scripts for this. One is setParent(id, xOffset, yOffset) and the other is followParent(). The set parent script sets a couple of variables that are needed for the following, including calculating the angle and distance between 0,0 and xOffset,yOffset. Those values are needed in the followParent() script for the lengthdirX/Y() function calls and since it doesn't change I can pre-calculate them. And even if it does change another call to setParent() will fix it. So my "Ship" creates a "turret" object(or a person creates a "gunpoint tip" or whatever), and using the with statement I have the new object call setParent().
Note that an easy way to make this semi-automatic as well is to create a parent object. For this though, I'm referring to parent/child objects in GMS's system. The parent object would have the followParent() script in it's end step event, which let's it follow the parent right after the parent moves. It also has the advantage of that you can put a step event in it without having to call event_inherited(), though if you want extra code in the end step event you still need that function call. Then, any object that I want to be able to follow a parent, I make sure to make it a child of this one controller-type object, and I make sure when it gets created to call the setParent() script as well.