Jump to content


Photo

Best way to patch a dialogue


  • Please log in to reply
6 replies to this topic

#1 Turambar

Turambar
  • Modder
  • 935 posts

Posted 07 January 2013 - 08:01 AM

While working on an old mod, I ran across a dialogue which used REPLACE (on a vanilla dialogue), when it actually only had to add some lines to a transition action.

My question is: what is the best way to do that, in particular for maximum compatibility with other mods (which might have patched the same dialogue before)?

 

In particular, the aim of the patch is to turn some more people in the area hostile. The old transition is

THEN
REPLY ~reply~
DO ~SetSomeVars
Enemy()~
SOLVED_JOURNAL ~journal~
EXIT

And must be turned into

THEN
REPLY ~reply~
DO ~SetSomeVars
Enemy()
ActionOverride(Someoneelse,Enemy())~
SOLVED_JOURNAL ~journal~
EXIT

 

My ideas:

1. without a .d file:

DECOMPILE...
REPLACE_TEXTUALLY ~^[^a-zA-Z]*Enemy()[^a-zA-Z]*$~ ~Enemy()%LNL%ActionOverride(...)~
COMPILE...

 

With a .d file:

2. ALTER_TRANS

3. REPLACE_TRANS_ACTION

these two actions only work on selected transitions and states, so, if a previous mod did COPY_TRANS, the new transitions would not be patched.

 

4. REPLACE_ACTION_TEXT

IMO, the most compatible? works like REPLACE_TEXTUALLY but only on transitions (so, doesn't break triggers by mistake); UNLESS can be used to prevent the new piece to be added if another mod did the same thing. Finally, this patches all occurrencies of Enemy(), even those added by other mods.

 

Of course, if other, already installed, mods wanted those others never to turn hostile, this could become a problem. But then, the two mods are conceptually incompatible, so a "correct" way to deal with them does not exist in that case

 

I would rather use the 4th method, but I'm not so sure, so I'm asking for other opinions. What do you think? Do you have other ideas? What would you suggest to use? TIA for any hint

 

PS: if this is the wrong forum, I apologize; please move it wherever it is appropriate


Turambar

Currently supporting: DSotSC for BGT, NTotSC - forum

Turambar's fixes and tweaks for BG2, BGT, DSotSC, NTotSC, SoBH and more!

 

Before posting questions (even regarding posts written by myself), please look at Jarno Mikkola's FAQs for the Megamods!
(how to correctly report CTDs)

 


vipersig.jpg


#2 Kaeloree

Kaeloree

    Head Molder

  • Administrator
  • 9200 posts

Posted 07 January 2013 - 03:08 PM

Wouldn't it make sense to use ADD_TRANS_ACTION?



#3 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 07 January 2013 - 03:41 PM

You might need to check the action order. IIRC, Enemy() might be a "terminal action" that may cause some actions placed after it not to be executed. Putting the ActionOverride() before the Enemy() would avoid that issue. This only happens in DLG files, not scripts. But yeah, I'd think A_T_A would be the way to go there. And if you are going to use a REPLACE, don't forget the BUT_ONLY.


"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#4 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Modder
  • 1505 posts

Posted 07 January 2013 - 05:31 PM

Nah, you've got it pretty well sussed out, with Liam's addition of A_T_A. Where REPLACE_ACTION_TEXT/REPLACE_TRIGGER_TEXT really shine is somewhere like IWD, where you got the %#*(&** BitGlobals as both triggers and actions.

Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.
____
The Gibberlings Three - Home of IE Mods

The BG2 Fixpack - All the fixes of Baldurdash, plus a few hundred more. Now available, with more fixes being added in every release.


#5 Turambar

Turambar
  • Modder
  • 935 posts

Posted 08 January 2013 - 09:18 AM

Thank you. I hadn't thought about A_T_A, but it's definitely better than R_T_A.

My only concern is, if another mod (installed before) duplicated the transition (eg, with COPY_TRANS, for example adding an interjection by another NPC which still leads to the same actions, ie the interlocutor turning hostile), wouldn't A_T_A miss the new transitions? in the end, A_T_A only works on a specified state and transition. Don't you think that could be a problem?


Edited by Turambar, 08 January 2013 - 09:24 AM.

Turambar

Currently supporting: DSotSC for BGT, NTotSC - forum

Turambar's fixes and tweaks for BG2, BGT, DSotSC, NTotSC, SoBH and more!

 

Before posting questions (even regarding posts written by myself), please look at Jarno Mikkola's FAQs for the Megamods!
(how to correctly report CTDs)

 


vipersig.jpg


#6 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 08 January 2013 - 10:35 AM

Does the state have more than one transition? And I thought that unless you specified otherwise, A_T_A adds the action to all transitions for that state.


"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#7 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Modder
  • 1505 posts

Posted 08 January 2013 - 11:03 AM

It does work on all transitions unless bound, but I think Turambar is more referring to a case where a previous mod has come in and I_C_T/C_T'd the state in question. In that case you'd be patching the original state and its transitions (including the new one), which is good, but not all the other places where the transitions have been copied to, i.e. the previous mod's new states that copied the transitions. This usually isn't a problem, unless you can't let A_T_A run everywhere (i.e. you're only setting a global on a couple of responses) or if the other mod's new transitions shouldn't necessarily get your new trans action.

There's not really a good way to handle this, unfortunately. You'd basically have to be aware of other mods that COPY_TRANS there--which is the biggest problem--and use STATE_WHICH_SAYS on the dialogues to detect where the new states are, and then A_T_A/R_T_A those conditionally. The other mod would also have to reciprocally do the same if you wanted to remove install order issues.

Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.
____
The Gibberlings Three - Home of IE Mods

The BG2 Fixpack - All the fixes of Baldurdash, plus a few hundred more. Now available, with more fixes being added in every release.