Salk

[KotOR] Sand People Enclave bug

23 posts in this topic

Hello!

I was wondering if someone else could reproduce this annoying glitch that I have been experiencing myself. It seems that the Transit Back function used when wearing the Sand People disguise causes the disguise itself to not work anymore under certain conditions I need to investigate.

Cheers!

Share this post


Link to post
Share on other sites

I tried it and didn't encounter that problem, but I've had problems like that before. I noticed that fast travel changes the disguise items; there are probably different UTI files contained in each area's static RIM archive, rather than a single global diguise item. But the only oddity that caused, at least for me, was that they're sorted separately in the inventory.

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, JCarter426 said:

I tried it and didn't encounter that problem, but I've had problems like that before. I noticed that fast travel changes the disguise items; there are probably different UTI files contained in each area's static RIM archive, rather than a single global diguise item. But the only oddity that caused, at least for me, was that they're sorted separately in the inventory.

Yes,

I can confirm the additional oddities with the stacking of the items. I will investigate further and provide some results. I think one viable course of action may be disable fast travel when wearing a disguise but I am not sure if that is possible. I noticed (using the editor) that there is a flag called "Unescapable" in the .are file that should be the one controlling this. I doubt it can be changed dynamically though.

 

Cheers!

Share this post


Link to post
Share on other sites

Some initial update about the glitches with the Sand People disguise.

If someone could confirm this same behavior I would be grateful:

- Enter the Dune Sea (first desert map exiting Anchorhead), kill one group of Tusken. Swap to party members of droids and wear the robe or, alternatively, fight another group and just have one droid and two disguises worn. At this point you should be able to go around the map (and indeed close to the group of Tusken guarding the entrance to their territory) without problems. And that is the desired behavior because the party is disguised.

 

- But see what happens if you, with the party disguised, return to the Ebon Hawk or just back to Anchorhead from the gate. The disguises will be stripped from those party members that were wearing it and clothes are automatically put on instead.  At this point go out again just wearing clothes. You will notice that the game still thinks the party is disguised (see picture)

 

154935935_StarWars_KnightsoftheOldRepublic2018-11-1916_46_04.png.82e34090722df76c7c783b88671b0158.png

Share this post


Link to post
Share on other sites

This glitch seems to find its "reverse" in the next map where, during another kind of test, I have been ambushed by Tusken even if my party was correctly disguised.

At first I thought it was a problem with a boolean not being set right (tat_TuskenSuit) but in the picture above it is correctly set to 0 so that cannot be the issue.

Unfortunately the entrance script and most of the Tusken scripts cannot be decompiled, giving failure when I attempted to investigate. This makes everything much harder to diagnose.

Help from more experienced modders very much welcome.

Cheers!

Share this post


Link to post
Share on other sites

This is something that I'd love to fix in the K1CP.

I've also noticed that saving the game while disguised causes the bug when you reload: your disguise doesn't work till you take it off and put it back on.

In general I think taking it off and putting it back on will workaround the issue, but I'd love to get to the bottom of it :)

  • Like 1

Share this post


Link to post
Share on other sites
16 hours ago, Salk said:

I think one viable course of action may be disable fast travel when wearing a disguise but I am not sure if that is possible. I noticed (using the editor) that there is a flag called "Unescapable" in the .are file that should be the one controlling this. I doubt it can be changed dynamically though.

It can, but I don't think it would be a practical solution. Seems the bug isn't limited to that anyway.

4 hours ago, A Future Pilot said:

I've also noticed that saving the game while disguised causes the bug when you reload: your disguise doesn't work till you take it off and put it back on.

Hmm, that would explain the problem I had before. I loaded up a bugged save to see what I could do with it with that in mind. I had to exit the Sand People Territory and reequip the items. When I returned to their territory, I triggered one of the [A small group of Sand People ambush you!] encounters, but nobody else was hostile and the disguises otherwise worked correctly. That would suggest the trigger is handled through area scripts. I looked through the module.ifo files and found the Mod_OnAcquirItem scripts set up for the Dune Sea and Eastern Dune Sea. I couldn't get k_ptat18aa_acqui or k_ptat18ac_acqui to decompile, but I can make some educated guesses about what's going on.

  • First, those scripts only fire when items are equipped when you're in those areas. You equip a clothing item, the script runs and does whatever cryptic thing it's doing that we can only guess at. So you have to equip the disguise items in those specific modules - m18aa and m18ac - for the script to fire and set the state correctly.
  • Returning to the Ebon Hawk with the fast travel option likely fails to unset that state. This would be an issue with one of m17ab's scripts, k_ptat17ab_enter. That one wouldn't decompile for me either.
  • It appears that m18ab doesn't do anything at all with regard to the disguise. It seems the AI for the NPCs in that area actively checks if you have the disguise equipped and they'll go hostile if you're not disguised. This is unrelated to the other disguise checks. I was also able to kill them all, leave, equip the disguise, and return and enter the enclave incognito. Conversely, it means they don't bug out when everything else does.
  • The Sand People ambush triggers probably fail to check for the disguise at all.
  • Finally, while I was testing all that, I discovered another bug. If I equip the disguise and then unequip it or equip another item, the game crashes when loading m18ab.

It's hard to say what can be done to fix the problem when I can't look at the source scripts, but my instincts tell me to modify the OnEnter scripts. Simply have them check if the disguises are properly equipped and set the state accordingly. And if you do that you could just dummy out the other stuff. I don't know why OnAcquirItem was used instead of that. But it's clearly not behaving as intended, so it's hard to guess how it was supposed to work.

 

Share this post


Link to post
Share on other sites

Hello, JCarter426!

4 hours ago, JCarter426 said:

It can, but I don't think it would be a practical solution. Seems the bug isn't limited to that anyway.

Absolutely, yes. Initially I was just hoping it was a much more limited problem. Your investigation showed it is a rather nasty glitch we are dealing with instead.

 

4 hours ago, JCarter426 said:

Hmm, that would explain the problem I had before. I loaded up a bugged save to see what I could do with it with that in mind. I had to exit the Sand People Territory and reequip the items. When I returned to their territory, I triggered one of the [A small group of Sand People ambush you!] encounters, but nobody else was hostile and the disguises otherwise worked correctly. That would suggest the trigger is handled through area scripts.

I came to the same conclusion after doing the very same thing here.

About this though:

10 hours ago, A Future Pilot said:

I've also noticed that saving the game while disguised causes the bug when you reload: your disguise doesn't work till you take it off and put it back on.

I have (had? Must check) a save game just outside of the entrance to the Sand People Enclave with the Party disguised and when I load it, what happens is that the turrets turn hostile and the henchmen of course engage them. The fight goes on for a few seconds then the turrets return to non hostile. I didn't need to unequip and reequip anything in order for it to happen.

Cheers!

Share this post


Link to post
Share on other sites

Hmm, that's not what happens to mine. I have a bugged save with everybody disguised just outside the enclave as well. When I load it, nobody in the area attacks me (because I am disguised) but if I enter the enclave, everybody inside immediately goes hostile.

Share this post


Link to post
Share on other sites

That happens to me as well.

Only, on top of that, I also had that glitch (now I cannot seem to reproduce it anymore loading that very saved game - it must have been some additional, temporary issue).

The reason why Mod_OnAcquirItem is used is likely due to the game setting a journal entry about the disguise as soon as you obtain the clothes.

Share this post


Link to post
Share on other sites

Probably not but the faction state is the right thing to purse.

In fact, opening one of the scripts associated with the various ambush triggers in the Dune Sea we get this (lucky, it could be decompiled!):

void main() {
    object oPC = GetFirstPC();
    object oEntering = GetEnteringObject();
    object oNearestTat18_encoun_spk = GetNearestObjectByTag("tat18_encoun_spk", OBJECT_SELF, 1);
    object oTat18_tuskanfac = GetObjectByTag("tat18_tuskanfac", 0);
    SetGlobalNumber("tat_DuneSeaEnc", 1);
    object oTat18_tusken05 = GetObjectByTag("tat18_tusken05", 0);
    object object11 = GetObjectByTag("tat18_tusken05", 1);
    object oTat18_tusken06 = GetObjectByTag("tat18_tusken06", 0);
    if ((((((IsObjectPartyMember(oEntering) == 1) && (GetIsEnemy(oPC, oTat18_tuskanfac) == 1)) && ((GetDistanceToObject(oTat18_tusken05) > 40.0) || (GetIsObjectValid(oTat18_tusken05) == 0))) && ((GetDistanceToObject(object11) > 40.0) || (GetIsObjectValid(object11) == 0))) && ((GetDistanceToObject(oTat18_tusken06) > 40.0) || (GetIsObjectValid(oTat18_tusken06) == 0)))) {
        SetPartyLeader(0xFFFFFFFF);
        AssignCommand(oNearestTat18_encoun_spk, ActionStartConversation(oPC, "", 0, 0, 1, "", "", "", "", "", ""));
        DestroyObject(OBJECT_SELF, 0.0, 0, 0.0);
    }
}


 

The interesting part is that, from what I understand, the encounter is triggered if tat18_tuskenfac is hostile. I could easily trigger the ambush by replacing that conditional check with a check for the boolean but then we would need to add a line that switches the faction to hostile too or my guess is (but It I will test it soon enough) that the ambush will spawn but the tusken won't be hostile.

Cheers!

Share this post


Link to post
Share on other sites

Well, the first problem in the first area (Dune Sea) is fixed. Now the Rapid Transit  (or walking back to Anchorhead)  when successfully disguised won't cause the party to have free passage unless they put the disguise back on.

Solution: change the OnHeartBeat  (m18aa.are) from the original k_ptat18aa_heart to a custom one (like k_cri18aa_heart):

void main() {
  object oTat18_tuskanfac = GetObjectByTag("tat18_tuskanfac", 0);
  object oPC = GetFirstPC();
  if ((GetIsEnemy(oPC, oTat18_tuskanfac) == 0) && (GetGlobalBoolean("tat_TuskenSuit") == 0)) {
    ChangeToStandardFaction(oTat18_tuskanfac, 1);
    ExecuteScript("k_ptat18aa_heart", OBJECT_SELF, 0xFFFFFFFF);
  }
  else {
        ExecuteScript("k_ptat18aa_heart", OBJECT_SELF, 0xFFFFFFFF);
    }
}

 

Now I should tackle the issue in the Sand People Territory map but I suppose something similar is happening there as well.


Cheers!

Share this post


Link to post
Share on other sites

I did some more testing, but it only raises more questions. I noticed that, regardless the save and transit bugs, if you repeatedly enter and exit the Sand People enclave without triggering the the greeter's dialogue, then the Sand People faction switches back and forth with each repeated entrance.

On 11/20/2018 at 9:01 AM, Salk said:

Solution: change the OnHeartBeat  (m18aa.are) from the original k_ptat18aa_heart to a custom one (like k_cri18aa_heart)

I'd suggest executing the original heartbeat script first. That way you know all of it runs correctly and then the part that went wrong is fixed. But I don't think you need to edit 18aa's at all. My guess is that it's actually the OnEnter for 17ab that's going wrong. I'm not sure how, though, because the globals are correct.

With both those in mind, I would guess that the scripts are somehow checking the globals incorrectly. Maybe a bunch of if trees that fail to account for a specific combination of things, or maybe something more obscure like case sensitivity. Though we can only keep guessing so long as we can't actually look at the scripts.

Share this post


Link to post
Share on other sites

Hello, JCarter426!

I think you are right. While my solution above seems to partly address the issue (but there are outstanding problems, like the fact that the area would turn hostile even when the Player is working to help the Sand People which I sort of remedied with an inelegant series of exclusions using GetJournalEntry), it is far from ideal and when I tried figuring out things in the next area, I was met with additional problems. Unfortunately the interesting scripts following the dialogue with the Sand People Chief can't, again, be converted to source but I did take a few steps in the right direction (I think).

I will keep you updated in case I find out more! 

Cheers!

Edited by Salk

Share this post


Link to post
Share on other sites

@JCarter426 Can you please confirm that most of the Tuskens  in m18aa guarding the entrance to the Sand People territory will just do nothing after turning hostile if you talk to them while disguised? That is what happens in my game both with and without modifications.

Thanks!

Share this post


Link to post
Share on other sites

I never tried talking to them in 15 years. 🤔

It seems any NPC I talk to turns hostile, but they don't attack unless I attack them. And none of the others seem to care if we start fighting.

Share this post


Link to post
Share on other sites

Hello!

 

52 minutes ago, JCarter426 said:

I never tried talking to them in 15 years. 🤔

It seems any NPC I talk to turns hostile, but they don't attack unless I attack them. And none of the others seem to care if we start fighting.

 

Then you are confirming that this happens to you too. I have worked to make things a little better in the very unlikely case that someone would want to talk to them while wearing a disguise. That would now lead to the robes being removed triggering the same reaction a non disguised party would.

 

Thanks!

 

PS I take the opportunity to ask you an additional question: do you know if there is a way to force to conversation to be done with the protagonist rather than any other party member that would initiate it? I know the game does it at times with a quick fade out/fade in effect.

Share this post


Link to post
Share on other sites

I believe it's the last parameter:

void ActionStartConversation(object oObjectToConverse, string sDialogResRef = "", int bPrivateConversation = FALSE, int nConversationType = CONVERSATION_TYPE_CINEMATIC, int bIgnoreStartRange = FALSE, string sNameObjectToIgnore1 = "", string sNameObjectToIgnore2 = "", string sNameObjectToIgnore3 = "", string sNameObjectToIgnore4 = "", string sNameObjectToIgnore5 = "", string sNameObjectToIgnore6 = "", int bUseLeader = FALSE);

I'm guessing it's executed through a custom OnDialogue script for the NPC, but I'm not sure what the exact code would be.

  • Like 1

Share this post


Link to post
Share on other sites

Hello!

Indeed that last parameter seems to be correct but it seems it is enough to change a couple of flags:  

1) In the relevant .utc file PartyInteraction needs to be set to 0

2) In the relevant .dlg file ConversationType should be set to 2

I discovered this by comparing files in one conversation that can be had with any party member and one that forced talk with the protagonist. As a minor thing, once the latter is over the game switched automatically focus on the henchman, if it was the dialogue trigger. I would like to change that so that the selection stays with the protagonist because right now it is a bit inconsistent (unless it would cause problems?).

Cheers!

Share this post


Link to post
Share on other sites

Update:

one interesting fact I just discovered. If you enter the SP Enclave controlling a henchman rather than the protagonist, this will trigger the hostile reception. If you leave the Enclave to avoid the fight, there will be a brief period of hostility (until the OnHeartbeat area script fixes things) with the turrets firing shots. Then it is possible to enter the Enclave again (this time controlling the protagonist) and things would work fine.

This seems to be caused by a bug in the .are file which I am surprised nobody found out about before: the OnExit has the area heartbeat script set to it. It is enough to remove it and the issue above is gone.

Cheers!

 

Update2:

It seems I can no longer replicate that behavior. I am baffled.

Edited by Salk

Share this post


Link to post
Share on other sites

Well, after more testing, I think all that was critically bugged in the Tatooine desert is finally fixed.

Naturally I could only test stuff on my local installation so if someone else is available for doing some testing, just let me know.

Cheers!

Share this post


Link to post
Share on other sites
Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

×   Your link has been automatically embedded.   Display as a link instead