Currently there exists three combat-related JS events:
function onAttack( pAttacker, pDefender ) - which activates for pAttacker whenever pAttacker actually hits pDefender
function onDefense( pAttacker, pDefender ) - which activates for pDefender whenever pAttacker actually hits pDefender
functon onSwing( iSwung, pSwinging, pSwingAt ) - which activates for pSwinging whenever UOX3 *thinks* they ought to swing at eachother, even if they are miles apart (bug?).
But there's no way from these events to do anything the [em]exact moment[/em] combat is initiated, or the moment it ends. Thus I suggest two new JS events, if they are possible:
onCombatStart( pAttacker, pVictim ) - would run for both characters involved the exact moment combat is initiated - though they would fill the same "roles" in both cases. pVictim is pVictim no matter who the script activates for, and the attacker is the attacker.
onCombatEnd( pAttacker, pVictim, endReason ) - same as above, only when combat ends (when both parties have ended it). endReason could be a variable from 0 - X, where each value represents a certain way the combat ended (combatants died, both characters exited combat mode, out of range, etc).
If anyone else have ideas for additional arguments to include apart from who's attacking and who's being attacked, that would be nice =)