Originally Posted by stoffe
You don't, they are scripts for two separate events (assuming you don't mean the oneliner dialog action script when you say "the second script"). The first script posted was a custom script for the OnHeartbeat event of the NPC, while the third script was a custom script for the OnCombatRound event. You set them both in the UTC template of the NPC who should follow/attack (the Scripts tab if you use KotorTool's UTC editor).
Oh yeah, of course. But I don't see the OnCombatRound in the .utc file. There's OnAttacked and OnEndRound though.