Detecting when an entity has attacked another entity

I was doing this via custom enchant but after giving a level of weakness high enough to cancel damage the game doesn't trigger the enchant anymore, was wondering if anyone knows a way if fixing/working around this
Continue to help post