Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xor doesn't interact properly. #397

Closed
Yulaw9460 opened this issue Jun 14, 2020 · 6 comments
Closed

Xor doesn't interact properly. #397

Yulaw9460 opened this issue Jun 14, 2020 · 6 comments
Labels
Bug Something isn't working Module: Kashyyyk Issue occurs primarily on Kashyyyk Module: Korriban Issue occurs primarily on Korriban Module: Manaan Issue occurs primarily on Manaan Module: Tatooine Issue occurs primarily on Tatooine Type: Scripting This issue is related specifically to a scripting bug/error

Comments

@Yulaw9460
Copy link

First of all, when encountering him the second time with his henchmen, he doesn't trigger the conversation with Juhani in the party with the following battle. For that to happen, I have to travel to another planet. In my current game that means that I've got a passive Xor with two Selkath goons standing outside the Ebon Hawk on Manaan from when the interaction failed the first time.

And they are... Doing. Squat. Nothing. Zilch.

When I get to the other planet, not one, but TWO Xors spawn each with two henchmen. In this run that's Tatooine. I kill them off, have the conversation with one of them, he dies... and the other wounded Xor is still standing there. Enjoying the view as Xor on Manaan.

@DarthParametric
Copy link
Contributor

DarthParametric commented Jun 15, 2020

I assume you are using K1CP v1.8? I see you also posted about this on Reddit. For future reference, please provide as much information as possible in a bug report.

This sounds like it could be a vanilla bug which K1CP does not actually address. We'll need save files from before and after the encounter where Xor first became passive.

@DarthParametric DarthParametric added Bug Something isn't working Needs Info Further information is requested labels Jun 15, 2020
@ancient-animal
Copy link

ancient-animal commented Dec 4, 2020

I have save files that can reproduce this glitch well.

I am playing the version of this game from GOG.com that shows this for the version number: Internal Update (29 May 2019)

I am using ONLY these mods:
K1 Community Patch (version 1.8.1): https://deadlystream.com/files/file/1258-kotor-1-community-patch/
JC's Security Spikes for K1 (version 1.2) [I chose "Option A", to make the spikes work]: https://deadlystream.com/files/file/1439-jcs-security-spikes-for-k1/

I've attached three saves to this message, as a ZIP archive.

If you start the file that says "Game 95", you can walk around in the same area for a few seconds to make Xor appear during his first confrontation. NOT the fight, I mean just the first meeting.

Immediately after, I went to Korriban and talked to the guard of the Academy to make "Yuthura Ban" appear in the Cantina, and saved the game as a save called "Game 134". If you start this file, you can enter the building, and Yuthura will be there to speak to, but you could ignore her and walk all the way back to the spaceship and you will realize that the confrontation with "Xor" WILL work correctly.

After I created the "Game 134" file and noticed that it caused Xor to appear correctly, I RELOADED this "Game 134" file and SPOKE to Yuthura to make her bring me to the Academy, then I quickly rushed through the necessary conversations and walked back to the previous area, right before entering the building that leads to my spaceship, and I saved this progress as a file called "Game 135".

If you start "Game 135", you will appear at the same starting position as the file called "Game 134". You can enter the building and walk all the way back to the ship, and you will notice Xor standing there. His conversation WON'T start. With this "Game 135" file, you could fly back to Manaan, then exit the ship with Carth and Juhani, and realize that you CAN fight Xor and kill him, and the quest will be completed correctly in the Journal. Then, you could fly back to Korriban, exit the ship with Carth and Juhani, and realize that the PREVIOUS Xor will STILL be standing there with his two friends.

saves to help K1 Community Patch team - Issue 397.zip

@DarthParametric
Copy link
Contributor

DarthParametric commented Dec 5, 2020

Modifying Xor's UserDefine script to send messages to the PC on various events (including heartbeat) elicits no response in the 135 save, which is odd. He seems to be completely broken.

Edit: It seems like we may have determined the root cause. This should be easily fixable, although it won't address the broken/non-responsive Xors in existing games.

@DarthParametric
Copy link
Contributor

DarthParametric commented Dec 5, 2020

Proposed fixes:

Edit k_kas_xorattack (spawn-in trigger OnEnter) to gate it to the PC being the entering object. Additionally, add a delay between the initial spawn-in of Xor and thugs before triggering the cutscene. Possibly the lack of a delay causes the issue in certain cases because the NPCs don't exist by the time the DLG tries to reference them. The delay will necessitate a fade-out to mask the spawning, but there may need to be a check for Juhani being in the party. Most of the DLG nodes have a built-in fade-in, but there is also a bark bubble for when Juhani isn't present which would require a scripted fade-in before initiating the DLG. Alternatively, it could just be changed to only spawn them when Juhani is present, which probably makes more sense.

Edit k_kas_xor_user, Xor's UserDefine script, to gate the OnPerception event to the PC being visible and also have the invisible placeable restart the conversation. The vanilla version has Xor attempt to initiate the conversation himself, but his UTC has no DLG attached. This is likely the cause of the issue with him becoming unresponsive after being defeated, presumably when he is defeated first before the thugs. Defeating him last should work since that route has the placeable trigger the DLG correctly.

These scripts are per-module rather than global, but a cursory examination suggests they are all the same.

k_kas_xorattack:
#include "k_inc_utility"

void SpawnXor() {
    
    location lXor = GetLocation(GetObjectByTag("kas_xor1_spawn", 0));
    location lThugA = GetLocation(GetObjectByTag("kas_xor2_spawn", 0));
    location lThugB = GetLocation(GetObjectByTag("kas_xor3_spawn", 0));
    
    CreateObject(OBJECT_TYPE_CREATURE, "kas_xor1", lXor);
    CreateObject(OBJECT_TYPE_CREATURE, "kas_xor2", lThugA);
    CreateObject(OBJECT_TYPE_CREATURE, "kas_xor3", lThugB);
}

void main() {
    
    object oTalker = GetObjectByTag("invis_xor_conv", 0);

    int nGlobal = GetGlobalNumber("K_XOR_AMBUSH");
    
    if (nGlobal == 1 && UT_GetTalkedToBooleanFlag(OBJECT_SELF) == FALSE)
            {
                UT_SetTalkedToBooleanFlag(OBJECT_SELF, TRUE);
                
                NoClicksFor(2.0);
                
                SetGlobalFadeOut(0.0, 1.0);
                
                if (!IsNPCPartyMember(NPC_JUHANI))
                    {
                        SetGlobalFadeIn(1.3, 0.7);
                    }
                
                DelayCommand(1.1, SpawnXor());
                
                DelayCommand(2.1, AssignCommand(oTalker, ActionStartConversation(OBJECT_SELF, "", FALSE, CONVERSATION_TYPE_CINEMATIC, FALSE)));
            }
}
k_kas_xor_user:
#include "k_inc_utility"

void PartyOrg() {
    SetPartyLeader(NPC_PLAYER);
}

void main() {
    
    int nUser = GetUserDefinedEventNumber();

    if(nUser == 1001) //HEARTBEAT
        {

        }
    else if(nUser == 1002) // PERCEIVE
        {
            object oPC = GetFirstPC();
            int nGlobal = GetGlobalNumber("K_XOR_AMBUSH");
            
            if (GetLastPerceptionSeen())
                {
                    if (GetLastPerceived() == oPC)
                        {
                            if (nGlobal == 1 && !GetIsInCombat() && !GetIsInCombat(oPC))
                                {
                                    ClearAllActions();
                                    NoClicksFor(1.2);
                                    DelayCommand(0.9, PartyOrg());
                                    DelayCommand(1.0, AssignCommand(GetObjectByTag("invis_xor_conv", 0), ActionStartConversation(OBJECT_SELF, "", FALSE, CONVERSATION_TYPE_CINEMATIC, FALSE)));
                                }
                        }
                }
        }
    else if(nUser == 1003) // END OF COMBAT
        {

        }
    else if(nUser == 1004) // ON DIALOGUE
        {

        }
    else if(nUser == 1005) // ATTACKED
        {

        }
    else if(nUser == 1006) // DAMAGED
        {
            object oThugA = GetObjectByTag("kas_xor2", 0);
            object oThugB = GetObjectByTag("kas_xor3", 0);
            
            if (GetCurrentHitPoints(OBJECT_SELF) <= 20 && !GetIsObjectValid(oThugA) && !GetIsObjectValid(oThugB))
                {
                    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, "", FALSE, CONVERSATION_TYPE_CINEMATIC, FALSE)));
                    AdjustReputation(GetFirstPC(), OBJECT_SELF, 100);
                }
                else
                    {
                        if (GetCurrentHitPoints(OBJECT_SELF) <= 20)
                            {
                                UT_SetTalkedToBooleanFlag(OBJECT_SELF, TRUE);
                                SetLocalBoolean(OBJECT_SELF, 62, TRUE);
                                //GN_SetSpawnInCondition(SW_FLAG_AI_OFF, TRUE);
                                ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_NEUTRAL);
                                ClearAllActions();
                                DelayCommand(0.4, SurrenderToEnemies());
                                DelayCommand(0.8, PlayAnimation(ANIMATION_LOOPING_LISTEN_INJURED, 1.0, -1.0));
                            }
                    }
        }
    else if(nUser == 1007) // DEATH
        {

        }
    else if(nUser == 1008) // DISTURBED
        {

        }
    else if(nUser == 1009) // BLOCKED
        {

        }
    else if(nUser == 1010) // SPELL CAST AT
        {

        }
}

@DarthParametric DarthParametric added Requires Implementation The solution for this issue needs to be implemented and added to the patch Requires Testing Testing is required before a fix can be developed and/or approved labels Dec 6, 2020
@DarthParametric DarthParametric removed the Needs Info Further information is requested label Dec 20, 2020
@DarthParametric DarthParametric added this to the Targeting v1.9 milestone Oct 20, 2021
@DarthParametric DarthParametric added Module: Kashyyyk Issue occurs primarily on Kashyyyk Module: Korriban Issue occurs primarily on Korriban Module: Manaan Issue occurs primarily on Manaan Module: Tatooine Issue occurs primarily on Tatooine Type: Scripting This issue is related specifically to a scripting bug/error and removed Requires Testing Testing is required before a fix can be developed and/or approved Requires Implementation The solution for this issue needs to be implemented and added to the patch labels Dec 5, 2021
@DarthParametric
Copy link
Contributor

Xor's OUD needs a minor tweak to reset his faction rep properly when he is the last man standing.

@DarthParametric
Copy link
Contributor

DarthParametric commented Dec 18, 2023

1.10.0 beta test 2 observations:

  • The change to Xor's OnDeath event, triggering a Juhani conversation, doesn't always work as intended. Since it fires her standard DLG, it will use the first available branch, not necessarily the one related to Xor's death. Either needs to be removed or switched to a custom DLG with just the two Xor-related branches. Edit: Removed for now. Can be added back once there's time to implement and test a proper setup with a custom DLG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Module: Kashyyyk Issue occurs primarily on Kashyyyk Module: Korriban Issue occurs primarily on Korriban Module: Manaan Issue occurs primarily on Manaan Module: Tatooine Issue occurs primarily on Tatooine Type: Scripting This issue is related specifically to a scripting bug/error
Projects
None yet
Development

No branches or pull requests

3 participants