Scenario:
A druid ally is in melee range of an enemy berserker and decides to move away, provoking an attack of opportunity from the berserker.
My character has readied an action: Cast Eldritch Blast (with Repelling Blast invocation) on the berserker in question if he attacks the druid.
What I think happens
The druid's movement is interrupted by the attack of opportunity which is in turn interrupted by the readied Eldritch Blast. Assuming the Eldritch Blast hits, I can push the berserker out of melee range of the druid, thereby negating the attack of opportunity.
Is this correct?
Similar situations
What if, rather, the trigger was the druid moving?
What if the trigger was the berserker raising his weapon or rearing back in preparation for an attack?
Best Answer
Your Druid Gets Attacked, then the barbarian gets pushed
The trigger for your readied action was:
It is stated in the Dungeon Master's Guide (p. 252) that:
So your readied Eldritch Blast will occur right after the berserker attacks the druid.
The alternative triggers would not improve matters much. If you specified the trigger was "the berserker raises his weapon to attack", that might be tricky, because the trigger has to be a "percievable circumstance." In combat, everyone always looks like they're just about to attack each other: what if the enemy doesn't "raise" a weapon, but stabs with it? What if they raise a weapon in salute?
If the tirgger was the Druid's movement, that's no good either because the Barbarian will attack before the Druid moves away from his reach (as that's the timing specified in Opportunity Attacks), and you'd Eldritch Blast after the Druid finished moving away from his reach (since it's a Readied action, and happens after its trigger), so the berserker would still attack first.
A relevant question that has been asked before is can I specify a trigger to be "before... occurs"? (Mostly, you can't).