Tes3Mod:Dialogue Avoiding Greeting Conflicts

'''DISCLAIMER: the switched order of entries that the following discussion refers to is only relevant when the plugin loaded last  either deliberately modifies the game's original lines, or keeps the original lines in a modified state (in other words when the plugin is "dirty"/"unclean")'''

Dialogue is linked by this Hidden "Info ID" numbers:

If you look at a Dialogue Info/Response in TESAME, you see three entries:

INAM = the ID of this Dialogue Line 
PNAM = the ID of the previous Line 
NNAM = the ID of the next Line.

As long as the dialogue line has a PNAM and NNAM entry, the game looks for those next and previous lines in the current dialogue chain and places the new line somewhere between them. This works fine even if two plugins make a new line of dialogue at the same place. The two new lines will be placed between the old ones without any troubles.

Even when one of the plugins/Masters has a dialogue line with only a NNAM entry, there is no problem, the game puts this line on the very top of the Dialogue-Chain.

What happens when two plugins/masters try to come on top, is best described by an example:

Original lines:

---(top) 
ABC 
DEF 
XYZ

Plugin 1: (newer file date)

---(top)
1:A 
1:B 
1:C 
ABC 
DEF 
XYZ

Plugin 2: (older file date)

---(top) 
2:A 
2:B 
2:C 
ABC 
DEF 
XYZ

Resulting Dialogue chain in Game:

---(top) 
2:A 
2:B 
1:A 
1:B 
1:C 
ABC 
2:C 
DEF 
XYZ

The game exchanges the lowest Line of Plugin2 (the older one), with the next original line, And places the other lines on top of the dialogue chain. So there might be problems, if Plugin2 depends upon the "2:C"-line coming before "ABC".

Even worse when both plugins add bottom-lines:

Original lines: 
ABC 
DEF 
XYZ 
---(bottom)

Plugin 1: (newer file date)

ABC 
DEF 
XYZ 
1:A 
1:B 
1:C 
---(bottom)

Plugin 2: (older file date)

ABC 
DEF 
XYZ 
2:A 
2:B 
2:C 
---(bottom)

Resulting Dialogue chain in Game:

ABC 
DEF 
2:C 
XYZ 
2:A 
2:B 
1:A 
1:B 
1:C 
---(bottom)

Again the now undefined "lowest" line of Plugin2 is exchanged with the nearest original line to restore a working dialogue-chain, but now the dialogue sequence of plugin 2 is corrupted.

In the beginning we thought it to be more "clean" if we store only one original dialogue line in our plugins, but this proved to be a mistake. Tribunal did the same as we, and corrupted most of the Dialogue-intensive plugins.

Bloodmoon hasn`t that many new top/bottom lines, and most of us have learned our lesson, so there were almost no conflicts between Bloodmoon and older plugins.

Another common mistake is using the "copy" command to make a new dialogue line, and then continuing to change/make copies of the lower line (the original one, with the original Info ID)

---(top) 
ABC (the copy of the ABC line with a new ID, but the old text) 
2:A 
2:B 
2:C (id of original ABC, but text was changed) 
DEF 
XYZ

For a text-oriented human it looks like a clean plugin, but for the game, that only cares about the ID-Numbers, it`s just another plugin that tries to put its own line on the top of the linked-list...

If you followed me till now, you can figure out what happens when you load this plugin together with another one with top-dialogue:

---(top) 
ABC (the New ABC line) 
2:A 
1:A 
1:B 
1:C 
2:C (Original ABC-Line) 
2:B 
DEF 
XYZ

The dialogue sequence of plugin2 is destroyed, because the original top-line and the next plugin-added line are exchanged, but this time you ( the author of plugin 2) have a hard time to find the bug, because you first need to find out that you changed the original line instead of your new one.

The best advice I can give, is: Always place your new dialogue-lines in the middle of the topic. never use the top or bottom, and avoid the second line, because you easily can confuse the original top-line and the copy. Confusing is no problem as long as your new lines aren`t at the top or bottom of the linked list...

----

Emma:
Say that I have made a mod based on Tribunal, and have only put one "original" dialog line on top of my dialog entries. To make it worse, I could even be uncertain if I have managed to copy one of my dialog lines and put it above my other dialog entries.

So, in order to fix this, I do as follows:

#Move a couple of the original Tribunal dialog entries upwards, using the   arrows, so that my own dialog instead starts on the, say, fourth dialog line.
#Make a new dialog line at the very top of my own dialog, where I re-write my top dialog line (then delete my previous top dialog line)
#Clean away the * from the toplines of the Tribunal dialog entries.

If I instead should have placed my dialog at the very bottom, I would instead move a couple of original dialog entries downwards. I would then, just as in the previous case, re-write my top-dialog line (as TESCS reads from to to bottom), and clean away the * at the very bottom.

Now, as far as I can see, the mod "should" not cause any problems. Am I right?

----

JOG:
Addition:

Above I wrote that it doesn't matter when you change the text of the original Dialogue-ID as long as you stay away from top/bottom, but this isn't true. As soon as a plugin with a later file-date also contains this ID (no matter if the second plugin has the original text, or changes the original-ID itself) Your dialogue line will be completely removed from the game...

So as a rule: Hands of the top and bottom lines, and when you use "copy" to create new lines always edit the upper line...

----

Emma:
Aha!

As far as I can remember the Info-ID was connected to the text in the dialog line and would change if the text in the dialog line was altered.

I was about to release both first version of Witchgirl Adventure and an early version of Girlfriend Breton mod. In both cases, I had put the greetings in section 5. Now, one of the greetings started the same way in both mods, and was the very same for several words.
When I tried to run both mods at the same time, the greeting in the older one never showed up - it was completely overwritten.
Now, if I remember this correctly (it was almost a year ago), I found a solution that worked in this case:When I somewhat changed the text in the older greeting, the "Info-ID"-number also changed, so, as far as I could understand, the "Info-ID" should be related to the exact letters in the dialog-entry.

Now, this problem of course happened mostly because I was the author of both plugins. Probably, no-one else would have started a greeting in exactly the same way as I (as people think in different directions and use different words). So, if my conclusions are OK, a dialog line would only be overwritten by a newer mod if a dialog line in the newer mod starts with exactly the same words.

Now, I definitely don't claim that my conclusions are right (especially as this happened really long ago) but I would love to hear someone elses (JOG!! ) opinion on this.

In this case, with Girlfriend and Witchgirl, I had initially also used a few topics in BOTH mods. This turned out to cause a similar problem: the topic initially wouldn't show up at all in the older mod. But, when I added the topic also by an "AddTopic" command in the dialog result-box, it would show up even if overwritten. However, in the older mod, the topic wouldn't be highlighted in the dialog. So, I of course rewrote all the topic names. But I learnt how vital it is to always use "AddTopic" in the resultbox.

Oh, and if I'm not mistaken, you can also see the Info-ID in the Details list for the mod in TESCS.

----

JOG:
Sorry, you're wrong

The Info-Id always stays the same, it isn't dependent on the text contents, or a changed Entry would mess up the dialogue-chain for all other plugins, and a copy of an entry would have the same number.

Example:

Morrowind.esm only, Greeting1, top

Code:
----

[You have failed your Oath of Silence] 204811946427354207051 
Who's there? 12152275822093636854 
All is silence.... 1588813549227325295

----

When I use "copy" on "Who's there" I get a copy of this line with a new random ID-number

Code:
----

[You have failed your Oath of Silence] 204811946427354207051 
Who's there? 243027979162761791 
Who's there? 12152275822093636854 
All is silence. [...] 1588813549227325295

----

Changing the text has no effect on the number, but if you make the mistake and change the text from the line with info-ID 12152275822093636854, which is the original number, you're in danger that another mod that contains a line with this number will overwrite your line.

----

Emma:
Quote:
----

Sorry, you're wrong

----

Hehe, no need to be sorry about that, I'm often wrong .

Still, what I said about two (almost) identical greetings in two different plugins is a fact - the older greeting will be overwritten by the newer. Same goes for identical topics.

Thank you for the explanation about copying dialog lines in your last posting. It sorted out a number of things that I was uncertain about. For instance, this should mean that there's no harm in copying dialog lines that all belong in my own mod, at least not as long as I make sure that the "original" of my dialog lines is above the copied dialog lines.

I would like to ask one more question, that I believe could be of general importance:

Say that I have made out my mod as below.

[You have failed your Oath of Silence] 204811946427354207051 
THIS IS MY DIALOG LINE!!! 243027979162761791 
THIS IS MY DIALOG LINE!!! 243487333791627617 
Who's there? 12152275822093636854 
All is silence. [...] 1588813549227325295

Now, I want to change it in order avoid problems for other users, who might be using several dialog intense mods.

Would it be sufficient just to move the line "Who's there?" and "All is silence" upwards (so that they will once again be number 2 and 3 in the dialog chain). OR should I also click "new" and re-write my first dialog entry so that it will have a new ID-number (as it is now in the 4th row in the chain instead of the 2nd)?

----

JOG:
The numbers are completely random and just there to determine how the dialogue lines link together. So just move the original lines up, and all is fine. As long as you don't change the original lines that have the same Info-IDs on every modder's computer...

Sure, there is a tiny chance that you make a new line, get a random number, and another moder gets the same random number as yourself, but when this happens, it's most likely that the moon will drop down and smash the other ones house and computer before he can release his mod

----

#In "Greetings". If I wished to add a new greeting, is it better to avoid certain "groups" like Greeting 0, Greeting 1...and place the new greeting in 8 or 9? This would ensure not messing with ;ALWAYS LEAVE THIS TOPIC AT THE VERY TOP OF GREETING 1 and things like that-Yes-No??
#This also include "Topics" , or is this just good practice for "Greetings" editing?
#In a Dialogue tutorial, it uses extensive "copy" and edit. Is it better practice to just do "New"?
#And last question for us dense people. Placing a "new" Greeting in the middle to be safe means: Scroll to the middle of all the dialogue in a group and place your new dialogue there?
#Will TES Tool fix any of these problems, or make it worse when dialog merging?

Thanks again.

----

JOG:
#Greetings 8/9 are a problem 'cause they don't apply very often. Greeting 1 and 5 are safe and most common, just heed the rule that you put your new lines between two old ones, and when making copies alway edit the upper one.
#Yes, it also applies to topics, you just have a lot more conflict potential with Greetings 'cause every mod uses them.
#No, I also always use Copy+Edit, just make sure you edit the upper line.
#Yes. It's okay to have your new line at the 3rd line from top or bottom, just stay away from the top and bottom lines, and be very careful when you edit the 2nd lines.
#No idea. But it's very unlikely that a tool can solve existing conflicts. (to do so you need to change the IDs) As long as one mod's dialogue is 100% clean, there is no problem with merging (the game does the same when you load the mods together) but two unclean dialogues will cause the problems I described above.

Again:

One mod with "unclean" dialogue will cause absolutely no problems.

Two mods, one "clean" one "unclean" also have no conflicts, as long as the "clean" mod is older than the "unclean" one.

When an "unclean" mod is older than a "clean" one, the clean mod might remove dialogue from the unclean one.

Real problems begin when you have at least two "unclean" mods. Then the dialogue-sequence of the older one will be changed.

----

Avoiding Conflicts With Existing Characters

If you can avoid adding dialog to existing characters, this should be the route chosen whenever possible, as it reduces the scope for conflicts. There may be some situations in which you need an existing character (say, Caius Cosades) to say a line. This is quite possible: create a new line of dialog, and simply filter it to Caius Cosades. However, you should add in as many checks and filters as possible to ensure that you are 'hijacking' Caius' dialog for the shortest possible time. For example, you may have a particular greeting for him that results in a journal entry. Filter your new line so that it will only be used after the previous journal and before the next journal, and never spoken again. This will minimize the possibility of your mod interfering with quests from the game or another mod. Thoroughly test your mod to check that the existing character's other lines (from the game) appear as expected, and also test your mod with any other popular mods that use the same character.

Filter your Greetings so they will only be used by NPCs connected with your mod and ignored by everybody else. One obvious way is to use the IDs for your NPCs as one of the Speaker Conditions. You can also use new factions (created by your mod), new classes, new races, new cells, etc. as Speaker Conditions to restrict new or changed Greetings to just NPCs connected with your mod.