Jump to content

finding a dialogue state added by another mod


Recommended Posts

Posted (edited)

I posted this in the specific mod forum but I should have asked it here. I want to apply an ADD_STATE_TRIGGER to a particular dialogue state added by another mod, in an area where the mod's content intersects with my mod, in order to make things compatible. (Both mods are patching the dialogue of the same NPC.)

When a mod adds states to a DLG, it numbers them dynamically depending on what states are already there. And this NPC has a bunch of mods adding little bits to their DLG. So I cannot just install the mod and look at the state number. Is there any way to a particular state in an instance like this? Are my options down to just REPLACE_TEXTUALLY?

Thx all.

Edited by subtledoctor
Posted

This should be what you're looking for: STATE_WHICH_SAYS.

Quote
STATE_WHICH_SAYS text FROMString String must be an in-game or in-override .dlg file. Returns:
  1. Fails the installation if it can’t evaluate the text (an @x reference out of bounds)
  2. -3 if the text is not currently in the tlk or in the list of strings to add
  3. -2 if the text is spoken (= SAY ~Foo~) at least twice in the file String
  4. -1 if the text is never spoken in the file String
Otherwise it returns the number of the state in which text is spoken in the file String. @x references are taken from the loaded TRA files (the ones defined in the Language part).

 

Posted

Yeah… although that still involves text-matching, which means there could be some rather complicated localization issues. What if the earlier mod was installed in French, but my mod doesn’t have a French translation? 

Is it possible to check what language was chosen for a particular mod’s installation? 

Posted

This is quite straight forward. I use this all the time to add transitions and new reply options and triggers to mod added states. My mods even do it to their own states installed by an earlier component. (It's how EndlessBG1's inserting of the hero cutscene works, for example, or the shift of transactions for installed / not installd "Korlasz' Crypt in BG1".

Here is the general syntax:

/* add transition to Korlasz dungeon to Belt's dialogue */
// Get state for BELT %belt_ebg1_8% (in dialogues_ee.d)
/* @8 /* ~I see. Still, the city is in your debt. Fare well, Hero of Baldur's Gate.~ */
*/
OUTER_SET belt_ebg1_8 = STATE_WHICH_SAYS 8 IN ~c#endlessbg1/translations/%s/dialogues.tra~ FROM ~BELT~

"belt_ebg1_8" is just a name you use here, I chose the name I gave the dialogue state in my d-file.

The "8" is the line naumber (@8) in the specified tra file. The "~BELT~" at the end is the dlg file the line you are searching is in.

This doesn't work without referring to a trai-fyed text, at least I wouldn't know how.

If the line in question is inside the dlg more than once, this method will fail. (It then gives a very significant "-1 something something" error message. The variable (here "belt_ebg1_8") is set to "-1" if no valid state number could be found.

With regard to languages, weidu will use the correct language the other mod is installed in.

 

The only problem I had with different languages between mods was when using WITH_TRA to get the str-ref number of a line, described here.

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...