While testing the Xor encounter for my dark side Juhani quest, I noticed that sometimes the final dialog won't start after fighting Xor. I haven't changed that behaviour so I guess it's a vanilla bug but if possible I'd like to fix it. The problem is that I have no idea why it's failing. My testing was done on Manaan where it worked most of the time but also failed a few times.

The dialog is started from Xors (kas_xor1.utc) OnUserDefine script (k_kas_xor_user). Here's the decompiled version:

// Globals int intGLOB_1 = 1; int intGLOB_2 = 2; int intGLOB_3 = 3; int intGLOB_4 = 4; int intGLOB_5 = 5; int intGLOB_6 = 6; int intGLOB_7 = 3; int intGLOB_8 = 4; int intGLOB_9 = 5; int intGLOB_10 = 6; int intGLOB_11 = 7; int intGLOB_12 = 1; int intGLOB_13 = 2; int intGLOB_14 = 3; int intGLOB_15 = 4; int intGLOB_16 = 5; int intGLOB_17 = 6; int intGLOB_18 = 7; int intGLOB_19 = 8; int intGLOB_20 = 9; int intGLOB_21 = 10; int intGLOB_22 = 11; int intGLOB_23 = 12; int intGLOB_24 = 13; int intGLOB_25 = 14; int intGLOB_26 = 15; int intGLOB_27 = 16; int intGLOB_28 = 17; int intGLOB_29 = 18; int intGLOB_30 = 19; int intGLOB_31 = 20; int intGLOB_32 = 21; int intGLOB_33 = 22; int intGLOB_34 = 23; int intGLOB_35 = 24; int intGLOB_36 = 25; int intGLOB_37 = 26; int intGLOB_38 = 27; int intGLOB_39 = 28; int intGLOB_40 = 29; int intGLOB_41 = 30; int intGLOB_42 = 59; int intGLOB_43 = 0; int intGLOB_44 = 1; int intGLOB_45 = 2; int intGLOB_46 = 29; int intGLOB_47 = 30; int intGLOB_48 = 34; int intGLOB_49 = 35; int intGLOB_50 = 36; int intGLOB_51 = 37; int intGLOB_52 = 38; int intGLOB_53 = 39; int intGLOB_54 = 41; int intGLOB_55 = 42; int intGLOB_56 = 46; int intGLOB_57 = 47; int intGLOB_58 = 15; int intGLOB_59 = 10; int intGLOB_60 = 5; int intGLOB_61 = 2; int intGLOB_62; int intGLOB_63; int intGLOB_64; object objectGLOB_1; int intGLOB_65; int intGLOB_66; int intGLOB_67; int intGLOB_68; int intGLOB_69; int intGLOB_70; int intGLOB_71 = 1; int intGLOB_72 = 2; int intGLOB_73 = 3; int intGLOB_74 = 20; int intGLOB_75 = 21; int intGLOB_76 = 22; int intGLOB_77 = 23; int intGLOB_78 = 24; int intGLOB_79 = 25; int intGLOB_80 = 26; int intGLOB_81 = 27; int intGLOB_82 = 28; int intGLOB_83 = 31; int intGLOB_84 = 32; int intGLOB_85 = 33; int intGLOB_86 = 40; int intGLOB_87 = 43; int intGLOB_88 = 44; int intGLOB_89 = 45; int intGLOB_90 = 48; int intGLOB_91 = 49; int intGLOB_92 = 50; int intGLOB_93 = 51; int intGLOB_94 = 52; int intGLOB_95 = 53; int intGLOB_96 = 54; int intGLOB_97 = 55; int intGLOB_98 = 56; int intGLOB_99 = 57; int intGLOB_100 = 58; int intGLOB_101 = 60; int intGLOB_102 = 61; int intGLOB_103 = 62; int intGLOB_104 = 63; int intGLOB_105 = 64; int intGLOB_106 = 65; int intGLOB_107 = 66; int intGLOB_108 = 67; int intGLOB_109 = 68; int intGLOB_110 = 69; int intGLOB_111 = 70; int intGLOB_112 = 71; int intGLOB_113 = 72; int intGLOB_114 = 1; int intGLOB_115 = 2; int intGLOB_116 = 3; int intGLOB_117 = 4; int intGLOB_118 = 0; int intGLOB_119 = 1; int intGLOB_120 = 2; int intGLOB_121 = 3; int intGLOB_122 = 4; int intGLOB_123 = 5; int intGLOB_124 = 6; int intGLOB_125 = 7; int intGLOB_126 = 8; int intGLOB_127 = 9; int intGLOB_128 = 10; int intGLOB_129 = 11; int intGLOB_130 = 12; int intGLOB_131 = 13; int intGLOB_132 = 14; int intGLOB_133 = 15; int intGLOB_134 = 16; int intGLOB_135 = 17; int intGLOB_136 = 18; int intGLOB_137 = 19; int intGLOB_138 = 1100; int intGLOB_139 = (-6); int intGLOB_140 = (-5); int intGLOB_141 = (-4); int intGLOB_142 = (-2); int intGLOB_143 = (-1); int intGLOB_144 = 0; // Prototypes void sub2(int intParam1, int intParam2); void sub1(object objectParam1, int intParam2); void sub2(int intParam1, int intParam2) { SetLocalBoolean(OBJECT_SELF, intParam1, intParam2); } void sub1(object objectParam1, int intParam2) { if (GetIsObjectValid(objectParam1)) { if (((intParam2 == 1) || (intParam2 == 0))) { SetLocalBoolean(objectParam1, intGLOB_128, intParam2); } } } void main() { int int1 = GetUserDefinedEventNumber(); if ((int1 == 1001)) { } else { if ((int1 == 1002)) { int nGlobal = GetGlobalNumber("K_XOR_AMBUSH"); if ((nGlobal == 1)) { NoClicksFor(1.2); DelayCommand(1.0, ActionStartConversation(GetFirstPC(), "", 0, 0, 1, "", "", "", "", "", "")); } } else { if ((int1 == 1003)) { } else { if ((int1 == 1004)) { } else { if ((int1 == 1005)) { } else { if ((int1 == 1006)) { object oKas_xor2 = GetObjectByTag("kas_xor2", 0); object oKas_xor3 = GetObjectByTag("kas_xor3", 0); if ((((GetCurrentHitPoints(OBJECT_SELF) <= 20) && (!GetIsObjectValid(oKas_xor2))) && (!GetIsObjectValid(oKas_xor3)))) { ClearAllActions(); DelayCommand(0.4, SurrenderToEnemies()); DelayCommand(0.5, CancelCombat(GetPartyMemberByIndex(0))); DelayCommand(0.5, CancelCombat(GetPartyMemberByIndex(1))); DelayCommand(0.5, CancelCombat(GetPartyMemberByIndex(2))); DelayCommand(0.5, CancelCombat(OBJECT_SELF)); NoClicksFor(1.2); DelayCommand(1.0, AssignCommand(GetObjectByTag("invis_xor_conv", 0), ActionStartConversation(OBJECT_SELF, "", 0, 0, 0, "", "", "", "", "", ""))); AdjustReputation(GetFirstPC(), OBJECT_SELF, 100); } else { if ((GetCurrentHitPoints(OBJECT_SELF) <= 20)) { sub1(OBJECT_SELF, 1); sub2(intGLOB_103, 1); ChangeToStandardFaction(OBJECT_SELF, 5); ClearAllActions(); DelayCommand(0.4, SurrenderToEnemies()); DelayCommand(0.8, PlayAnimation(28, 1.0, (-1.0))); } } } else { if ((int1 == 1007)) { } else { if ((int1 == 1008)) { } else { if ((int1 == 1009)) { } else { if ((int1 == 1010)) { } } } } } } } } } } }

My first guess was that the difference is whether his henchmen die before he goes under 20 HP or not but I tried killing them first multiple times and got both the desired dialog start and the bug. My only guess would be that ActionStartConversation somehow fails, but I don't really see why it would.

Anyone here with better ideas?