From time to time when playing games i have had open borders agreements with many other civs on the same continent. When my military units are transiting through the civs territory they sometimes stop in one of their cities. The city then gets attacked by a barbarian unit and my unit is the one that is attacked instead of the host civs unit. Sometimes my unit is lost sometimes it is victorious.
My question then is this, is it possible to earn a boost in relations with the host civ for defending their city?
Additionaly if your unit is lost in defending another civs city and the city subsequently falls to the barbarians is it possible to gain a negative relations hit due to 'my unit opening the gates to the enemy?'
I understand enough about modding to know that this would be an event but have no idea where to start on implementing or experimenting with it.
Can anyone shed any light on this?
My question then is this, is it possible to earn a boost in relations with the host civ for defending their city?

Additionaly if your unit is lost in defending another civs city and the city subsequently falls to the barbarians is it possible to gain a negative relations hit due to 'my unit opening the gates to the enemy?'

I understand enough about modding to know that this would be an event but have no idea where to start on implementing or experimenting with it.

Can anyone shed any light on this?