Well im not entirely sure but woudlnt you just print the text with respect to the objects x and y positions. Im pretty sure you have to know where the object is to be able to draw it so you should have these variables stored somewhere. then simply:
dbText(objectsxposition, objectsyposition-32, "A Guard");
i just tested this and it works fine.
the text may appear to shift depending on which direction the object is moving. this is most likely due to the dbText function being run before the object has been moved. To fix this all you need to do is ensure that the dbText event is after any position changes for the object it is following.