Question about rogue in NWN2

Copy from here:
https://neverwintervault.org/forums/neverwinter-nights-2/players-corner-nwn2/question-about-rogue-nwn2#comment-43127

Hello, I have a question. When I play by rogue - my rogue always tries to exit stealth mode(if stealth mode set to Off) or enter stealth mode(if it set to On) if I don’t control him. Is it possible to set player AI to restrict exit or enter stealth mode without my command? It is hard to use rogue when I send him in stealth mode to far warrior(archer or mage) to make a sneak attack and try to control other members of party while rogue is sneaking - rogue always exits stealth.

There are only two options in behaviour.
1.Enable/Disable AI of group member.
2.Set stealth mode for party member - always sneak/sneak when not in battle/never sneak(I don’t remember clearly it’s names).

Party member starts sneaking when we set “always sneak/sneak when not in battle” even his AI is disabled. Also party member stops sneaking automatically when we set “never sneak” even if AI is disabled. As I understand - we don’t have option to “restrict exit or enter stealth mode without my command”.

uhmm you may not like this … i got the behavior you’re looking for by modifying the .XML for the right-click context menu and adding options “stealth” and “unstealth”, similar to the already existing “unsummon” Animal Companion option in the same dropdown. Only different … It was a long time ago, but i remember things getting tedious having to go to the Behaviors page to click stealth on and off too often.

I might have had to disable the corresponding behavior in the Companion AI … idk, because whenever a hazard appears I immediately click the AI off and do puppet only.

The file modified is ‘contextmenu.xml’, UIRadialNode name=“root-allies”

<UISubNode node="node-stealth" /> <!-- kL_add -->
<UISubNode node="node-nostealth" /> <!-- kL_add -->

and added these subradials beneath that:

<!-- kL_add: associate command to go stealth -->
<UIRadialNode name="node-stealth" style="BASE_RADIAL_NODE" text="Stealth"
OnLeftClickCollapsed='UIObject_Misc_ExecuteServerScript("gui_bhvr_stealth_perm","1")' > <!-- kL: taken from CreatureExamine.XML, l.841 -->
    <UIFrame state="base" fill="is_invis.tga" />
</UIRadialNode>

<!-- kL_add: associate command to stop stealth -->
<UIRadialNode name="node-nostealth" style="BASE_RADIAL_NODE" text="deStealth"
OnLeftClickCollapsed='UIObject_Misc_ExecuteServerScript("gui_bhvr_stealth_none","1")' > <!-- kL: taken from CreatureExamine.XML, l.834 -->
    <UIFrame state="base" fill="is_invisgreat.tga" />
</UIRadialNode>

But, again, I can’t remember if there were changes to the AI (itself) that needed to be done. Probly not: all the above does is access the same scripts that the radio-buttons on a character’s Behaviors page does