Jump to content
  • 0

xEdit: How does "and/or" in condition tabs apply?


darkrain261

Question

Hi guys, I'm adding some conditions to a spell in xEdit and stumble upon this question. Let's say I want a spell that does damage to player unless they are wearing an armor + helmet (which mean that wearing only helmet or only armor still does damage to player), I come up with these 2 ways, can somebody help me determine which one is right? Thank you:

A) image.thumb.png.c2dd755302e0ed25da2a8efb6da1a651.png

 

B)image.thumb.png.bb7171c04d2cbd364a5d96abc2e51b97.png 

 

Edit: grammar and explaination.

Edited by darkrain261
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
28 minutes ago, darkrain261 said:

Thank you, these logical writing is confusing me.

Yes, they are quite confusing.

Start by writing the conditions where the player is immune:

(Wearing Helmet OR Wearing Hat) AND (Wearing Cuirass OR Wearing Robes)

Then negate them to get the conditions where the magic effect applies:

(NOT Wearing Helmet AND NOT Wearing Hat) OR (NOT Wearing Cuirass AND NOT Wearing Robes)

The above can't be transcribed directly into Skyrim conditions, because OR has precedence over AND, it would be evaluated as:

NOT Wearing Helmet AND (NOT Wearing Hat OR NOT Wearing Cuirass) AND NOT Wearing Robes

Which is incorrect.

You need to rewrite the conditions so that they evaluate OR with the correct precedence:

(NOT Wearing Helmet OR NOT Wearing Cuirass) AND
(NOT Wearing Hat OR NOT Wearing Cuirass) AND
(NOT Wearing Helmet OR NOT Wearing Robes) AND
(NOT Wearing Hat OR NOT Wearing Robes)

See OR and Complex Conditions on the CK wiki for more info.

Edited by Mousetick
  • Thanks 1
Link to comment
Share on other sites

  • 0

Another question is that does the and/or apply to current line or the below line. For example B:

Subject.WornHasKeyword(Clothing Head) = 0 AND

Subject.WornHasKeyword(Clothing Body) = 0 OR

Does this mean: 1) Subject is wearing clothing head and subject is wearing clothing body or ....

or

2) and Subject is wearing clothing head or subject is wearing clothing body

Edited by darkrain261
Link to comment
Share on other sites

  • 0

B) is correct though it requires the player to wear both head and body armor, or wear both head and body clothing. If the player is wearing head armor and body clothing for instance, the effect will apply. If this is what you want, then great, if not, you need to rewrite the conditions.

The AND/OR apply to the next condition. So it doesn't matter which you put on the last condition.

  • Thanks 1
Link to comment
Share on other sites

  • 0
4 minutes ago, Mousetick said:

B) is correct though it requires the player to wear both head and body armor, or wear both head and body clothing. If the player is wearing head armor and body clothing for instance, the effect will apply. If this is what you want, then great, if not, you need to rewrite the conditions.

The AND/OR apply to the next condition. So it doesn't matter which you put on the last condition.

Thank you, these logical writing is confusing me. I'm not familiar with this so I think will add more conditions to cover those extra situations: armor head + clothing body and clothing head + armor body.

Link to comment
Share on other sites

  • 0
1 hour ago, Mousetick said:

Yes, they are quite confusing.

Start by writing the conditions where the player is immune:

(Wearing Helmet OR Wearing Hat) AND (Wearing Cuirass OR Wearing Robes)

Then negate them to get the conditions where the magic effect applies:

(NOT Wearing Helmet AND NOT Wearing Hat) OR (NOT Wearing Cuirass AND NOT Wearing Robes)

The above can't be transcribed directly into Skyrim conditions, because OR has precedence over AND, it would be evaluated as:

NOT Wearing Helmet AND (NOT Wearing Hat OR NOT Wearing Cuirass) AND NOT Wearing Robes

Which is incorrect.

You need to rewrite the conditions so that they evaluate OR with the correct precedence:

(NOT Wearing Helmet OR NOT Wearing Cuirass) AND
(NOT Wearing Hat OR NOT Wearing Cuirass) AND
(NOT Wearing Helmet OR NOT Wearing Robes) AND
(NOT Wearing Hat OR NOT Wearing Robes)

See OR and Complex Conditions on the CK wiki for more info.

Wow thank you so much. Now I understand the reason some mods have duplicate magic effect with just 1 or 2 different conditions is to avoid these complicated condition rules in one go.

Link to comment
Share on other sites

  • 0

 

2 hours ago, Mousetick said:

You need to rewrite the conditions so that they evaluate OR with the correct precedence:

(NOT Wearing Helmet OR NOT Wearing Cuirass) AND
(NOT Wearing Hat OR NOT Wearing Cuirass) AND
(NOT Wearing Helmet OR NOT Wearing Robes) AND
(NOT Wearing Hat OR NOT Wearing Robes)

Ha ha yes, follow your suggestion the effects applied as I wanted. I really appreciate your help. Cheers!

Link to comment
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
×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines, Privacy Policy, and Terms of Use.