Jump to content

Universal mod creation for BG1, BGTutu, BGT


jastey

Recommended Posts

[i am going to regret this. It's such a small mod, and it's [i]working[/i], and... ;) ]

 

OK, so I made a mod for BG1, and I want it to work on all "BG1" versions: BG1 vanilla without TotSC, BG1 vanilla with TotSC, BG1Tutu, and BGT.

 

The main problem here reads as follows: "BG1 w/o TotSC syntax" is not equal to "BG1 with TotSC syntax" is not equal to "BG1Tutu syntax and area names" is not equal to "BGT area names".

(I am aware of cmorgan's suberb tutorial about universal coding for Tutu and BGT but have to admit I didn't understand it.)

 

I will post here my tp2 installation (the crucial part where I do the engine detection and installation / patching of the relevant files), and after people stopped laughing I would appreciate your input on how it should be done right.

 

ACTION_IF FILE_EXISTS ~Override/_AR3300.bcs~ THEN  //Tutu detection
  BEGIN
  PRINT @1

  COMPILE ~C#_BG1Quests/SlimeQuest/Dialogues/Dialogue_Tutu/C#Q01001.D~
  COMPILE ~C#_BG1Quests/SlimeQuest/Dialogues/Dialogue_Tutu/C#Q01003.D~
  COMPILE ~C#_BG1Quests/SlimeQuest/Dialogues/Dialogue_Tutu/C#Q01004.D~

  EXTEND_BOTTOM ~_AR3300.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3300.baf~

  COPY_EXISTING ~FW3344.are~ ~override/FW3344.are~ //assigns area script to area, is missing in Tutu v4
  WRITE_ASCII 0x94 ~_AR3344~
  EXTEND_BOTTOM ~_AR3344.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3344.baf~

  COPY_EXISTING ~FW3357.are~ ~override/FW3357.are~
  WRITE_ASCII 0x94 ~_AR3357~
  EXTEND_BOTTOM ~_AR3357.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3357.baf~

END

ACTION_IF FILE_EXISTS ~data/BG1ARE.bif~ THEN
  BEGIN
  PRINT @9

  COMPILE ~C#_BG1Quests/SlimeQuest/Dialogues/Dialogue_Tutu/C#Q01001.D~
  COMPILE ~C#_BG1Quests/SlimeQuest/Dialogues/Dialogue_Tutu/C#Q01003.D~
  COMPILE ~C#_BG1Quests/SlimeQuest/Dialogues/Dialogue_Tutu/C#Q01004.D~

  EXTEND_BOTTOM ~AR6700.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3300.baf~
  EXTEND_BOTTOM ~AR6744.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3344.baf~
  EXTEND_BOTTOM ~AR6757.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3357.baf~

END

ACTION_IF NOT FILE_EXISTS ~data/BG1ARE.bif~
  AND NOT FILE_EXISTS ~override/_AR3300.bcs~ THEN BEGIN //detection of vanilla BG1

  PRINT @2

  COMPILE ~C#_BG1Quests/SlimeQuest/Dialogues/C#Q01001.d~
	   ~C#_BG1Quests/SlimeQuest/Dialogues/C#Q01003.d~
	   ~C#_BG1Quests/SlimeQuest/Dialogues/C#Q01004.d~

  ACTION_IF NOT FILE_EXISTS ~data/ExpAreas.bif~ THEN BEGIN  //for BG1 without TotSC

  EXTEND_BOTTOM ~AR3300.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3300_BG.baf~
  EXTEND_BOTTOM ~AR3344.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3344_BG.baf~
  EXTEND_BOTTOM ~AR3357.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3357_BG.baf~

  END ELSE BEGIN   //for BG1 with TotSC

  EXTEND_BOTTOM ~AR3300.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3300.baf~
  EXTEND_BOTTOM ~AR3344.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3344_TotSC.baf~
  EXTEND_BOTTOM ~AR3357.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3357.baf~

  END

END

Link to comment

I'll just wish you well here - I don't understand this thing as well as cmorgan does. But I think your code looks close to correct. My minimod, Xan's BG2 soundset in BG1(actually, SisterV's minimod, I'm just a coder) is coded this way(if it helps):

 

ACTION_IF FILE_EXISTS_IN_GAME ~FW0100.are~ THEN BEGIN

 

PRINT ~TUTU detected: _Xan.cre, _Xan4.cre, and _Xan6.cre are patched.~

 

...

 

 

END ELSE BEGIN

 

ACTION_IF FILE_EXISTS_IN_GAME ~bg1start.2da~ THEN BEGIN

 

PRINT ~BGT detected: BGXan.cre, Xan4.cre, and Xan6.cre are patched.~

 

...

 

END ELSE BEGIN

 

PRINT ~Neither Tutu nor BGT are detected: Xan.cre, Xan4.cre, and Xan6.cre are patched.~

 

...

 

 

END

 

END

 

(bat files run here)

Link to comment

Everything looks right there, to me, to... I would be a little more agressive, and steal most of the stuff from the BG1 NPC internal version, but you look fine.

 

Most of the problems going back and forth are about .DLG, .BCS, and items. Hold on, let me work on this for a minute, and show you...

Link to comment
/*
* "Jastey's Project"
* Combined BG1/TUTU/BGT installer
* authored and coded by Jastey
* July 6, 2007
* Version #
*/

/* Backup folder */
BACKUP ~JASTEY/backup~
/* Author */
AUTHOR ~Jastey: forums.gibberlings3.net~
MODDER //This sets the flag so you get lots of feedback - remove it from public distributions to supress alot of stuff.

ALWAYS


ACTION_IF FILE_EXISTS_IN_GAME ~FW0100.are~ THEN BEGIN
  PRINT @1

  COMPILE ~C#_BG1Quests/SlimeQuest/Dialogues/Dialogue_Tutu/C#Q01001.D~
  COMPILE ~C#_BG1Quests/SlimeQuest/Dialogues/Dialogue_Tutu/C#Q01003.D~
  COMPILE ~C#_BG1Quests/SlimeQuest/Dialogues/Dialogue_Tutu/C#Q01004.D~

  EXTEND_BOTTOM ~_AR3300.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3300.baf~

  COPY_EXISTING ~FW3344.are~ ~override/FW3344.are~ //assigns area script to area, is missing in Tutu v4
  WRITE_ASCII 0x94 ~_AR3344~
  EXTEND_BOTTOM ~_AR3344.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3344.baf~

  COPY_EXISTING ~FW3357.are~ ~override/FW3357.are~
  WRITE_ASCII 0x94 ~_AR3357~
  EXTEND_BOTTOM ~_AR3357.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3357.baf~


END

ACTION_IF FILE_EXISTS_IN_GAME ~AR7200.are~ THEN BEGIN
  PRINT @9

  COMPILE ~C#_BG1Quests/SlimeQuest/Dialogues/Dialogue_Tutu/C#Q01001.D~ <<BGT versions needed unless you go through the tutorial with me
  COMPILE ~C#_BG1Quests/SlimeQuest/Dialogues/Dialogue_Tutu/C#Q01003.D~
  COMPILE ~C#_BG1Quests/SlimeQuest/Dialogues/Dialogue_Tutu/C#Q01004.D~

  EXTEND_BOTTOM ~AR6700.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3300.baf~
  EXTEND_BOTTOM ~AR6744.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3344.baf~
  EXTEND_BOTTOM ~AR6757.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3357.baf~

ACTION_IF NOT FILE_EXISTS_IN_GAME ~AR7200.are~ AND NOT FILE_EXISTS_IN_GAME ~FW0100.are~ THEN BEGIN //detection of vanilla BG1

  PRINT @2

  COMPILE ~C#_BG1Quests/SlimeQuest/Dialogues/C#Q01001.d~
	   ~C#_BG1Quests/SlimeQuest/Dialogues/C#Q01003.d~
	   ~C#_BG1Quests/SlimeQuest/Dialogues/C#Q01004.d~

  ACTION_IF NOT FILE_EXISTS ~data/ExpAreas.bif~ THEN BEGIN  //for BG1 without TotSC

  EXTEND_BOTTOM ~AR3300.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3300_BG.baf~
  EXTEND_BOTTOM ~AR3344.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3344_BG.baf~
  EXTEND_BOTTOM ~AR3357.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3357_BG.baf~

  END ELSE BEGIN   //for BG1 with TotSC

  EXTEND_BOTTOM ~AR3300.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3300.baf~
  EXTEND_BOTTOM ~AR3344.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3344_TotSC.baf~
  EXTEND_BOTTOM ~AR3357.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3357.baf~

  END

END

 

If you work with the variales in your dialogue files, this can be simplified to

 

ACTION_IF FILE_EXISTS_IN_GAME ~FW0100.are~ THEN BEGIN
/* Tutu */
 (set your variables equal to the values for Tutu)
END
ACTION_IF FILE_EXISTS_IN_GAME ~AR7200.are~ THEN BEGIN
/* BGT */
 (set your variables equal to the values for BGT)
END

ACTION_IF NOT FILE_EXISTS_IN_GAME ~AR7200.are~ AND NOT FILE_EXISTS_IN_GAME ~FW0100.are~ THEN BEGIN
/* BG1 */
 (set your variables equal to the values for BG1)
END

 /* Tutu Area Script Assignment Patching: All Areas Script ID'd */
 /*this can be taken directly from The BG1 NPC Project, and basically "EasyTutu's" the area scripts, */
 /* assigning all of them but only if they have not been assigned. For specifics, check out the G3 Common Code */
 /* links! */
 ACTION_IF FILE_EXISTS_IN_GAME ~FW0100.are~ THEN BEGIN
INCLUDE ~JASTEY\LIB\tutu_area_script_assign.tph~
 END


BEGIN @200 /* Install Jastey's Mod */
  COMPILE EVALUATE_BUFFER ~C#_BG1Quests/SlimeQuest/Dialogues/C#Q01001.D~
  COMPILE EVALUATE_BUFFER ~C#_BG1Quests/SlimeQuest/Dialogues/C#Q01003.D~
  COMPILE EVALUATE_BUFFER ~C#_BG1Quests/SlimeQuest/Dialogues/C#Q01004.D~

  EXTEND_BOTTOM ~%MyArea1%.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3300.baf~
 EVALUATE_BUFFER
  EXTEND_BOTTOM ~%MyArea2%.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3344.baf~
 EVALUATE_BUFFER
  EXTEND_BOTTOM ~%MyArea3%.bcs~ ~C#_BG1Quests/SlimeQuest/Scripts/C#Q01_AR3357.baf~
 EVALUATE_BUFFER

ACTION_IF NOT FILE_EXISTS ~data/ExpAreas.bif~ AND ACTION_IF NOT FILE_EXISTS_IN_GAME ~AR7200.are~ AND NOT FILE_EXISTS_IN_GAME ~FW0100.are~ THEN BEGIN 
/* BG1 without TOTSC */

Changes go here.

END
Link to comment

Thank you, I am still working my way through it.

One question: Difference in .d for BG1 and Tutu is differences in journal entries, for example. Would this be covered with the COMPILE EVALUATE_BUFFER (as far as i understood it would not)?

Meaning: for the Tutu and BGT versions, I am using the difference in Quest, and quest done entries as well as "EraseJournalEntry" which does not exist in BG1.

Link to comment

OK. clear as mud. I am not helping here. Let me try again.

 

 

One example.

 

The difference between BG1, Tutu, and BGT area numbers. They are all the same area, just labeled differently. I want to install the same mod on all three platforms, without any further work.

 

1. I set a variable for the area. If it is BG1, it becomes AR1234, if it is Tutu it becomes FW1234, if it is BGT it becomes AR5678.

 

IF BG1

OUTER_SPRINT "MyArea1" "AR1234"

IF TUTU

OUTER_SPRINT "MyArea1" "_AR1234"

IF BG1

OUTER_SPRINT "MyArea1" "AR5678"

 

Then I write one line for all three platforms:

EXTEND_BOTTOM ~%MyArea1%.bcs~

 

This will look to WeiDU like AR1234.bcs on BG1, _AR1234.bcs on Tutu, and AR5678.bcs on BGT.

 

Let me set up an example (tomorrow0 about the dialogue differences, but that should get you a little way down the road...

Link to comment

I think your tutorial is fine, I didn't say I wouldn't understand it if I'd really try. You are helping me very much, cmorgan.

But if I understood it correctly, the method you showed is only useful for different "names" for the different games. Like area names, item names, etc.

 

If I have syntax differences (like they exist between Bg1, BG1 + TotSC and BGII, journal entry handeling for example), would it still be possible to include it into one .d.. somehow?

 

EDIT: Maybe I missed this in your last sentence.

Link to comment

Ahhh - no. I see. Tutu and BGT are easy to crosmod because the scripting is different. To do this with actual scripts, you would have to so something fancy, setting up code snippets as variable -

 

%BGT_VAR% is an example in BG1 NPC, where it is set to nothing in Tutu and to a line of code ( !Global("EndOfBG1:,"GLOBAL"2) ).

 

If you have different actual script code, the safest thing to do is to build separate BG1 files completely. There is no easy way of setting up backwards compatable code.

 

Technically, you could do it, but it would be way too much work - swapping out area/dialogue/dv/script/etc is straightforward. Swapping out entire code branches is best left to traditional packaging - one folder for BG1, 1 for Tutu, 1 for BGT. In that case, you need to wrap up your code, test it, then give Ascension64 a call about converting it to BGT, and convert it to Tutu manually.

Link to comment

So it seems I didn't do it all the dumb way.

 

Swapping out entire code branches is best left to traditional packaging - one folder for BG1, 1 for Tutu, 1 for BGT. In that case, you need to wrap up your code, test it, then give Ascension64 a call about converting it to BGT, and convert it to Tutu manually.
I am not too sure about what you mean with converting to Tutu manually; What I did for the quest mod was creating different .d files for the BG1 and Tutu version, the tutu.d will be used for BGT (same engine). For the BG1 and BG1+TotSC differences I had to create different .baf, but for BG1+TotSC, Tutu and BGT the same .bafs are used (and yes, the coding looks horrible for BGII because there is no "OR()" used anywhere, but BG1+TotSC syntax works on BGII engine and I am lazy, so.). All is assigned to the game/ engine in question via .tp2 game detection like posted above.

 

It is working, I am happy... ;)

 

I just wanted to know whether there would have been a better way to code it if done from scratch, but for me it's a bit like "never change a running system", I think, especially with the mentioned syntax differences between the engines.

 

One question: In your code example above (which, btw., looks far better ordered than mine), you use

~FW0100.are~ for Tutu detection and ~AR7200.are~ for BGT detection. Is this something arbitrarily taken like I did with "_AR3300.bcs" and "~data/BG1ARE.bif~" or is there a specific reason to use those files for detection ("several other mods using them" would be a reason to me, btw.)?

Link to comment
All is assigned to the game/ engine in question via .tp2 game detection like posted above.

 

It is working, I am happy... ;)

 

Cool - but remember that things like Imoen's DV change between Tutu and BGT "imoen" "imoen2" as do a number of dialogue files, area references, and item names; as long as those are set up correctly, you should be good to go!

 

For a major list of the changes, download the latest internal of BG1 NPC and take a look at the tp2.

 

One question: In your code example above (which, btw., looks far better ordered than mine), you use

~FW0100.are~ for Tutu detection and ~AR7200.are~ for BGT detection. Is this something arbitrarily taken like I did with "_AR3300.bcs" and "~data/BG1ARE.bif~" or is there a specific reason to use those files for detection ("several other mods using them" would be a reason to me, btw.)?

The reason is that in a big discussion between Miloch and a bunch of folks, we thought that it was easiest to use something similar and unique. He even has a unique file for BG1 and for BG1/TOTSC; tomorrow I will try and see if I can find the posts (or you can PM him). That means that there is just a single .are chec and you have your engine narrowed down!

Link to comment

Either my reply vanished or I was daydreaming about posting here. ;)

 

BGT install: Whether it is set up correctly will be to be proven before the release..

 

Tutu / BGT detection: That's what I thought. I will use those files then, too.

 

Thank you for your assistance!

Link to comment

Jastey, if you want, send me a copy of the mod - I will take a morning this coming week and set up the Tutu/BGT stuff to install on BGT, if you like. If you would prefer not, I understand completely - it is not fun to have your own mod include things you can't troubleshoot effectively; but I thought I would make the offer anyways ;)

Link to comment
The reason is that in a big discussion between Miloch and a bunch of folks, we thought that it was easiest to use something similar and unique. He even has a unique file for BG1 and for BG1/TOTSC; tomorrow I will try and see if I can find the posts (or you can PM him).
No idea where that post is (if it still exists) but I dug this up from my files:
ACTION_IF FILE_EXISTS_IN_GAME ~FW0125.ARE~ THEN BEGIN //Tutu
 OUTER_SPRINT ~tsu~ ~_~ //Tutu underscore
END ELSE BEGIN
 ACTION_IF FILE_EXISTS_IN_GAME ~AR7200.ARE~ THEN BEGIN //BGT
OUTER_SPRINT ~tsu~ ~~ //No underscore
 END ELSE BEGIN
ACTION_IF FILE_EXISTS_IN_GAME ~AR2003.ARE~ THEN BEGIN //BG1+TotSC
  OUTER_SPRINT ~tsu~ ~~ //No underscore
END ELSE BEGIN
  ACTION_IF FILE_EXISTS_IN_GAME ~AR0125.ARE~ THEN BEGIN //BG1
	OUTER_SPRINT ~tsu~ ~~ //No underscore
  END ELSE BEGIN
	ACTION_IF FILE_EXISTS_IN_GAME ~AR6200.ARE~ THEN BEGIN //BG2-ToB
	  OUTER_SPRINT ~tsu~ ~~ //No underscore
	END ELSE BEGIN
	  ACTION_IF FILE_EXISTS_IN_GAME ~AR0083.ARE~ THEN BEGIN //BG2-SoA
		OUTER_SPRINT ~tsu~ ~~ //No underscore
	  END ELSE BEGIN
		FAIL ~This mod is not compatible with your game.~
	  END
	END
  END
END
 END
END

A normal mod wouldn't have all those checks, of course :).

 

Edit: In theory, you should be able to use REQUIRE_PREDICATE GAME_IS instead, but there were some stipulations against it, like it can't always accurately detect Tutu or something - there was an exchange on PPG about it.

 

Also found the original post.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...