When a character enters a dialog, story automatically prevents it from joining combat. My guess is that your script is conflicting with this code.
Disabling CanJoinCombat/CanFight is generally not a good way to temporarily prevent combat from starting. It's better to use
alignments and relations.