Jump to content

Condition Confusion - ANDs and ORs are giving me grief.


Recommended Posts

Every once in a while I'll get confused about how ANDs and ORs are supposed to function for condition checking. Possibly my wires are more than a little crossed from recent personal events, so please bear with me.

Anyway, what I am trying to do is relatively simple: condition some dialogue lines for a custom companion. He's not in the default system, so he can follow when another of the vanilla companions is engaged. The problem is, he's a talkative fellow who doesn't like many people.

He has lines specifically for when certain vanilla companions and other custom ones are around, but then he also has some lines that should only play when the others are not present--which is fine, except the conditions are not firing correctly, so the dialogue is playing when it should not. Either I am going to have to duplicate his lines and condition them individually for each companion he has thoughts about, or find a way to make the conditions work.

-   -   -   -   -   -   -

I tried using all ORs to check whether the companions in question were in the same vicinity as the player, but the dialogue still played regardless of the companions' locations.

Next, I tried using GetInFaction CurrentCompanionFaction for the vanilla followers using ORs. For this attempt, there are some extra AND conditions based on other criteria such as the player's level mixed in, and from what I can tell so far, the dialogue is not playing AT ALL. Using ANDs and ORs together always seems to have mixed results in my Skyrim mods; they either play nice together or play dead, so I suppose this is to be expected--it doesn't make it any less vexing, though.

Lastly, I tried using the GetInFaction CurrentCompanionFaction with all ORs for the vanilla companions yet again (but with no ANDs mixed in this time), but this caused the dialogue to play when it wasn't supposed to.

I am utterly confuzzled about how to proceed and would appreciate some insight. image.png.d885ad655d70c3621dabc6f46b6c73bc.png

If I have to end up duplicating his lines multiple times just to be foolproof with the conditions, then I'll grit my teeth and do it, but I am still hoping there is another option.

 

Link to comment
Share on other sites

Not familiar with Papyrus and/or strings but if they are anything like the workshop build condition strings i have found that mixing them always leads to the string breaking. the only way i have consistently gotten them to work is by putting all the "or' strings first and the "and" strings last. It might be possible to feather in the "and" strings if the first string is an "or" but one thing i know for sure is if you end the string with an "or" it breaks it. Might not be the same because the workshop conditions are open ended and closes itself on the last 'and" string.

  • Thanks 1
Link to comment
Share on other sites

5 hours ago, worm82075 said:

Not familiar with Papyrus and/or strings but if they are anything like the workshop build condition strings i have found that mixing them always leads to the string breaking. the only way i have consistently gotten them to work is by putting all the "or' strings first and the "and" strings last. It might be possible to feather in the "and" strings if the first string is an "or" but one thing i know for sure is if you end the string with an "or" it breaks it. Might not be the same because the workshop conditions are open ended and closes itself on the last 'and" string.

I wondered if the order they were placed had a part in it! Thank you for the tip.

Let me make sure I am understanding this correctly: When you say Or strings first and And strings last, do you mean the Ors are lowest and the Ands are highest? (Like in SKKmods' image below?) Or should it be visa-versa? 👀

5 hours ago, SKKmods said:

Gotta group them  and its always 50/50 if I configure the correct line to switch between them:

conditions.jpg

Thank you for posting an image! Now I have something to compare! 🔎

I have the CK open, so I'm going to do a quick check on the dialogue that has both Or and Ands mixed in.

Hmm... Okay, my Ors are high instead of low, and I think one of the conditions would be better off as an Or instead of an And. I will make those changes, and then revise it to look more like your screenshot.

Okay, I now have 4 Ands on top and 4 Ors below them. The Ands are all related to keywords and leveling, and the Ors are focused on whether some of the vanilla companions are in the CurrentCompanionFaction. I will test this out the next the chance I get.

 

Thank you both so much. I'm beginning to feel optimistic. 😊

Link to comment
Share on other sites

It doesnt actualy matter if the AND block or OR block come first.

To help with game engine load (fail fast) I just put the broadest filter at the top which could be AND or OR.

Ideally the order would be exactly from broad to specific, but interleaving AND OR statements becomes super messy.

 

 

 

  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...
On 4/30/2024 at 4:35 AM, SKKmods said:

It doesnt actualy matter if the AND block or OR block come first.

To help with game engine load (fail fast) I just put the broadest filter at the top which could be AND or OR.

Ideally the order would be exactly from broad to specific, but interleaving AND OR statements becomes super messy.

 

Late update on this, but I wanted to be absolutely sure of the results before posting.

Anywho, try as I might, the ORs and ANDs are not playing nice together. For almost a month now, I THOUGHT the conditions were working as intended, but now I know differently. But it's weird. It's a half and half situation. And one similar to one in Skyrim's Creation Kit, at that.

-   -   -   -   -   -   -

So here's a sample of the conditions that should ALLOW certain dialogue responses to play if some of the vanilla companions ARE CURRENTLY following the player:


PL      GetValuePercent      Actor Value: 'Health'                >             0.50        AND
PL      GetLevel                       NONE                                       >=          55.00      AND
R        GetInFaction              CurrentCompanionFaction     ==         1.000       OR       (Danse)
R        GetInFaction              CurrentCompanionFaction     ==         1.000       OR       (Deacon)
R        GetInFaction              CurrentCompanionFaction     ==         1.000       OR       (Nick)


This one works fine. 👍

 

Now here's a sample of the conditions to ALLOW certain dialogue responses to play if some of the vanilla companions are NOT CURRENTLY following the player:

PL      GetValuePercent      Actor Value: 'Health'                >            0.50        AND
PL      GetLevel                       NONE                                      >=          55.00      AND
R        GetInFaction              CurrentCompanionFaction     ==         0.000      OR       (Danse)
R        GetInFaction              CurrentCompanionFaction     ==         0.000      OR       (Deacon)
R        GetInFaction              CurrentCompanionFaction     ==         0.000      OR       (Nick)

This one is a rebel and does not work in the slightest degree. It delights in ignoring the CurrentCompanionCondition when it is set to 0. INFURIATING. 😡

-   -   -   -   -   -   -
Now as to to why this reminds me of Skyrim's Creation Kit...

Skyrim's CK is fickle when it comes to certain faction condition checks. I found this out the hard way when I was working on a family-related mod. The faction in question is the PlayerMarriedFaction, which is given to NPCs who become the player's spouse.

So here's an example--let's say we have a specific response for Benor, for when he IS MARRIED to the player:

S      GetIsID                        Benor                                ==              1.000       AND
R      GetInFaction              PlayerMarriedFaction     ==              1.000       AND

The dialogue plays fine in game, and is triggered correctly. 👍

HOWEVER, when you add the

R      GetInFaction              PlayerMarriedFaction     ==              1.000       AND

to the condition check, you lose the ability to record dialogue, because no audio path can be found. If you already have the dialogue created and ready to go (meaning that it is actually in the proper folder and everything), the CK simply pretends that it does not exist. But in game, it works perfectly fine. Tricky git. 😡

Here's the funny part--let's say we have a specific a response for Benor for when he IS NOT MARRIED to the player:

S      GetIsID                        Benor                                ==              1.000        AND
R      GetInFaction              PlayerMarriedFaction     ==              0.000        AND

The CK has no problem whatsoever with the above; it knows its audio path by heart. The moment you change that 0 to a 1, however... 💀

-   -   -   -   -   -   -

I am not sure how to proceed now. Is there some other way to check if a vanilla companion is currently following the player apart from checking the CurrentCompanionFaction?

Link to comment
Share on other sites

9 hours ago, Lollia said:

Now here's a sample of the conditions to ALLOW certain dialogue responses to play if some of the vanilla companions are NOT CURRENTLY following the player:

PL      GetValuePercent      Actor Value: 'Health'                >            0.50        AND
PL      GetLevel                       NONE                                      >=          55.00      AND
R        GetInFaction              CurrentCompanionFaction     ==         0.000      OR       (Danse)
R        GetInFaction              CurrentCompanionFaction     ==         0.000      OR       (Deacon)
R        GetInFaction              CurrentCompanionFaction     ==         0.000      OR       (Nick)

This one is a rebel and does not work in the slightest degree. It delights in ignoring the CurrentCompanionCondition when it is set to 0. INFURIATING. 😡

With this condition, no matter what companion you have, or if you have any, it's always to be true as soon as you meet the health and the level.

For example, if you have Danse as companion, Deacon and Nick would still return 0. Since you're using OR it will always be true, because there is going to be at least 2 of them that are not your companion.

The solution would be to use AND instead. Danse is not your current companion AND Deacon is not your current companion AND Nick is not your current companion.

  • Confused 1
Link to comment
Share on other sites

9 hours ago, Lollia said:

Is there some other way to check if a vanilla companion is currently following the player apart from checking the CurrentCompanionFaction?

If you'd like to avoid factions:

Subject        GetPlayerTeammate              ==         0.000       AND       (Danse)

Subject        GetPlayerTeammate              ==         0.000       AND       (Deacon)

Subject        GetPlayerTeammate              ==         0.000       AND       (Nick)

  • Confused 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...