Welcome
Ladies and Gents:

These forums are now closed and registration disabled.

Please join us at our new forum on Proboards. Our hope is that these new forums are more stable, provide more and better features, and allow continuation of the project forums in a safer, more secure, long term environment.

me3explorer.proboards.com

--The ME3Explorer Team

Tutorial: Adding and Editing Conditionals

Made by modders for modders. Step-by-step instructions on how to achieve specific modding goals with ME3Explorer. We *strongly* encourage you to post new tutorials on the wiki.

Tutorial: Adding and Editing Conditionals

Postby giftfish » 25 Feb 2014, 19:32

TUTORIAL: ADDING/ EDITING CONDITIONALS


I actually had thought this tutorial already existed, but it seems it doesn't. This forum thread provides some guidance, but doesn't lay everything out as a tutorial, per se. Nonetheless, it's still a good thread to take a look at.

Most folks around here already know what conditionals are, but for newcomers, "conditionals" are what BioWare uses to control your story experience in Mass Effect. When your playthrough meets certain conditions, it causes events to trigger in-game. Whether it's quest availability, dialogues, receiving an email, locking in a romance, or something else, many, many aspects of the game are controlled by these conditionals. Therefore, if you want to alter plot events controlled by conditionals (or add new plot events) you need to be able to edit their parameters and/or add new ones.

All conditionals are stored in the file "Conditionals.cnd". Vanilla conditionals can be altered, and new conditionals created, by editing this file with the Conditionals Developer Tool in ME3Explorer. This tutorial will technically walk the user through how to add a new conditional, and thereby also teaches how to edit an existing conditional.

1. Backup.
Back up your vanilla Conditionals.cnd.

2. Open.
Open up the Conditionals Tool in ME3Explorer and load the Conditionals.cnd by going to File > Open. Navigate into your CookedPCC to locate and select the file. Click "Open".

3. Orient.
It will take a moment to load. As you scroll to the bottom, you can see that the vanilla file begins with entry 1 and ends with entry 2754. These entry numbers are called "IDs."

Image

Tip: There are not 2754 conditionals; some are "missing." For example, you can see that entry 2749 doesn't exist.

Next, click on entry 2752. This will allow you see the conditional's expression (and hex) in the right-hand window. The expression should bring back some memories of Algebra class. ;) What you see here is the simplest conditional possible, it's a single plot integer (you'll see conditionals that are single plot bools, as well). If you click on entry 2754 you'll see a more complex expression. The expression is what defines the parameters of the conditional. We'll be editing this a few steps down.

Tip: Plot "integers" are numerical values (integers, specifically) that correspond to a plot event with a progressive state. For example, relationship integers signify the progression of the relationship (i.e. how often Shepard talks to that crewmate). Plot bools are true/false "flags". They signify discrete events in a playthrough, such as "Udina was shot by Kaidan" or "Kahje saved during Citadel: Hanar Diplomat."

4. Clone.
Since we are adding a new conditional, the first thing we need to do is select an entry to clone. The entry you choose really doesn't matter as you'll be deleting the current expression anyway. I'm going to use entry 2752.

Click on the entry to select it. Go to Edit > Clone.

The window will refresh. If you scroll to the bottom, you will see a new entry: 2755. If you select it, you will see the expression is identical to the one for 2752 (or whichever one you selected).

Image

5. Edit ID.
Since ME3 also has DLC which can add its own conditionals, we need to make sure that any new conditionals we add aren't sequential with the final vanilla conditional. This is why Inquiring started the numbering for ThaneMOD conditionals at 4200, rather than 2755.

To edit the ID, first select the new conditional. Then go to Edit > Edit ID.

In the window that pops up, replace the current ID number with the new one. I'm using 4200. Click "Ok".

Image

The window will refresh again. If you scroll to the bottom, you'll see that ID 2755 is now ID 4200.

Image

6. Create Expression.
Now we've reached the more challenging part. :) Creating the expression is not difficult, but depending on what you are trying to implement, it can get very long and complex. Expressions can also be a bit tricky to format properly, and they must be exact to work. For example, look at the expression for ThaneMOD conditional 4219:

Image

Yikes, eh?

The one we'll be putting together isn't as complicated. Here's the expression we'll be using for conditional 4200:

((plot.bools[201] == Bool false) && (plot.bools[3426] == Bool true) && (plot.bools[5206] == Bool false) && (plot.ints[10213] != 0) && (plot.ints[26000] == 0))

If you haven't looked at conditional expressions before, you are probably wondering what this means. Here's what we have:

(plot.bools[201] == Bool false) -- Thane's death in ME2
Thane was not killed

(plot.bools[3426] == Bool true) -- Thane's loyalty status from ME2
Thane is loyal

(plot.bools[5206] == Bool false) -- Thane's romance status from ME2
Thane was not romanced

(plot.ints[10213] != 0) -- Priority: Palaven quest status
Priority: Palaven has been started

(plot.ints[26000] == 0) -- ThaneMOD Friend Huerta Note status
Note has not been read

To summarize, this conditional checks to make sure Thane is alive in the ME3 PT, that he is loyal, that he was not romanced in ME2, and that the player has began Priority: Palaven. When all of these things are true (and assuming there are some other modded game files present), a modified-version of the Huerta note is sent from Thane to friend-Shepard. The final expression parameter ensures that the note is only sent a single time -- once the player reads the note, then it won't be sent again.

How do you know what the different bools and ints mean and how do you know which ones to use? That's where logic and research comes in. You have to think carefully about what you are trying to do with the conditional. Be careful to not build in unnecessary parameters and overly complicate the expression. For example, I didn't need to check for Thane's recruitment in ME2 (plot bool 39), as if he is loyal, he must have been recruited (this is where that logic stuff comes in). Once you know what plot events you need to account for, you'll need to use some online resources to locate the correct integers and bools.

Here are some links that should help:


A word of warning: not all bools/ints are accounted for. Most aren't. So you might very well need to "hunt" for some yourself. You can do this a few different ways. Consulting the Gibbed dump can be helpful. Look in the Coalesced.bin to find the conditionals used for the various emails sent in-game (check this thread for help). We know when those arrive, so often you can deduce what different portions of the expression correspond to (this is how I figured out integer 10213 was Palaven). Finally, I know there is a modified version of Gibbed out there that will dump all bools/integers after a mission completion (or something of this sort), but I've been unable to locate it via a web search. If anyone has a link to it, let me know and I'll add it to the list links above.

There are various formatting conventions that must be followed for the expression to work properly:

  • Each individual portion of the expression must be enclosed in (parentheses).
  • The entire expression must be enclosed in (parentheses).
  • Bool/int numbers have to be enclosed in [brackets].
  • "==" means "is equal to." Yes, there must be two equal signs present. It's a computer language thing.
  • "Bool false/true" is obvious.
  • An int value of 0 means the progression has not started yet.
  • "&&" means "and". Yes, there must be two ampersands present. It's a computer language thing.
  • For science and math folks, "!= 0" means the same things as "≠" (not equal to). There must be a space between the equal sign and 0 for it to work properly.

If you look again at the complex expression depicted above you'll also see other symbols not used in conditional 4200:

  • "||" means "or".
  • The "or" operator is valuable in creating more complex expressions. For example, in this sample expression below, A and B must be true OR C and D must be false for the conditional to be met.
    (((A == true) && (B == true)) || ((C == false) && (D == false)))
  • Integers can also use ">" and "<" symbols in the expression (greater than and less than). These mean the same thing that they do in math.

To easily see a wide variety of conditional expressions, you can view the ThaneMOD Conditionals Pastebin.

7. Edit Expression.
Once you've created your expression, it's time to edit it into the entry you've cloned.

Click on your entry to select it. Go to Edit > Edit Expression.

This will open the Expression Editor, with the current expression in the top left window.

Image

Highlight the current expression and delete it. Then, type in or copy/paste your new expression, if you've already typed it out previously. I had one experience in the past where pasting it in wouldn't work. In this case, I just typed it in manually.

Once you've entered the entire thing, take a few moments to look it over. It's very, very easy to make mistakes. Any typos, missing brackets, extra or missing spaces and it won't work.

Image

When you are certain it is correct, go to Editor > Compile.

This will create a branching tree on the right and some hex code on the bottom. Don't worry about the hex, but look at the tree. Work from top to bottom and make sure what's present makes sense.

Image

Tip: If compiling throws an error, then your expression isn't formatted properly. Look through it again and find your mistake(s).

If the compiled expression looks correct, go up to Editor > Replace.

Be very deliberate when you do this, as there is no visual indication that anything has happened. Close the Expression Editor afterward (the black "x" in the upper right).

Note: If you attempt to select your new conditional in the main window at this point, ME3Explorer will throw an error. You must save (and possibly reopen) the file before you can view the new expression to be sure it applied correctly.

8. Save.
Go to File > Save to save your changes. You may save it to a new file, or save over the file currently loaded. You may add/edit multiple conditionals before saving the changes.

9. Double-check.
If you've saved over the current file, the window will refresh after a moment. Once it does you can scroll to the bottom and highlight your entry. You'll notice a couple things. One, the numbers that come after the ID no longer match the entry you cloned. Second, the expression that appears on the right should now be the one you created.

Image

If you saved your changes to a different file, you'll need to open that file in the Conditional Tool to view your new conditional.

10. Test in game.
The final step is to test your new conditional in game. First, ensure your edited Conditionals.cnd is in your ME3 CookedPCC. Then, update your PCConsoleTOC.bin. If you don't know how to do this, do a forum search; there are other threads that detail the procedure.

Then, you'll need to load a save that satisfies all the parameters of the conditional. If it works on the first try, you did great. If it doesn't work, then it's likely one of two things happened: you made a logic error in constructing the conditional or your save doesn't meet the parameters you specified. The Gibbed Save Editor is very useful in determining if it is the former or latter.

As we can see, our new conditional, 4200, worked just fine:

Image
Image
Image

To my knowledge, there is no limit to the amount of conditionals you can add. You just need to make sure you don't use an ID that is already present. As you can see below, ThaneMOD adds quite a few new conditionals, and the ones that number over 9000 are for MEHEM.

Image

Well, I think that's it! Please feel free to ask questions or make suggestions, or chime in if you see an error.

As a side note, a topic directly related to this is how to edit the conditional/bool for PMCheckStates in sequence maps. This isn't something I've done yet myself, but I know other folks around have. If someone is willing to make a tutorial for that, I'll put a link to it in this one.

In addition, here are the links to all other tutorials we've created while working on ThaneMOD. I'll try to remember to put this list at the bottom of every tutorial for easy reference. More will be coming in the future...slowly, lol. :)

Last edited by Anonymous on 06 Mar 2014, 20:50, edited 2 times in total.

giftfish has been thanked by:
User avatar
giftfish
Toolset Developer
 
Posts: 1247
Joined: 08 Jan 2016, 02:35
Has thanked: 129 time
Have thanks: 75 time

Re: Tutorial: Adding and Editing Conditionals

Postby JohnP » 25 Feb 2014, 20:15

Very nice. Your tutorials explain things very well and are also very well written and formatted.
JohnP
Modder
 
Posts: 159
Joined: 15 Jan 2013, 18:39
Has thanked: 55 time
Have thanks: 132 time

Re: Tutorial: Adding and Editing Conditionals

Postby WarrantyVoider » 25 Feb 2014, 20:16

(((A==true) && (B==true)) || ((C==false) && (D==false)))


I think you missed an & there, but nice tutorial, thanks alot

greetz WV
always backup your files!
mess with the best or die like the rest!
"I tried everything!" - "mkay, please list that..." ; please dont pm me for help, we have a help section
User avatar
WarrantyVoider
Emeritus
 
Posts: 2270
Joined: 22 Aug 2012, 11:33
Has thanked: 480 time
Have thanks: 626 time

Re: Tutorial: Adding and Editing Conditionals

Postby giftfish » 25 Feb 2014, 20:26

WarrantyVoider wrote:
(((A==true) && (B==true)) || ((C==false) && (D==false)))


I think you missed an & there, but nice tutorial, thanks alot

greetz WV


Crap. Fixing...

What, no comments about all my screenshots this time? :P

<3
User avatar
giftfish
Toolset Developer
 
Posts: 1247
Joined: 08 Jan 2016, 02:35
Has thanked: 129 time
Have thanks: 75 time

Re: Tutorial: Adding and Editing Conditionals

Postby giftfish » 25 Feb 2014, 20:30

JohnP wrote:Very nice. Your tutorials explain things very well and are also very well written and formatted.


Thank you, sir <3 I do try...and not only because I'm an anal-retentive organizational freakazoid.

Though...that is certainly part of the reason. Clearly.

>.>
User avatar
giftfish
Toolset Developer
 
Posts: 1247
Joined: 08 Jan 2016, 02:35
Has thanked: 129 time
Have thanks: 75 time


Return to Modders' Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

suspicion-preferred