Jump to content

Logic question about combining condition functions (in G.E.C.K.)


primvirlaux

Recommended Posts

Hey.

 

Please forgive me the following newbie question.... I looked at the G.E.C.K. Wiki, as well as the pinned topics in this forum, but I couldn't find an answer to my question, so in the end I decided to post here. If my question is so stupid that it's just a case of RTFM, then please feel free to kick me back to the Wiki :P

 

Okay, so here's my problem. I am completely new to modding (though not to programming), and I am trying to create my own teeny-weeny mod, with G.E.C.K., to nerf the Chinese Stealth Armor a bit (which I like a lot, but which is also clearly overpowered). I found a mod that *almost* does what I want, but not 100%, so I'm trying to adjust the function of this mod to my liking.

 

The Chinese Stealth Armor activates a stealth field of value 5 under certain conditions. In vanilla, that condition is simply if the player crouches. In the mod I found, the condition is "if player crouches AND is NOT in combat".

 

Now here's my question: I want to add a more complex set of conditions. The way to do this in G.E.C.K., I understand, is to go to 'Game Effects', then 'Object Effect', then select item DLC02EnchStealthArmor in my case, then select in the 'effects' window of this item the effect 'stealth field'. Now I have, on the right, a list of conditions that have to be fulfilled in order for the effect to be activated. Correct so far?

 

These conditions can be combined with AND or OR, and I can choose under 'comparison' the values == or !=, which means I can use negation. So far so good. But it seems that I cannot "group" conditions together the way I want to, something I would normally do (in Java or C) with (round) brackets.

 

Take the following as an example:

 

I want effect X to activate if and only if (A AND B) OR (C AND NOT D), where A, B, C, D are conditions like "isSneaking" or "IsInCombat".

 

Correct me if I'm wrong, but without having brackets at my disposal, or knowing that AND and OR take different precedence in evaluation (if I can write my statement in conjunctive normal form, for example), I can't see how to implement this statement or a logical equivalent of it. Any suggestions?

Link to comment
Share on other sites

I've always wondered about that, but didn't investigate as I've never used that complex conditions outside of scripts.

 

But a search (through Google, not the horrible wiki search engine) led me to this page. Perhaps it'll be of use.

 

Scroll down a bit and you'll find:

 

The OR checkbox is used to determine how a Condition Item is evaluated with the ones that follow it. Consecutive ORs are treated like a single block when evaluating and have order precedence over AND. For example, the Condition Items (A AND B OR C AND D) are evaluated as (A AND (B OR C) AND D) and not ((A AND B) OR (C AND D)).

 

By applying the distributive and other properties complex expressions can be converted into a list of Condition Items that will evaluate as intended. For example, the expression ((A AND B) OR (C AND D)) can be represented as the list of Condition Items (A OR C AND B OR C AND A OR D AND B OR D). As described above, this evaluates as ((A OR C) AND (B OR C) AND (A OR D) AND (B OR D)) which is equivalent to the initial expression.

Edited by Ladez
Link to comment
Share on other sites

I've always wondered about that, but didn't investigate as I've never used that complex conditions outside of scripts.

 

But a search (through Google, not the horrible wiki search engine) led me to this page. Perhaps it'll be of use.

 

The OR checkbox is used to determine how a Condition Item is evaluated with the ones that follow it. Consecutive ORs are treated like a single block when evaluating and have order precedence over AND. For example, the Condition Items (A AND B OR C AND D) are evaluated as (A AND (B OR C) AND D) and not ((A AND B) OR (C AND D)).

 

By applying the distributive and other properties complex expressions can be converted into a list of Condition Items that will evaluate as intended. For example, the expression ((A AND B) OR (C AND D)) can be represented as the list of Condition Items (A OR C AND B OR C AND A OR D AND B OR D). As described above, this evaluates as ((A OR C) AND (B OR C) AND (A OR D) AND (B OR D)) which is equivalent to the initial expression.

 

Perfect. So formulas are in conjunctive normal form it seems. Bit of a pain in the ass to find the logical equivalent, but fully expressive in the end. Thanks a lot for the help!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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