Author Topic: Question on doing interjections into other mods  (Read 1894 times)

Offline plainab

  • Sasha al'Therin
  • Planewalker
  • *****
  • Posts: 491
    • Infinity Engine Modding
Question on doing interjections into other mods
« on: August 25, 2008, 10:47:27 AM »
How would I create an interjection or chain in relation to content from another mod?

Basically without going into detail:

Mod A adds a scenario.
Actor 1 (say Minsc) -- loses something
Actor 1 -- accuses other party members (Jan, Edwin, PC, etc...)
Actor 2 (say Jan if present) -- makes a comment and the two go on
Actor 3 (say Edwin if present) -- makes a comment and the two go on
It's here that I want to add my npc's reaction to the accusation (if she is present).

How would I do that if
1) Mod A may be installed after my NPC or not installed at all
2) Some Mod C might change states in dependent dialog file so that state numbers present in my install with Mod A would be different causing incorrect firing of banter.
3) Is this something that Mod A would have to do by looking for my NPC Mod.

Or would I just have to use a script file and trigger a new banter between the actor and my npc regarding this issue and word it according to what would have already been read with in the added scenario?
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altherin.webs.com

Offline Kulyok

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 6250
  • Gender: Female
  • The perfect moment is now.
Re: Question on doing interjections into other mods
« Reply #1 on: August 25, 2008, 11:35:14 AM »
Crossmod banter pack has code examples for these interactions, specifically with Amber mod(both Amber authors and other mod authors agreed to it and co-wrote the material). Download it at G3, have a look.

There's a strong downside, though: if something, anything in the code for mod A(Amber) changes, mod C(Crossmod Banter Pack) is royally screwed, and I mean it.

Offline plainab

  • Sasha al'Therin
  • Planewalker
  • *****
  • Posts: 491
    • Infinity Engine Modding
Re: Question on doing interjections into other mods
« Reply #2 on: August 25, 2008, 04:00:52 PM »
Crossmod banter pack has code examples for these interactions, specifically with Amber mod(both Amber authors and other mod authors agreed to it and co-wrote the material). Download it at G3, have a look.

There's a strong downside, though: if something, anything in the code for mod A(Amber) changes, mod C(Crossmod Banter Pack) is royally screwed, and I mean it.

Since I doubt that I could have cross mod content that was dependent upon the other mod's states. Then I should use a separate banter file that is fired by a script which looks for certain conditions in the other mod to be true.  So my banter would be about that mod's events but not interjected into that mod's dialog. I can live with that. Of course, whatever files I create that would be dependent upon information from the other mod would have to be put inside a check for that other mod.

Slightly, OT but since I started it's okay.  Is UB best installed before or after npc mods?
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altherin.webs.com

Offline Dark Raven

  • Bloody Cynical
  • Planewalker
  • *****
  • Posts: 1194
  • Gender: Female
  • Flesh is the law
    • Chosen of Mystra
Re: Question on doing interjections into other mods
« Reply #3 on: August 25, 2008, 08:39:08 PM »
Quote
Is UB best installed before or after npc mods?
Before. Any fixes, tweaks, alterations and restoration mods should be installed first.
Per me si va nella citta dolente.
Per me si va nell eterno dolore.
Per me si va tra la perduta gente...
Lasciate ogni speranza perduta che'entrate!

Chosen of Mystra home to many mods.

Offline plainab

  • Sasha al'Therin
  • Planewalker
  • *****
  • Posts: 491
    • Infinity Engine Modding
Re: Question on doing interjections into other mods
« Reply #4 on: August 25, 2008, 11:20:52 PM »
Back to my original topic...
Would it be possible or wise to do something like this to interject where I would like in the other mod? Provided the other mod is installed first.  I think this would get me the exact state I would need.  The only downside would be if the other mod had to update their text string due to a typo, I would then have to update my mod...  But the positive side to that would be that if they did make a change there would be no matching text string so it would fail and not create any screwed states.

Code: [Select]
BEGIN ~my mod~
/* do a bunch of stuff */
ACTION_IF (FILE_EXISTS ~override/somefile.xxx~) THEN BEGIN //where somefile.xxx is changed to look for the marker file found in 'Mod A'
 COPY_EXISTING ~actor1.dlg~ ~override~ //where actor1 is the file I wish to interject into
  READ_LONG 0x0008 ~state#~
  READ_LONG 0x000c ~stateOff~
  FOR (x=0;x<%state#%;x+=1) BEGIN
   READ_STTREF (%stateOff% + (%x% * 16) + 0) ~text_value~
   PATCH_IF (~%text_value%~ STRING_EQUAL ~This would be exact copy of text taken from desired state I want to branch from~) BEGIN
    SET dostate = %x%
    SET x = %state#% + 1
    SET doit = 1
   END
  END
 BUT_ONLY_IF_IT_CHANGES
END
ACTION_IF (%doit% = 1) THEN BEGIN
<<<<<<<< inlined/d-changes
INTERJECT_COPY_TRANS2 actor1 %dostate% ab_myvariable
 == mynpc IF ~InParty("mynpc")
!Dead("mynpc")
!StateCheck("mynpc",STATE_SLEEPING)
GlobalGT("ab_oneofmyvariables","GLOBAL",1)~ THEN ~The text I want my npc to say~
== actor1 ~Their response.~
== mynpc ~response back~
END
>>>>>>>>
COMPILE ~inlined/d-changes~
 EVALUATE_BUFFER
END ELSE BEGIN
PRINT ~Matching text not found. Skipping installation of this banter patch.~
END
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altherin.webs.com

Offline Kulyok

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 6250
  • Gender: Female
  • The perfect moment is now.
Re: Question on doing interjections into other mods
« Reply #5 on: August 26, 2008, 12:45:57 AM »
Sure, if the author of the other mod doesn't mind you potentially screwing theirs.

Offline Kaeloree

  • Planewalker
  • *****
  • Posts: 109
Re: Question on doing interjections into other mods
« Reply #6 on: August 26, 2008, 01:26:34 AM »
Why don't you just use STATE_WHICH_SAYS like in Crossmod?

Offline plainab

  • Sasha al'Therin
  • Planewalker
  • *****
  • Posts: 491
    • Infinity Engine Modding
Re: Question on doing interjections into other mods
« Reply #7 on: August 26, 2008, 07:11:43 AM »
Why don't you just use STATE_WHICH_SAYS like in Crossmod?
Cause that's one of them new things in Weidu, that I just haven't wrapped my brain around yet. Besides, I'm waiting for the "Cliff Notes" to come out....  ;D

No seriously, I hadn't delved into Crossmod yet to see what they did. I had an inspirational thought on that last post and shared it. The safest bet (and that is what I prefer to do - be safe rather than sorry) is to after checks to see if other mod exists apply a script block that looks for the other mods triggers and have an external banter about the situation rather than include the banter in the actual discussion.  So I will stick with that for now.... 
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altherin.webs.com

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: Question on doing interjections into other mods
« Reply #8 on: August 26, 2008, 08:44:37 AM »
EDIT: never mind - read too fast. You came to this conclusion already. I tyoped it, so I will leave it, but ignore it.

Plainab, the real (technical) difficulty here is twofold:

PATCH_IF (~%text_value%~ STRING_EQUAL ~This would be exact copy of text taken from desired state I want to branch from~) BEGIN

This means you would need to match .tra references to standard game, GTU updates, Baldurdash GTU, localized translations/repairs, Fixpack (either BG one you are working on or BG2, UB repairs, etc., etc. If you do it via regexp, you risk patching the wrong state completely. And if you match a mod .tra reference, then it is ebven worse, as every time they implememnt editorial stuff or correct spelling, your patch fails.

The second is pretty straightforward - in order for players to see your mod added content, you would have to be last in the install order. One huge strength of not doing this solo and instead adding to crossmod content is that the mod is designed to take all existing NPCs (in any order) and detect their installation, then pathc in added content customized to the users install, just as you are suggesting.

Given STATE_WHICH_SAYS (similar limitations) and install order problems, I think your best bet is to add this/submit this to crossmod. If the authors do not agree to your changes or are unavailable, then you can build an "adon" mod that ships alongside your mod; a mini-crossmod pack that is installed at the end along with banterpack and crossmod.

Or, be safest - add a script block or I_C_T a variable into place, and trigger a separate dialog.
« Last Edit: August 26, 2008, 08:48:15 AM by cmorgan »

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: