And I do not know where your problem lies. The above are some of the actions/events/functions that you may use to solve your issue.
There is an event type called "Unit takes damage", which triggers when a specific unit takes damage. Register all possible units with that event. The event response "Taken Damage" (real) then gives you how many damage the unit took/the damage source caused, "Damage Source" (unit) is available. Get it's owning player with "Owner of Unit" function and place that inside a "Player - Add Property" action to add the resource. Yes, it is very easy. Another thing you should do though is to catch when a new building enters the game, maybe via "Unit completes construction" event.