Jump to content


Photo

LolFixer Thread


  • Please log in to reply
355 replies to this topic

#1 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 07 November 2011 - 02:17 AM

LOLFIXER NOW ACTUALLY WORKS! :D

Ok, so I've always looked up to the awesome fixer mods in the BWP (Crefixer, Res_fixer, BP's Innate Spell fixer etc Posted Image) and wanted to create some sort of similar fixer mod for the thousands of DLTCEP errors being reported in a BWP game (thanks to krimine for raising that topic last week Posted Image)

So anyway, I've been busy Posted Image - GitHub Project Page

It clears most of the stuff reported by the G3Debugging suite Posted Image and may actually prevent a few crashes and stuff if using the right components Posted Image

Thanks to Turambar for helping pinpoint where the item swapping code was borking! :coolthumb: You da man! Posted Image
Thanks to aVENGER, Sasha Al'Therin and Wisp for their inputs
And awesome thanks to krimine for volunteering to be the guinea pig Posted Image You've been awesome mate!

How to use?

1. To run in DEBUG MODE: Run setup-lolfixer_ONLY_DEBUG_MODE.bat, you'll get 2 debug logs (lolfixer.log & uninstall_lolfixer.log)
2. To run in NORMAL MODE: Run setup-lolfixer.exe and choose what components to install :cheers:

IMPORTANT NOTE! If you're using BPv180 in your install, make sure you download and extract SENDRO03.CRE from the attachment here and put it into your override folder before running anything! Otherwise, your lolfixer will loop INFINITELY :ph34r:

What exactly is the difference between DEBUG and NORMAL modes?

DEBUG mode does NOT make any changes to your game, only reports the stuff it finds in the log files :D It first installs every component (logging the process into lolfixer.log) and then uninstalls everything (logging to uninstall_lolfixer.log)
NORMAL mode is well... normal :ph34r: As in the normal way a mod is installed.


Download latest package here

Edited by Lollorian, 16 October 2012 - 01:57 AM.

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#2 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 07 November 2011 - 02:42 AM

Converts BGI proficiencies into (seemingly imho) equivalent BGII proficiencies :D (G3DS again) This isn't a really good choice of BGI -> BGII conversions


I'd strongly advise against doing this.

BG1 proficiencies work perfectly fine in the BG2 engine and many creatures use them to good effect. OTOH, if you convert them to their BG2 counterparts you'll likely run into issues. I.e. let's say you decide to convert BG1's Large Sword proficiency into BG2's 2-Handed Sword proficiency but the creature in question is actually wielding a Bastard Sword. Now you have a creature that is not proficient with the weapon it's wielding. To put bluntly, if it ain't broke... don't fix it.

#3 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 07 November 2011 - 05:26 AM

OTOH, if you convert them to their BG2 counterparts you'll likely run into issues. I.e. let's say you decide to convert BG1's Large Sword proficiency into BG2's 2-Handed Sword proficiency but the creature in question is actually wielding a Bastard Sword. Now you have a creature that is not proficient with the weapon it's wielding.

Ah yes :D I'll leave that then :P

BG1 proficiencies work perfectly fine in the BG2 engine and many creatures use them to good effect.

But the IESDP seems to suggest otherwise :o (I have a local backup though... dunno if it was updated or something :P)

Uploaded a somewhat better .tp2 btw :P It still borks but goes further in the item swapping component :coolthumb: The error I got is:
OBSICE11.CRE: Invalid Lring: trolldie.itm! Moving to inventory
[./override/TROLLDIE.itm] loaded, 354 bytes
[./override/TROLLDIE.itm] loaded, 354 bytes
[./override/TROLLDIE.itm] loaded, 354 bytes
[./override/TROLLDIE.itm] loaded, 354 bytes

OBSICE11.CRE: Invalid weapon3: TROLLDIE.itm! Moving to inventory
ERROR: illegal 2-byte read from offset 1556 of 1556-byte file OBSICE11.CRE
ERROR: [OBSICE11.CRE] -> [override/OBSICE11.CRE] Patching Failed (COPY) (Failure("OBSICE11.CRE: read out of bounds"))
Stopping installation because of error.

ERROR Installing [Creature Fixer], rolling back to previous state
Unable to Unlink [lolfixer/backup/1/OTHER.1]: Unix.Unix_error(1, "unlink", "lolfixer/backup/1/OTHER.1")
[lolfixer/backup/1/UNSETSTR.1] SET_STRING uninstall info not found

Edited by Lollorian, 07 November 2011 - 05:28 AM.

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#4 Turambar

Turambar
  • Modder
  • 935 posts

Posted 07 November 2011 - 06:32 AM

Ok, so I've always looked up to the awesome fixer mods in the BWP (Crefixer, Res_fixer, BP's Innate Spell fixer etc :P) and wanted to create some sort of similar fixer mod for the thousands of DLTCEP errors being reported in a BWP game (thanks to krimine for raising that topic last week :D)

So anyway, I've been busy :P

The attached .tp2 fixes most of the stuff reported by the G3Debugging suite (thanks to cmorgan for the emergency mirror :D)... For now, it has only 2 components - ARE fixing and CRE fixing :P I do plan to include SPLs and ITMs too...

What it does :D

  • AREs
    • Undetectable, undisarmable traps without a script have their flags removed (as per the BG2Fixpack's Super Happy Modder pack :lol:)
    • Fixes borked map note offsets (again the BG2Fixpack here :D)
    • Assigns an area script that's already present in the game to all areas (if they don't have one ;)) (this is from the G3Debugger... checks for matching names - so AR8383.ARE will get AR8383.bcs ONLY if the .bcs is present :P)

I don't understand... if there is ar8383.are but not ar8383.bcs, what will your mod write into the AREA_SCRIPT slot of the .are file?
I'd suggest that all areas have a script [areaname] assigned, so that you can just add new scripts by EXTEND_BOTTOM areaname.bcs, without having to check whether the script already exists or not and so on

    • Locks doors that need keys but are unlocked (G3DS... getting tired now :ermm:)
    • Makes doors that need keys unpickable (G3DS)
  • CREs
    • Transfers any item that occupies the wrong slot on a CRE into the inventory (G3DS)

I'm not so sure of that; usually, that's for special items such as min1hp and special rings, which are only needed to fix the immunities and so on of creatures. That creates no problems if they are in the wrong place, but could break the game if they are not equipped when they should, because for instance the next component doesn't find place for them. Moreover, since all effects are applied in a hardcoded order, moving an item from a slot to another one could also break the game.

    • Following the above, it checks if any item can be equipped by the CRE in a free slot :D (G3DS)
  • ITMs
  • SPLs

I've run a few tests and can't for figure out what's actually freaking the CRE component's item moving code :( On a BGII-ToB install with this WeiDU.log, it always seems to bork if uncommented out :crying:

Spoiler


So, things I wanna know:
1) Try removing the comments in line 164 & 450 so see real borkage :D
2) Need some better opinions on the BGI proficiency conversions :P

Thanks for any replies in advance :cheers:

Concerning the error in your last post, it's probably from line 132 of the .tp2 you attached, since it's the only READ_SHORT performed on the .cre file.
Could that creature be corrupted? It's not a vanilla creature

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


#5 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 07 November 2011 - 07:36 AM

I don't understand... if there is ar8383.are but not ar8383.bcs, what will your mod write into the AREA_SCRIPT slot of the .are file?
I'd suggest that all areas have a script [areaname] assigned, so that you can just add new scripts by EXTEND_BOTTOM areaname.bcs, without having to check whether the script already exists or not and so on

If the corresponding script file doesn't exist, lolfixer simply ignores it ;) The Haiass mod assigns every area a script already so I didn't wanna duplicate the code here :P (can blank scripts be compiled though? :unsure:)

The lolfixer is supposed to supplement the other XXXFixers - not replace them :lol:

I'm not so sure of that; usually, that's for special items such as min1hp and special rings, which are only needed to fix the immunities and so on of creatures. That creates no problems if they are in the wrong place, but could break the game if they are not equipped when they should, because for instance the next component doesn't find place for them. Moreover, since all effects are applied in a hardcoded order, moving an item from a slot to another one could also break the game.

Absolutely awesome catch :D I've uploaded a new version that takes care of that (for unmodded BGII-ToB special rings only though :P)

Concerning the error in your last post, it's probably from line 132 of the .tp2 you attached, since it's the only READ_SHORT performed on the .cre file.
Could that creature be corrupted? It's not a vanilla creature

And thank you for this! :Bow: Found similar code in the BG2Fixpack and creature item swapping now works as intended! :coolthumb:

Edited by Lollorian, 07 November 2011 - 07:47 AM.

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#6 i30817

i30817
  • Member
  • 611 posts

Posted 07 November 2011 - 08:39 AM

There is no point in doing a fix mod like this if it depends on the others even in areas it affects.

IMO, that's asking for bugs. I've never even used the Haiass mod, and i'm sure i'm not the only one.

Who could tell that a dog companion mod fixed areas? Please, put fixes in a dedicated mod and REQUIRE it if you depend on the fixes.

Things like this should IMO, go early, and then do a general scan of all mods to find ones the fuxor the fix (like replacing the area bcs instead of appending to it).

Or less complete, go last and fix what it cans, and leave the rest alone and hope for the best...

Edited by i30817, 07 November 2011 - 08:45 AM.


#7 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 07 November 2011 - 09:41 AM

fyi - many of the 'issues' reported by the debugging suite and/or dltcep and the like do not actually cause issues within game.

Granted you may find some actual errors that do need to be fixed, but on the whole many can just be ignored. This is precisely why as you've noted a number of these things that you ran across are in the 'modder' component of the BG2 fixpack and not in the actual core components. They are placed there so that modders are no longer beset with a list of errors and pop up boxes of missing files each time they open dltcep.

Something I've learned from trying to work on a comprehensive BG1 fixpack is that rather than spending time fixing what is reported as 'broken' by external programs (dltcep, NI and the like), to just play the game and compare that behavior to how the file(s) in question appear that they should behave when examining them via external programs.

So use the debugging suite and error reporting features of other programs to point you in a direction of files to examine in game, but don't just blindly 'fix' cause something gets flagged. Even with the best of intentions good things get mistakenly flagged as bad.

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-altheri...s.com/index.htm


#8 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 07 November 2011 - 11:28 AM

Discussion about things is awesome yeah? :D

Who could tell that a dog companion mod fixed areas?

I think I understand where you're coming from so yeah it might be a good idea to add in that bit of code too :P

PS: Haiass was just an example though ;) Lots of mods actually add missing area scripts - BG2Tweaks for one :lol:

So use the debugging suite and error reporting features of other programs to point you in a direction of files to examine in game, but don't just blindly 'fix' cause something gets flagged. Even with the best of intentions good things get mistakenly flagged as bad.

Exactly my thoughts :cheers: Although IMHO, some stuff that the logger mods/tools (can I can em that? :ermm:) are seemingly obviously fixable by logical processing :)

Some examples: (from G3 Debugging suite logs)
AR0302.ARE error: Map Notes offset is incorrect
Looked like something that needed to be fixed :P and the Super Happy modder pack has some good global code to fix this :D

AR0401.ARE error: Area Script exists but is unassigned (AR0401.bcs)
Oversight? Probably :P But a global patch helps in these cases :D

BH3B3.SPL warning: Innate spells should be spell level one
Seemingly an obvious fix because BP's (Big Picture) author felt the need to create the Innate Fixer specially for these kinds of errors :P

BHAAL3A.SPL: Ability #0 has a permanent effect with non-zero duration (effect #3, opcode 267)
Again... unless permanent effects would somehow need to apply their effects over time... seemed like an obvious fix :lol:

AR0329.ARE error: Door #0 requires key (KEY13.itm) but the lock can be picked
And this one :D Things like this can be problematic though... I can think of a situation where the modder kept the door pickable because the mod doesn't provide a key (even though it might contain the KEY.ITM ;)) So this probably shouldn't be a part of this fixer :D

Now things like:
BELT07.ITM error: Ability #0 is extraneous Default(0) type
FINMEL01.ITM error: Ground Icon does not exist (0.bam)
AATAQAH.CRE: Gender and Sex do not match
... go way over my head/can't be fixed by global patching :D So I leave them out :) (until someone graciously provides help :P)

Like I said before, I NEED advice from the experts (and probably everyone else :P) to get this right so bash me as much as possible :woot:

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#9 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 07 November 2011 - 12:07 PM

the Super Happy modder pack has some good global code

You should keep in mind both the modder pack and the debugging suite were written many years ago and deal with many issues that have since been thoroughly debunked. Unless you can think of a reason [1] for why you should make a change, you probably should not be making it.

BHAAL3A.SPL: Ability #0 has a permanent effect with non-zero duration (effect #3, opcode 267)
Again... unless permanent effects would somehow need to apply their effects over time... seemed like an obvious fix :lol:

I am pretty sure permanent timing modes ignore the duration field altogether, making this a "fix" for a complete non-issue.


1. And as Sasha said, pleasuring some modder tool is not a good reason.

Edited by Wisp, 07 November 2011 - 12:09 PM.


#10 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 08 November 2011 - 04:33 AM

You should keep in mind both the modder pack and the debugging suite were written many years ago and deal with many issues that have since been thoroughly debunked.

I really didn't know that :o I gave this a lot of thought and decided to componentize the entire mod :D

~LOLFIXER.TP2~ #0 #0 // Script Assigner (assigns missing/unassigned scripts to areas): v0.0000000001a
~LOLFIXER.TP2~ #0 #1 // Trap Unflagger (remove trap flag if trap is undetectable, undisarmable and has no script): v0.0000000001a
~LOLFIXER.TP2~ #0 #2 // Map Note Offset Fixer (fixes incorrect map note offsets): v0.0000000001a
~LOLFIXER.TP2~ #0 #3 // Door Unpicker (makes doors that need keys but were pickable - unpickable): v0.0000000001a
~LOLFIXER.TP2~ #0 #4 // Door Locker (locks doors that need keys but were unlocked): v0.0000000001a
~LOLFIXER.TP2~ #0 #5 // Creature Resource Fixer (res_fixer for ALL CREATURES): v0.0000000001a
~LOLFIXER.TP2~ #0 #6 // BG Proficiency Nuller (sets any BG proficiencies to 0): v0.0000000001a
~LOLFIXER.TP2~ #0 #7 // Inventory Overhauler (moves invalid equippable items to inventory and equips anything in the inventory to a free slot): v0.0000000001a
~LOLFIXER.TP2~ #0 #8 // Item Resource Fixer (res_fixer for ALL ITEMS): v0.0000000001a
~LOLFIXER.TP2~ #0 #9 // Permanent Effect Duration Nuller (sets duration for permanent effects to 0): v0.0000000001a
~LOLFIXER.TP2~ #0 #10 // Equipped Effect Targetter (makes any items that don't target self on equip, target self): v0.0000000001a
~LOLFIXER.TP2~ #0 #11 // Equipped Effect Activator (makes any equipped effects that didn't activate on equip now activate): v0.0000000001a
~LOLFIXER.TP2~ #0 #12 // Equipped Effect Undispeller (makes any dispellable equipped effects undispellable): v0.0000000001a
~LOLFIXER.TP2~ #0 #13 // Equipped Item 100% Probability Check (makes equipped effects that don't have a 100% probability of happening always activate): v0.0000000001a
~LOLFIXER.TP2~ #0 #14 // Spell Resource Fixer (res_fixer for ALL THE SPELLS): v0.0000000001a
~LOLFIXER.TP2~ #0 #15 // Permanent Effect Duration Nuller (sets duration for permanent effects to 0): v0.0000000001a
Nifty yeah? :P I'm really proud of what component #7 does :lol:

I am pretty sure permanent timing modes ignore the duration field altogether, making this a "fix" for a complete non-issue.

Noted :D But a corollary would mean that nulling them won't have any effect other than making the logger stuff shut up :coolthumb:

And as Sasha said, pleasuring some modder tool is not a good reason.

:ROFL: Don't mind if I use this as a description for this mod's project page, would you? :D Adding a better download link to the OP now...

Now that it's fully compartmentalized, adding and deprecating shitty components should be easy :cheers: Some components like the res_fixer stuff and the script assigner are useful i guess :P

EDIT: Also added a new 'Missing Ambient Nuller component' :D

Edited by Lollorian, 08 November 2011 - 06:13 AM.

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#11 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 08 November 2011 - 06:59 AM

~LOLFIXER.TP2~ #0 #6 // BG Proficiency Nuller (sets any BG proficiencies to 0): v0.0000000001a


As noted earlier, BG1 proficiencies work fine and are actually used in-game. The IEDSP is outdated in this regard.

Removing them will only break things and that cannot possibly qualify as a fix.

#12 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 08 November 2011 - 07:18 AM

Ah awesome :D Component deprecated! Thanks :P

Current components
~LOLFIXER.TP2~ #0 #0 // Area Stuff - Script Assigner (assigns missing/unassigned scripts to areas): v0.0000000001a
~LOLFIXER.TP2~ #0 #1 // Area Stuff - Trap Unflagger (remove trap flag if trap is undetectable, undisarmable and has no script): v0.0000000001a
~LOLFIXER.TP2~ #0 #2 // Area Stuff - Map Note Offset Fixer (fixes incorrect map note offsets): v0.0000000001a
~LOLFIXER.TP2~ #0 #3 // Area Stuff - Missing Ambient Remover (removes ambients that don't have their WAV present): v0.0000000001a
~LOLFIXER.TP2~ #0 #4 // Area Stuff - Door Unpicker (makes doors that need keys but were pickable - unpickable): v0.0000000001a
~LOLFIXER.TP2~ #0 #5 // Area Stuff - Door Locker (locks doors that need keys but were unlocked): v0.0000000001a
~LOLFIXER.TP2~ #0 #6 // Creature Stuff - Creature Resource Fixer (res_fixer for ALL CREATURES): v0.0000000001a
~LOLFIXER.TP2~ #0 #7 // Creature Stuff - Inventory Overhauler (moves invalid equippable items to inventory and equips anything in the inventory to a free slot): v0.0000000001a
~LOLFIXER.TP2~ #0 #8 // Item Stuff - Item Resource Fixer (res_fixer for ALL ITEMS): v0.0000000001a
~LOLFIXER.TP2~ #0 #9 // Item Stuff - Permanent Effect Duration Nuller (sets duration for permanent effects to 0): v0.0000000001a
~LOLFIXER.TP2~ #0 #10 // Item Stuff - Equipped Effect Targetter (makes any items that don't target self on equip, target self): v0.0000000001a
~LOLFIXER.TP2~ #0 #11 // Item Stuff - Equipped Effect Activator (makes any equipped effects that didn't activate on equip now activate): v0.0000000001a
~LOLFIXER.TP2~ #0 #12 // Item Stuff - Equipped Effect Undispeller (makes any dispellable equipped effects undispellable): v0.0000000001a
~LOLFIXER.TP2~ #0 #13 // Item Stuff - Equipped Item 100% Probability Check (makes equipped effects that don't have a 100% probability of happening always activate): v0.0000000001a
~LOLFIXER.TP2~ #0 #14 // Spell Stuff - Spell Resource Fixer (res_fixer for ALL THE SPELLS): v0.0000000001a
~LOLFIXER.TP2~ #0 #15 // Spell Stuff - Permanent Effect Duration Nuller (sets duration for permanent effects to 0): v0.0000000001a
... missing actors removal next :D

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#13 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 08 November 2011 - 06:42 PM

Ok, added 3 components that might be of interest :D

Missing Ambient Remover (the megamod FAQ mentions that missing ambients may cause stuttering :unsure:)
BEGIN ~Area Stuff - Missing Ambient Remover (removes ambients that don't have their WAV present)~
  GROUP ~Area Stuff~

// ensures area regexp search doesn't die
COPY_EXISTING ~ar0087.are~ ~override/xr2400.are~
              ~ar0087.are~ ~override/xr2600.are~

COPY_EXISTING_REGEXP GLOB ~^.+\.are$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x28f) THEN BEGIN
    READ_SHORT 0x82 "amb_num"
    READ_LONG  0x84 "amb_off"

    FOR (index = 0 ; index < amb_num ; index = index + 1) BEGIN
      FOR (index2 = 0 ; index2 < 10 ; index2 = index2 + 1) BEGIN
        READ_ASCII ("%amb_off%" + 0x30 + ("%index2%" * 0x08) + (0xd4 * "%index%")) "resref"
        PATCH_IF NOT (("%resref%" STRING_EQUAL_CASE "") OR ("%resref%" STRING_EQUAL_CASE "none")) BEGIN
          SET "exists" = 0
          INNER_PATCH_FILE ~%resref%.wav~ BEGIN
            SET "exists" = 1
          END
          PATCH_IF ("%exists%" = 0) BEGIN
            PATCH_PRINT "%SOURCE_FILE% error: Ambient #%index% does not exist (%resref%.wav)! Nulling..."
            WRITE_ASCIIE ("%amb_off%" + 0x30 + ("%index2%" * 0x08) + (0xd4 * "%index%")) ~NONE~ #8
          END
        END
      END
    END
  END
BUT_ONLY_IF_IT_CHANGES

Missing Actor Remover (if I remember right, missing actors crash the area on loading)
BEGIN ~Area Stuff - Missing Actor Remover (removes actors that don't have their CRE present)~
  GROUP ~Area Stuff~

// ensures area regexp search doesn't die
COPY_EXISTING ~ar0087.are~ ~override/xr2400.are~
              ~ar0087.are~ ~override/xr2600.are~

COPY_EXISTING_REGEXP GLOB ~^.+\.are$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x28f) THEN BEGIN
    READ_LONG  0x54 "actor_off"
    READ_SHORT 0x58 "actor_num"

    FOR (index = 0 ; index < actor_num ; index = index + 1) BEGIN
      READ_ASCII ("%actor_off%" + 0x80 + (0x110 * "%index%")) "resref" // cre file
      PATCH_IF ("%resref%" STRING_COMPARE_REGEXP "^[Rr][Dd].+$") BEGIN // ignore creatures starting with RD
        SET "exists" = 0
        INNER_PATCH_FILE ~%resref%.cre~ BEGIN
          SET "exists" = 1
        END
        PATCH_IF ("%exists%" = 0) BEGIN
          PATCH_PRINT "%SOURCE_FILE% error: Actor #%index% does not exist (%resref%.cre)! Removing actor..."
          LPF fj_are_structure
            INT_VAR fj_delete_mode    = "%index%"
            STR_VAR fj_structure_type = actor
          END
          SET "index" = "index" - 1
          READ_SHORT 0x58 "actor_num"
        END
      END
    END
  END
BUT_ONLY_IF_IT_CHANGES

Missing Rest Spawn Actor Remover (methinks this crashes the game when resting in the area)
BEGIN ~Area Stuff - Missing Rest Spawn Remover (nulls rest spawn entries that don't have their CRE present)~
  GROUP ~Area Stuff~

// ensures area regexp search doesn't die
COPY_EXISTING ~ar0087.are~ ~override/xr2400.are~
              ~ar0087.are~ ~override/xr2600.are~

COPY_EXISTING_REGEXP GLOB ~^.+\.are$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x28f) THEN BEGIN
    READ_LONG  0xc0 "rest_off" ELSE 0

    FOR (index = 0 ; index < 10 ; index = index + 1) BEGIN
      READ_ASCII ("%rest_off%" + 0x48 + ("%index%" * 0x08)) "resref"
      PATCH_IF (("%resref%" STRING_COMPARE_CASE "") AND                  // ignore empty entries
                ("%resref%" STRING_COMPARE_CASE "none") AND              // ignore 'none'
                ("%resref%" STRING_COMPARE_REGEXP "^[Rr][Dd].+$")) BEGIN // ignore creatures starting with RD
        SET "exists" = 0
        INNER_PATCH_FILE ~%resref%.cre~ BEGIN
          SET "exists" = 1
        END
        PATCH_IF ("%exists%" = 0) BEGIN
          PATCH_PRINT "%SOURCE_FILE% error: Rest Spawn creature file does not exist (%resref%.cre)! Nulling..."
          WRITE_ASCII ("%rest_off%" + 0x48 + ("%index%" * 0x08)) "NONE" #8
          SET "none_count" = 0
          PATCH_PRINT "Counting spawning creatures..."
          FOR (index2 = 0 ; index2 < 10 ; index2 = index2 + 1) BEGIN
            READ_ASCII ("%rest_off%" + 0x48 + ("%index2%" * 0x08)) "resref2"
            PATCH_IF (("%resref2%" STRING_EQUAL_CASE "") OR ("%resref2%" STRING_EQUAL_CASE "none")) BEGIN
              SET "none_count" = "none_count" + 1
            END
          END
          READ_LONG ("%rest_off%" + 0x98 + ("%index%" * 0x08)) "spawncount"
          PATCH_IF (("%none_count%" = 10) AND ("%spawncount%" > 0)) BEGIN
            PATCH_PRINT "No creatures in Rest Spawn Entry! Setting number of creatures to 0..."
            WRITE_LONG ("%rest_off%" + 0x98 + ("%index%" * 0x08)) 0
          END
        END
      END
    END
  END
BUT_ONLY_IF_IT_CHANGES

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#14 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 08 November 2011 - 08:05 PM

// ensures area regexp search doesn't die
COPY_EXISTING ~ar0087.are~ ~override/xr2400.are~
              ~ar0087.are~ ~override/xr2600.are~
don't understand why you do that..

just change this
COPY_EXISTING_REGEXP GLOB ~^.+\.are$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x28f) THEN BEGIN
to this
COPY_EXISTING_REGEXP GLOB ~^.+\.are$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x28f) AND ( !(~%SOURCE_RES%~ STRING_EQUAL_CASE ~xr2400~) AND !(~%SOURCE_RES%~ STRING_EQUAL_CASE ~xr2600~) ) THEN BEGIN
should do the same trick... but whatever

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-altheri...s.com/index.htm


#15 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 09 November 2011 - 02:31 AM

should do the same trick

Mucho thanks :D I took that from BG2Tweaks :P BGII demo leftovers or something... :lol:

Anyway... optimized the Missing Rest Interruption Remover and added the Missing Spawn Remover :coolthumb:
BEGIN ~Area Stuff - Missing Spawn Remover (removes spawn entries that don't have their CRE present)~
  GROUP ~Area Stuff~

COPY_EXISTING_REGEXP GLOB ~^.+\.are$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x28f) AND ( !(~%SOURCE_RES%~ STRING_EQUAL_CASE ~xr2400~) AND !(~%SOURCE_RES%~ STRING_EQUAL_CASE ~xr2600~) ) THEN BEGIN
    READ_LONG  0x60 "spawn_off"
    READ_LONG  0x64 "spawn_num"
    FOR (index = 0 ; index < spawn_num ; index = index + 1) BEGIN
      FOR (index2 = 0 ; index2 < 10 ; index2 = index2 + 1) BEGIN
        READ_ASCII ("%spawn_off%" + 0x24 + ("%index2%" * 0x08) + ("%index%" * 0xc8)) "resref"
        PATCH_IF (("%resref%" STRING_COMPARE_CASE "") AND                  // ignore empty entries
                  ("%resref%" STRING_COMPARE_CASE "none") AND              // ignore 'none'
                  ("%resref%" STRING_COMPARE_REGEXP "^[Rr][Dd].+$")) BEGIN // ignore creatures starting with RD
          SET "exists" = 0
          INNER_PATCH_FILE ~%resref%.cre~ BEGIN
            SET "exists" = 1
          END
          PATCH_IF ("%exists%" = 0) BEGIN
            PATCH_PRINT "%SOURCE_FILE% error: Spawn Point #%index% creature file does not exist (%resref%.cre)! Nulling..."
            WRITE_ASCII ("%spawn_off%" + 0x24 + ("%index2%" * 0x08) + ("%index%" * 0xc8)) ~NONE~ #8
          END
        END
      END
      SET "none_count" = 0
      FOR (index2 = 0 ; index2 < 10 ; index2 = index2 + 1) BEGIN
        READ_ASCII ("%spawn_off%" + 0x24 + ("%index2%" * 0x08) + ("%index%" * 0xc8)) "resref"
        PATCH_IF (("%resref%" STRING_EQUAL_CASE "") OR ("%resref%" STRING_EQUAL_CASE "none")) BEGIN
          SET "none_count" = "none_count" + 1
        END
      END
      PATCH_IF ("%none_count%" = 10) BEGIN
        PATCH_PRINT "%SOURCE_FILE% error: Spawn Point #%index% has no creatures to spawn! Removing spawn entry..."
        LPF fj_are_structure
          INT_VAR fj_delete_mode    = "%index%"
          STR_VAR fj_structure_type = spawn
        END
        SET "index" = "index" - 1
        READ_LONG  0x64 "spawn_num"
      END
    END
  END
BUT_ONLY_IF_IT_CHANGES

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#16 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 09 November 2011 - 02:40 AM

COPY_EXISTING_REGEXP GLOB ~^.+\.are$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x28f) AND ( !(~%SOURCE_RES%~ STRING_EQUAL_CASE ~xr2400~) AND !(~%SOURCE_RES%~ STRING_EQUAL_CASE ~xr2600~) ) THEN BEGIN
should do the same trick... but whatever

Does not work. The problem is not that WeiDU tries to patch non-existent files, it is that they do not exist but WeiDU still tries to load them. If you want to C_E_R on .are you need to create the missing files or remove the references from the key file.

#17 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 09 November 2011 - 07:12 AM

Does not work. The problem is not that WeiDU tries to patch non-existent files, it is that they do not exist but WeiDU still tries to load them. If you want to C_E_R on .are you need to create the missing files or remove the references from the key file.

this would explain why in BG1 I can work around the unused broken files that in a blind patch will stall weidu, they exist but exist broken.


so these files (xr2400.are & xr2600.are) are in the chitin.key but the associated .bif does not exist? would probably be better to remove the key file references then, since that would solve the problem ONCE. I can foresee multiple mods doing this trick and at least one mod using those file names for some crazy reason... But key file modification is tricky at best, so instead of blindly copying over (which is almost always a bad idea after other mods) try this instead
ACTION_IF !(FILE_EXISTS ~override/xr2400.are~) THEN BEGIN
COPY_EXISTING ~ar0087.are~ ~override/xr2400.are~
END
ACTION_IF !(FILE_EXISTS ~override/xr2600.are~) THEN BEGIN
COPY_EXISTING ~ar0087.are~ ~override/xr2600.are~
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-altheri...s.com/index.htm


#18 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 09 November 2011 - 08:41 AM

ACTION_IF !(FILE_EXISTS ~override/xr2400.are~) THEN BEGIN
COPY_EXISTING ~ar0087.are~ ~override/xr2400.are~
END
ACTION_IF !(FILE_EXISTS ~override/xr2600.are~) THEN BEGIN
COPY_EXISTING ~ar0087.are~ ~override/xr2600.are~
END

Thank you both! :D Committed!

I also have this really interesting component :D krimine's been an awesome tester and some borkage investigation revealed that some creatures had item references in their slots that exceeded the bounds of the item table :ROFL:

So, introducing the Inventory Unborker :D
BEGIN ~Creature Stuff - Inventory Unborker (removes spurious references to the item table)~
  GROUP ~Creature Stuff~

COPY_EXISTING_REGEXP GLOB ~^.+\.cre$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x2d4) THEN BEGIN
    READ_LONG  0x2b8 "slot_off" ELSE 0
    READ_SHORT 0x2c0 "itm_num" ELSE 0

    FOR (index = 0 ; index < 36 ; index = index + 1) BEGIN
      READ_SHORT ("%slot_off%" + (0x02 * "%index%")) "ref" ELSE 0xffff
      PATCH_IF ("%ref%" != 0xffff) BEGIN
        PATCH_IF ((%ref% + 1) > %itm_num%) BEGIN
          PATCH_PRINT "%SOURCE_FILE% error: Inventory Item Slot #%index% refers to an item outside the Item Table! Setting to -1..."
          WRITE_SHORT ("%slot_off%" + (0x02 * "%index%")) 0xffff
        END
      END
    END
  END
BUT_ONLY_IF_IT_CHANGES
A taste of its output in krimine's BWPExpert install :cheers:
Spoiler

Mostly mod-added stuff... except at first glance - BOO.CRE :D - which gets overwritten by BGTNeJ's Boo Familiar component (it's amulet was supposed to reference some thrid item - but the CRE contains only 2 items :unsure:)

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#19 i30817

i30817
  • Member
  • 611 posts

Posted 09 November 2011 - 10:27 AM

But key file modification is tricky at best,,,


Not anymore. There is DISABLE_FROM_KEY now, though it is currently broken.

//test areas
DISABLE_FROM_KEY XR2400.ARE XR2600.ARE

That's it.

#20 krimine

krimine
  • Member
  • 10 posts

Posted 09 November 2011 - 01:55 PM

i30817 , did you try with 230 beta 2?