Jump to content

BGII area file with different area script label


plainab

Recommended Posts

Okay, I'm working on a npc mod. Everything is fine up until the concluding part of her initial quests. I've ran into an issue where at first I thought a certain weidu command didn't do as I thought it would, but now I've found out that the problem was that the area I wish to use has a script file label that does not match.

 

AR0021.are has assigned AR0004.bcs as the area script.

I need to add a block for a creature to spawn in area AR0021. There is no AR0004.bcs anywhere in the game system. Should I modify the area file to point to my new script AR0021.bcs OR should I rename my script to AR0004.bcs?

 

I'm not sure how most coders would handle this. I think that the reference in the area file should be changed, but I don't want to cause too much inconsistency with other mods. I've heard that over at BWL they don't see something like this as 'broken' and would use the non-matching script. But what if AR0004.bcs happend to be made with another mod for a different area (specifically AR0004.are of which there is none but still)? Two areas would then have the same script which could be bad and lead to game crashes.

 

While I like maximum mod compatibility, I also prefer to maintain compatibility with the BG2Fixpack here at G3. So what would be the prefered method? Speak up Gibberlings, speak up!

 

As an FYI AR0021.are is the Crooked Crane and part of it I think gets restored with UB or another mod. Also when I open the are file with DLTCEP I get a message about not being able to open the wed file.

 

Current build is:

SOA

TOB

Bioware Patch

BG2FixPack

-- Core

-- GTU

-- Happy Modder

DungeonBeGone -- Only so I don't have to keep going through it to test my mod.

Solestia -- My npc mod I'm working on.

 

Later I have to add Kivan because he and Solestia happen to deal with the same npc and I need to make sure there is no problem....

 

 

EDIT: I decided to answer myself. I looked at UB to see if they are the ones that restore the Crooked Crane. They are. Since I want to be compatible with UB, I'm going to follow their pattern and change the area script reference to match the area file.

Thanks for listening to me ramble anyway....

Link to comment
Well, VSBM are going to start a flame war if you take this route. TOD appends to both ar0004.bcs and ar0021.bcs to be compatible both with mods that don't "alter the interface" and mods who do.
VSBM? TOD? never heard of those abbreviations. I thought about appending to both, but UB didn't. I would have thought that UB would have covered their bases for various installs...
Link to comment

I figured out what ToD stands for. I didn't look to see how they dealt with it, but read that it creates area scripts with both filenames. So their stuff gets called even if ub changes the area script file reference. So along those lines, I'll just do this and I think it should be safe.

EXTEND_TOP ~ar0021.bcs~ ~ab_mods/solestia/baf/ar0021.baf~
EXTEND_TOP ~ar0004.bcs~ ~ab_mods/solestia/baf/ar0021.baf~

It should be okay extending to the top since it's just a create creature block with a continue.

Link to comment
Just read the script assigned to the area form the ARE and append to that.
I thought of that, but if my mod was installed prior to UB then my mod would become broken as they change the area script reference, but don't check to see if there is an actual script present by that name. They assume that there isn't because that reference is wrong.

 

There would be no problem if UB did the following:

////////////////////////////////
////////////////////////////////
// Restored Crooked Crane Inn //
////////////////////////////////
////////////////////////////////

BEGIN @28

COPY ~ub/ubnull.itm~ ~override/ubcrane.xxx~ //null file to identify this component

COPY_EXISTING ~ar0021.are~ ~override/ar0021.are~
READ_ASCII   ~0x94~	   ~area_script~

ACTION_IF (FILE_EXISTS_IN_GAME ~%area_script%.bcs~) THEN BEGIN
COPY_EXISTING ~%area_script%.bcs~ ~override/ar0021.bcs~
END

COPY_EXISTING ~ar0021.are~ ~override/ar0021.are~
WRITE_ASCII   ~0x94~	   ~ar0021~

COMPILE ~ub/crane/u!ccrane.d~
USING   ~ub/tra/%s/ubdialog.tra~

EXTEND_BOTTOM ~ar0022.bcs~ ~ub/crane/u!0022.baf~  /* Crooked Crane, Level Two */
EXTEND_TOP	~AR0021.bcs~ ~ub/crane/AR0021.BAF~

Then everybody else can just do something like the following in their mods and be done with it.

COPY_EXISTING ~ar0021.are~ ~override/ar0021.are~
READ_ASCII   ~0x94~	   ~area_script~

EXTEND_BOTTOM ~myareascript.baf~ ~override/%area_script%.bcs~

Link to comment

I do it like this:

 

	COPY_EXISTING ~ar0021.are~ ~override~
	READ_ASCII 0x94 ~areascript~
	PATCH_IF ~%areascript%~ STRING_EQUAL_CASE ~~ OR ~%areascript%~ STRING_EQUAL_CASE ~None~ THEN BEGIN
		WRITE_EVALUATED_ASCII 0x94 ~ar0021~
		 SPRINT ~areascript~ ~ar0021~
	END
BUT_ONLY_IF_IT_CHANGES

ACTION_IF !FILE_EXISTS_IN_GAME ~%areascript%.bcs~ THEN BEGIN
	COMPILE ~scsii/mage/scripts/ar0021.baf~
END ELSE BEGIN
	EXTEND_BOTTOM ~%areascript%.bcs~ ~scsii/mage/scripts/ar0021.baf~
END

 

This does rely on my mod being installed after anything (e.g. UB) that makes a less compatibility-friendly pick, but that's generally true for any compatibility issue: there are more and less compatibility-friendly mods, and the more friendly ones need to be installed after the less friendly ones.

 

EDIT: come to think of it, if you really want to be fancy, define this macro:

DEFINE_ACTION_MACRO ~patch_area_script~
///
/// Takes as input %areafile% and %scriptadd%. The former is the area you want to patch (without the .are suffix), the latter is the 
/// path to your extra file (without .baf suffix).
///
///

 COPY_EXISTING ~%areafile%.are~ ~override~
	  READ_ASCII 0x94 ~areascript~
	  READ_ASCII 0x94 ~prefix~ (2)
	  PATCH_IF ~%areascript%~ STRING_EQUAL_CASE ~~ OR ~%areascript%~ STRING_EQUAL_CASE ~None~ THEN BEGIN
			 PATCH_IF ~%prefix%~ STRING_EQUAL_CASE ~FW~ THEN BEGIN // this is TUTU
				   READ_ASCII 0x96 ~suffix~ (6)
				   SPRINT ~areascript~ ~_ar~^~%suffix%~
			 END ELSE BEGIN
				   SPRINT ~areascript~ ~%areafile%~
			 END
			 WRITE_EVALUATED_ASCII 0x94 ~%areascript%~
	END
 BUT_ONLY_IF_IT_CHANGES

ACTION_IF !FILE_EXISTS_IN_GAME ~%areascript%.bcs~ THEN BEGIN
	COMPILE ~%scriptadd%.baf~
	COPY_EXISTING ~%scriptadd%.bcs~ ~override/%areascript%.bcs~
END ELSE BEGIN
	EXTEND_BOTTOM ~%areascript%.bcs~ ~%scriptadd%.baf~
END
END

 

Then just do

 

OUTER_SPRINT ~areascript~ ~ar0021~
OUTER_SPRINT ~scriptadd~ ~scsii/mage/scripts/ar0021add~
LAUNCH_ACTION_MACRO ~patch_area_script~

Link to comment
VSBM = "ezagnooM/suinoraB/terkiS/dalV".reverse().
ROFL. When seeing it the first time I stopped trying to understand since it looks like real complicated code.

Yes, it actually is some new code. Look for it in WeiDu v2010. If the Bigg updates weidu that much.... :)
Link to comment

Archived

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

×
×
  • Create New...