Sign in to follow this  
Kexikus

Conversation sometimes not starting

13 posts in this topic

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?

Share this post


Link to post
Share on other sites

I was always kind of a hack scripter, piecing together scripts from examples from existing tbreads. I don't know a lot. However, when faced with a similar problem, I would start each dialog firing script with, if I recall correctly, AClearallAction, ClearallCommands entry.

 

And/or i would put a delay of 2-3 seconds on the start dialog.

Share this post


Link to post
Share on other sites

Kexikus,

 

if you don't mind giving it a try, I would check whether the bug still occurs after commenting out the ClearAllActions() in the script.

Share this post


Link to post
Share on other sites

I was always kind of a hack scripter, piecing together scripts from examples from existing tbreads. I don't know a lot. However, when faced with a similar problem, I would start each dialog firing script with, if I recall correctly, AClearallAction, ClearallCommands entry.

 

And/or i would put a delay of 2-3 seconds on the start dialog.

 

ClearAllActions is already in, ClearAllCommands doesn't exist. And there is a delay already. Increasing that might work though.

 

Kexikus,

 

if you don't mind giving it a try, I would check whether the bug still occurs after commenting out the ClearAllActions() in the script.

 

Didn't work but thanks for the suggestion.

 

I think I'm just going to leave this as it is. I've played that encounter around 15 times and the issue occured only 2 times or so which makes testing really annoying and also isn't that often, so I guess it doesn't really matter either. But if anyone has some more ideas, please let me know and I'll give them a shot.

  • Like 1

Share this post


Link to post
Share on other sites

Sorry it didn't help.

 

I was having similar issues with script modding in the Infinity Engine (Baldur's Gate) and ClearAllActions() inhibited sometimes other actions in the same script block. I must say I never experienced that bug myself. The only issue I addressed in the now defunct project of mine was when Xor would not appear if not using the rapid transit system.

Share this post


Link to post
Share on other sites

The only issue I addressed in the now defunct project of mine was when Xor would not appear if using the rapid transit system.

 

That's an issue? Never encountered that myself. All I know is that the second Xor encounter doesn't work on Tatooine. Could you tell me more about that bug?

Share this post


Link to post
Share on other sites

Well, first of all. I had recreated the whole ambush on Tatooine in SW: KotOR Upgrade... There is an image of it here, in case you are interested. This and much more will never be released but such was its destiny, it seems... ;)

 

Many years ago Darth333 had figured that in some cases the second Xor encounter would not start unless the party was using the rapid transit system and came with a fix for it, making a few changes to k_sup_gohawk.ncs (source file is available).

Share this post


Link to post
Share on other sites

Are you sure the global is being properly set to 1? I've heard of that being a problem before. I'm assuming that's meant to happen when all the henchmen die and Xor's health is below a certain amount.

 

If it's not that, then I would guess the problem is in his heartbeat script rather than anything there, since the user defined script only ever fires from that. You could probably ignore the problem entirely and simply fire the dialogue from his heartbeat script, too.

Share this post


Link to post
Share on other sites

Well, first of all. I had recreated the whole ambush on Tatooine in SW: KotOR Upgrade... There is an image of it here, in case you are interested. This and much more will never be released but such was its destiny, it seems... ;)

Now that alone would make a great stand-alone mod. A shame it got cancelled.

  • Like 1

Share this post


Link to post
Share on other sites

Many years ago Darth333 had figured that in some cases the second Xor encounter would not start unless the party was using the rapid transit system and came with a fix for it, making a few changes to k_sup_gohawk.ncs (source file is available).

 

Do you have a link for that?

 

Are you sure the global is being properly set to 1? I've heard of that being a problem before. I'm assuming that's meant to happen when all the henchmen die and Xor's health is below a certain amount.

 

If it's not that, then I would guess the problem is in his heartbeat script rather than anything there, since the user defined script only ever fires from that. You could probably ignore the problem entirely and simply fire the dialogue from his heartbeat script, too.

 

Yeah, that global is set to 1 when the encounter starts. But I don't actually know when that case is actually used. Do you happen to know what each of the UserDefinedEvent numbers are?

 

I don't think the issue is in the heartbeat script though as that's just the default heartbeat script.

Share this post


Link to post
Share on other sites

Oh, my mistake. I assumed it was using an event fired from heartbeat but it's actually his perception event (1002) which... should not be failing. Unless you went into stealth or something. It might be something wrong with the general AI.

 

The other one being used here is the damage event (1006) which makes him surrender. But you said that's working.

 

Still, you could bypass the problem with heartbeat like I was saying before. If you copy the whole 1002 tree to 1001 and put in a condition that the henchmen are dead, then it should fire that when his heartbeat event fires in the event that the other one doesn't.

Share this post


Link to post
Share on other sites

Now that alone would make a great stand-alone mod. A shame it got cancelled.

 

It was just one of the many good things I had worked on.

 

A shame indeed.

Share this post


Link to post
Share on other sites

I recall having the game randomly not triggering scripts it should for whatever reason. My assumption is that either the engine or computer hiccups at a critical point, thus skipping the trigger. Sometimes it appears to be using Force Jump that’s causing this, but sometimes it seems to be just... random. It would be cool to not need to suffer from it though.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this