Here is the deal: the majority of areas in BG1 have no BCS files assigned to them. If I want some scripted behavior to occur in such an area, I need to create a BCS file that starts with AR... and install it with my mod. That's easy, but it's going to overwrite any other area file that might already be installed by other mods. To avoid this compatibility issue I could use a BAF file with my own entries and just extend the script. But that does anything only if there is indeed a script to extend. What is the solution to this? Is there one?
Scripts for areas that don't have them
#1
Posted 16 February 2017 - 09:37 AM
#2
Posted 16 February 2017 - 09:55 AM
Easy, you read if the .are file has a script assigned and append that if it has, and if not, you assign a new one.
Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit).
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.
#3
Posted 16 February 2017 - 10:49 AM
You could do that and then do EXTEND_BOTTOM to the area script. EXTEND_BOTTOM creates a new one if there is none, yet, so you don't have to worry about that. (For compatibility reasons, I guess it is clear not to create an own area script because it would replace an exiting one.)
There is a very elegant solution by DavidW+Argent77.
Put this into your tp2 at the beginning:
/* DavidW's code for unifying the area script patching. With many thanks! To be used later in the form: LAF extend_area_script STR_VAR area="%Candlekeep%" top="bg1re/script/AR2600.baf" END */ DEFINE_ACTION_FUNCTION extend_area_script STR_VAR area="" top="" bottom="" BEGIN // find the area script from the area file COPY_EXISTING "%area%.are" override READ_ASCII 0x94 script BUT_ONLY // if it doesn't exist, give it a default name ACTION_IF "%script%" STRING_EQUAL "" BEGIN OUTER_INNER_PATCH_SAVE script "%area%" BEGIN REPLACE_TEXTUALLY "FW" "_AR" // TUTU naming conventions END // added by argent77: assign area script if needed COPY_EXISTING "%area%.are" override WRITE_ASCIIE 0x94 ~%script%~ #8 END // extend the script ACTION_IF "%top%" STRING_COMPARE "" BEGIN EXTEND_TOP "%script%.bcs" "%top%" EVALUATE_BUFFER END ACTION_IF "%bottom%" STRING_COMPARE "" BEGIN EXTEND_BOTTOM "%script%.bcs" "%bottom%" EVALUATE_BUFFER END END
Then, if you have an addition to an area bcs named area_patch.baf, which you want to add to Beregost area, the appropriate line for teh area patching then is:
For EXTEND_TOP:
LAF extend_area_script STR_VAR area="%Beregost%" top="modfolder/script/area_patch.baf" ENDFOR EXTEND_BOTTOM:
LAF extend_area_script STR_VAR area="%Beregost%" bottom="modfolder/script/area_patch.baf" END
The area names are from the cpmvars.tpa like they are listed here for bgee.
Some comments: If you do EXTEND_TOP, always add a Continue() at the end of your script block(s) or your mod will prevent all script actions that should happen on the first area creation (movies etc.).
Edited by jastey, 16 February 2017 - 11:45 AM.
My Own: Ajantis BG1 Expansion Modification -- Sir Ajantis for BGII -- Ajantis Portrait Pack -- Another fine Hell -- Brage's Redemption -- BGQE at Gibberlings 3 / BGQE at Kerzenburgforum -- Brandock the Mage -- Endless BG1 -- Grey The Dog NPC -- Imoen 4 Ever -- Imoen Is Stone -- Jastey's SoD TweakPack -- Road to Discovery (SoD) -- Solaufein's Rescue - jastey's Solaufein NPC Mod -- The Boareskyr Bridge Scene (SoD)
Contributions: Adalon's Blood (Silberdrachenblutmod) -- Alternatives -- Ascalon's Questpack -- Ascalon's Breagar NPC -- Balduran's Seatower -- BG1 NPC Project -- BG1 Romantic Encounters -- Corthala Romantique -- Edwin Romance -- Fading Promises -- Gavin BG1 --Hidden Adventures -- Imoen Can Die -- Keldorn Romance (berelinde's) -- Lure of Sirine's Call -- NTotSC -- Romantic Encounters (BGII)
Avatar by Rabain
#4
Posted 16 February 2017 - 10:51 AM
Hi there. I guess I didn't explain myself very clearly. It's about compatibility. If I just put in my own BCS file for an area, how do I know some other modder isn't putting in his own BCS file for it? That's the problem.
Basically, there are three types of areas:
1) With a BCS assigned and it actually exists and can be extended.
2) With a BCS assigned (looked at in Near Infinity) but the script doesn't exist. <- This is the problematic one.
3) With "none" for the script.
About number 3, is there a way to assign a script to an area inside the Weidu installer? I could assign the script in NI for the ARE and then just plop the ARE in my installation, but that's going to overwrite everything else about the area others might have changed. Pretty crude.
...But - while I'm on that topic - directly changing an ARE is clearly the most efficient way of reworking an area - actors, chests etc. Is it really so bad a method? I have been told that the most tender way is to use some special Weidu actions to edit the actors etc. in an area, but that really is going to take an enormous amount of work. It's much, much easier to edit the inside of a house etc. as you see fit in Near Infinity and include it in the installation for override. I don't think this method necessarily precludes compatibility with other mods, too, if they are installed later on top of mine.
#5
Posted 16 February 2017 - 10:56 AM
Okay, jastey. You wrote that while I was typing... About this piece of code. It has this in it:
COPY_EXISTING "%area%.are" override
This part is going to overwrite my custom ARE, if I have one.
In all honesty, I don't understand that code. Too many unknown things.
I thank you for sharing it, but it's really really annoying to have to learn so much irrelevant stuff again. Here I am, making my NPC, writing their personalities, dialogues, some pretty good stuff, I think, making items and images for them, coming up with little twists, all quite time-consuming, but at least it's creative work. And then, when I've chased out most of the bugs and the stuff seems almost ready to go, I have to take a six-months course in electrical engineering to tune my tele. That's what this stuff with Weidu is an equivalent of. And all for the sake of compatibility with what every single person on Earth might make. This is really quite a tall order and a tall obstacle to modders who are not so tech-savvy. We could have a good deal many more and fun mods if people didn't think they had to deliver a technically seamless experience. I bet many projects never got off the ground when their authors realized just how many angles they would be expected to cover.
Edited by temnix, 16 February 2017 - 11:17 AM.
#6
Posted 16 February 2017 - 11:03 AM
About this piece of code. It has this in it:This part copies area script from game resources to override BEFORE anything is done with your custom .baf laying safely in your mod folder
COPY_EXISTING "%area%.are" override
This part is going to overwrite my custom ARE, if I have one.
The Old Gold - v0.2 WIP (mod for BGT/BWP/BWS)
#7
Posted 16 February 2017 - 11:38 AM
Erm, I mean I have an idea what the code does but I never could have written something like that myself. I could explain the steps to you if you want. Basically it's prepair the specified area for patching, read the area script, assign the script if it isn't, create the script if it's not there yet, and then patch your baf changes to it. It's a bit more complicated because it's written so that it works for Tutu and BGT, too.
Alternatively you could just use it and be happy? :-)
Edited by jastey, 16 February 2017 - 11:38 AM.
My Own: Ajantis BG1 Expansion Modification -- Sir Ajantis for BGII -- Ajantis Portrait Pack -- Another fine Hell -- Brage's Redemption -- BGQE at Gibberlings 3 / BGQE at Kerzenburgforum -- Brandock the Mage -- Endless BG1 -- Grey The Dog NPC -- Imoen 4 Ever -- Imoen Is Stone -- Jastey's SoD TweakPack -- Road to Discovery (SoD) -- Solaufein's Rescue - jastey's Solaufein NPC Mod -- The Boareskyr Bridge Scene (SoD)
Contributions: Adalon's Blood (Silberdrachenblutmod) -- Alternatives -- Ascalon's Questpack -- Ascalon's Breagar NPC -- Balduran's Seatower -- BG1 NPC Project -- BG1 Romantic Encounters -- Corthala Romantique -- Edwin Romance -- Fading Promises -- Gavin BG1 --Hidden Adventures -- Imoen Can Die -- Keldorn Romance (berelinde's) -- Lure of Sirine's Call -- NTotSC -- Romantic Encounters (BGII)
Avatar by Rabain
#8
Posted 16 February 2017 - 11:43 AM
Same example, still Beregost, for BG:EE (AR3300.are):
COPY_EXISTING ~AR3300.are~ ~override~ //takes the current AR3300.are
WRITE_ASCII 0x94 ~AR3300~ #8 //writes the script name (same as area name, always)
BUT_ONLY_IF_IT_CHANGES
EXTEND_BOTTOM ~AR3300.bcs~ ~modfolder/script/area_patch.baf~
EVALUATE_BUFFER
Also, I edited my post above, because the code got messed up in the function call examples.
My Own: Ajantis BG1 Expansion Modification -- Sir Ajantis for BGII -- Ajantis Portrait Pack -- Another fine Hell -- Brage's Redemption -- BGQE at Gibberlings 3 / BGQE at Kerzenburgforum -- Brandock the Mage -- Endless BG1 -- Grey The Dog NPC -- Imoen 4 Ever -- Imoen Is Stone -- Jastey's SoD TweakPack -- Road to Discovery (SoD) -- Solaufein's Rescue - jastey's Solaufein NPC Mod -- The Boareskyr Bridge Scene (SoD)
Contributions: Adalon's Blood (Silberdrachenblutmod) -- Alternatives -- Ascalon's Questpack -- Ascalon's Breagar NPC -- Balduran's Seatower -- BG1 NPC Project -- BG1 Romantic Encounters -- Corthala Romantique -- Edwin Romance -- Fading Promises -- Gavin BG1 --Hidden Adventures -- Imoen Can Die -- Keldorn Romance (berelinde's) -- Lure of Sirine's Call -- NTotSC -- Romantic Encounters (BGII)
Avatar by Rabain
#9
Posted 16 February 2017 - 02:07 PM
If you want to do it by hand, you can do it like this, but I am not sure it's easier?It's NOT, because you reduced the important part OUT... the fact that you don't read the .are files offset 0x94 any longer, so the above would by itself just WRITE the entry without any inclination of what it was before.
YOU have to include this part:
COPY_EXISTING "ar3300.are" override READ_ASCII 0x94 script //we read the offset from the file and set it as a variable PATCH_IF ~script = -None~ BEGIN //then we check it ... i am not entirely sure what the value is actually for None WRITE_ASCII 0x94 ~AR3300~ #8 //writes the script name (same as area name, always) END EXTEND ...
Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit).
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.
#10
Posted 16 February 2017 - 09:24 PM
My Own: Ajantis BG1 Expansion Modification -- Sir Ajantis for BGII -- Ajantis Portrait Pack -- Another fine Hell -- Brage's Redemption -- BGQE at Gibberlings 3 / BGQE at Kerzenburgforum -- Brandock the Mage -- Endless BG1 -- Grey The Dog NPC -- Imoen 4 Ever -- Imoen Is Stone -- Jastey's SoD TweakPack -- Road to Discovery (SoD) -- Solaufein's Rescue - jastey's Solaufein NPC Mod -- The Boareskyr Bridge Scene (SoD)
Contributions: Adalon's Blood (Silberdrachenblutmod) -- Alternatives -- Ascalon's Questpack -- Ascalon's Breagar NPC -- Balduran's Seatower -- BG1 NPC Project -- BG1 Romantic Encounters -- Corthala Romantique -- Edwin Romance -- Fading Promises -- Gavin BG1 --Hidden Adventures -- Imoen Can Die -- Keldorn Romance (berelinde's) -- Lure of Sirine's Call -- NTotSC -- Romantic Encounters (BGII)
Avatar by Rabain
#11
Posted 16 February 2017 - 11:07 PM
True, it's with the assumption that we are talking about bgee, where the Area names is equal to the area script names. Don't tell me there is an exception to this rule? (For Tutu, this doesn't work this way).In BG2EE, there's a few .are files that have no assigned scripts in them. The Near Infinity shows them as None, but the .are files bit representation shows them as big ". . . ." in them. So there's nothing assigned in them.
Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit).
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.
#12
Posted 17 February 2017 - 01:10 AM
Nothing is not what I'm afraid of, what I meant would be a working script with an unusual name. The whole thread is about what to do if no script is assigned, so no worries there.
My Own: Ajantis BG1 Expansion Modification -- Sir Ajantis for BGII -- Ajantis Portrait Pack -- Another fine Hell -- Brage's Redemption -- BGQE at Gibberlings 3 / BGQE at Kerzenburgforum -- Brandock the Mage -- Endless BG1 -- Grey The Dog NPC -- Imoen 4 Ever -- Imoen Is Stone -- Jastey's SoD TweakPack -- Road to Discovery (SoD) -- Solaufein's Rescue - jastey's Solaufein NPC Mod -- The Boareskyr Bridge Scene (SoD)
Contributions: Adalon's Blood (Silberdrachenblutmod) -- Alternatives -- Ascalon's Questpack -- Ascalon's Breagar NPC -- Balduran's Seatower -- BG1 NPC Project -- BG1 Romantic Encounters -- Corthala Romantique -- Edwin Romance -- Fading Promises -- Gavin BG1 --Hidden Adventures -- Imoen Can Die -- Keldorn Romance (berelinde's) -- Lure of Sirine's Call -- NTotSC -- Romantic Encounters (BGII)
Avatar by Rabain
#13
Posted 17 February 2017 - 05:00 AM
Well, if you could explain the script step-by-step, I'd appreciate it, if it's not too much trouble. Let me see if I fill out the blanks correctly for area AR0133, which is the top floor of the Low Lantern tavern. Talking about BG:EE now, I decided to make mods only for that engine, because it's state-of-the-art. That area has no script naturally, and I'd like to add a couple of things to it. Let's see...
DEFINE_ACTION_FUNCTION extend_area_script STR_VAR area="" top="" bottom="" BEGIN // find the area script from the area file COPY_EXISTING "%AR0133%.are" override READ_ASCII 0x94 script BUT_ONLY // if it doesn't exist, give it a default name ACTION_IF "%script%" STRING_EQUAL "" BEGIN OUTER_INNER_PATCH_SAVE script "%AR0133%" BEGIN REPLACE_TEXTUALLY "FW" "_AR" // TUTU naming conventions END // added by argent77: assign area script if needed COPY_EXISTING "%AR0133%.are" override WRITE_ASCIIE 0x94 ~%script%~ #8 END // extend the script ACTION_IF "%top%" STRING_COMPARE "" BEGIN EXTEND_TOP "%AR0133%.bcs" "%top%" EVALUATE_BUFFER END ACTION_IF "%bottom%" STRING_COMPARE "" BEGIN EXTEND_BOTTOM "%AR0133%.bcs" "%bottom%" EVALUATE_BUFFER END END
Is this right?
#14
Posted 17 February 2017 - 05:41 AM
True, it's with the assumption that we are talking about bgee, where the Area names is equal to the area script names. Don't tell me there is an exception to this rule? (For Tutu, this doesn't work this way).
Edited by Roxanne, 18 February 2017 - 12:27 AM.
#15
Posted 17 February 2017 - 06:40 AM
Well, if you could explain the script step-by-step, I'd appreciate it, if it's not too much trouble. Let me see if I fill out the blanks correctly for area AR0133, which is the top floor of the Low Lantern tavern. Talking about BG:EE now, I decided to make mods only for that engine, because it's state-of-the-art. That area has no script naturally, and I'd like to add a couple of things to it. Let's see...
DEFINE_ACTION_FUNCTION extend_area_script STR_VAR area="" top="" bottom="" BEGIN // find the area script from the area file COPY_EXISTING "%AR0133%.are" override READ_ASCII 0x94 script BUT_ONLY // if it doesn't exist, give it a default name ACTION_IF "%script%" STRING_EQUAL "" BEGIN OUTER_INNER_PATCH_SAVE script "%AR0133%" BEGIN REPLACE_TEXTUALLY "FW" "_AR" // TUTU naming conventions END // added by argent77: assign area script if needed COPY_EXISTING "%AR0133%.are" override WRITE_ASCIIE 0x94 ~%script%~ #8 END // extend the script ACTION_IF "%top%" STRING_COMPARE "" BEGIN EXTEND_TOP "%AR0133%.bcs" "%top%" EVALUATE_BUFFER END ACTION_IF "%bottom%" STRING_COMPARE "" BEGIN EXTEND_BOTTOM "%AR0133%.bcs" "%bottom%" EVALUATE_BUFFER END END
Is this right?
No, you did put the area name into the definition of the function. Don't do that, but use the defintion unchanged. Look at my above post again. First you put the definition of the function into your tp2. Then you call it by:
LAF extend_area_script STR_VAR area="%BaldursGate_DocksLowLantern_D1%" bottom="modfolder/script/area_patch.baf" END
with 'modfolder/script/area_patch.baf' being the path to your baf file with the script blocks you want to patch to the area script.
Roxanne:
You do not need to worry as every xxxx.are file has the script xxxx.bcs associated with it already defined.
That is not true. In my SoD game, area "NWBaldursGate_Helm&Cloak_L1" "AR0116" doesn't have a script assigned, for example.
Also: "BaldursGate_DocksLowLantern_D1" "AR0133" (which is, incidentally, the one OP wants to patch to)
Edited by jastey, 17 February 2017 - 06:43 AM.
My Own: Ajantis BG1 Expansion Modification -- Sir Ajantis for BGII -- Ajantis Portrait Pack -- Another fine Hell -- Brage's Redemption -- BGQE at Gibberlings 3 / BGQE at Kerzenburgforum -- Brandock the Mage -- Endless BG1 -- Grey The Dog NPC -- Imoen 4 Ever -- Imoen Is Stone -- Jastey's SoD TweakPack -- Road to Discovery (SoD) -- Solaufein's Rescue - jastey's Solaufein NPC Mod -- The Boareskyr Bridge Scene (SoD)
Contributions: Adalon's Blood (Silberdrachenblutmod) -- Alternatives -- Ascalon's Questpack -- Ascalon's Breagar NPC -- Balduran's Seatower -- BG1 NPC Project -- BG1 Romantic Encounters -- Corthala Romantique -- Edwin Romance -- Fading Promises -- Gavin BG1 --Hidden Adventures -- Imoen Can Die -- Keldorn Romance (berelinde's) -- Lure of Sirine's Call -- NTotSC -- Romantic Encounters (BGII)
Avatar by Rabain
#16
Posted 21 February 2017 - 10:31 AM
So just fill out those quotes and nothing else? Well, that's great if so! Thank you.
This makes me think that anyone running BGEE could benefit from a mod that did this for all areas in the game. Existing scripts would remain and "empty" areas would all get blank scripts. Subsequent modders could then just include their BAFs + EXTEND in their mods without having to know this bit of code, worrying about area scripts or writing in the areas they change. A baseline mod like that could improve compatibility. Heck, I'm going to write to Beamdog and suggest they give every area a script.