How to make NPCs track the player's aim offset position and react to it?

I have four 2d aim offsets for the player: weapon is one handed sword.

  1. Left hand defensive: left hand retracted
  2. Left hand offensive: left hand extended
  3. Right hand defensive: right “”
  4. Right hand offensive: right “”

Basically, when LMB is being pressed we go from 1 to 2, and when RMB is being pressed we go from 3 to 4. So the attack of the player is done by holding LMB or RMB and dragging the mouse around.

I was wondering how to make the NPCs position their weapons relative to mine?

For example if I have the left hand in offensive mode (LMB pressed) in the top left position of the 2d aim offset, the NPC should position his weapon in the same position in defensive mode.

I though of sending the data of the X and Y values of the 2d offset from the player to the NPC and have the NPC use this values in his aim offset. But I do not know how to exactly do this… Is there a better alternative?

For example, variables would be:
bool- IsLMBpressed?
bool- IsRMBpressed?
float- Xvalue
float- Yvalue

the floats would read the values of the playable character 2d aim offset, and the bools would determine if we are attacking or defending. Then this info would be sent to the NPC (an event dispatcher maybe so that all enemies in range would receive it?) and it would be used as input for the NPC’s aim offset.

What do you think? If this is alright, how could I read the values of the X and Y values? Should I use input of X and Y or rather the position?

edit: this system doesn’t really convince me since if the player is not exactly in front of us but has a position offset, he could be covering the wrong position with his weapon.
Also,the input from the player doesn’t represent the position of the weapon in the world, but rather the mouse movement. Maybe I could use the mouse position on screen divided by the resolution of the viewport, so to have a value between 0 and 1?