How can I be idolized by NCR, yet attacked by NCR troopers in NCRCF?
Solution 1:
When you side with the Powder Gangers in I fought the law the NCR soldiers who attack the prison will always be hostile to you until they are killed, regardless of your reputation with the NCR.
If the NCR soldiers are killed by the Powder Gangers, via silenced guns, by melee/unarmed weapons, or while wearing NCR armor which you then take off you will not suffer reputation loss with the NCR and NCR soldiers outside of the prison should not be hostile to you.
If you kill the NCR soldiers without stealth or with an unsuppressed weapon you will suffer the normal reputation penalty and may make external NCR soldiers hostile to you.