AssignTargetMarkerToReticleTarget() is bugged or there is something wrong with the target system.
I am creating an addon that auto places markers on targets. Everything I have done on my end works perfectly.
However if a friendly allied character (pets, players and followers) crosses into the reticle as a marker is being placed, they will receive the marker instead.
It does this even with code in place to specifically say don't put markers on players, pets or any character aligned with the player.
I have tried many versions of my own code to remove this problem and it remains consistently bugged.
My suggestion for a possible fix. Is to add a command that allows a marker to be placed on an actor without using the reticle. So I can save the reticle enemy as a ("target"), then PlaceMarkerOnActor("target") instead (while not looking directly at the target).
Had the same Problem and it's not a bug. If the unit below the reticle changes it will just use that one to assign the marker. You can do some checks as you add the marker by kesbind/function and also again at a ZO_PreHook of AssignTargetMarkerToReticleTarget() again: and if the current unit type or name does not match the one you saved as you started the keybind/function to add the marker you can return true to abort the assign.
This would at least fix a changed target below the reticle between your try to add it and the actual call of the assign Target Marker function execution. But if it changes after that, no chance. Keep your crosshair stable and do not move :-)