Jump to content


Photo

Possible BGT/-Tweak-only related Beregost Bug/CTD


  • Please log in to reply
24 replies to this topic

#1 10th

10th
  • Member
  • 621 posts

Posted 09 August 2008 - 09:31 AM

I could not enter Beregost no matter what I did. After rereading some posts which could help me narrow down the cause for this CTD I removed AR6700.bcs from Beregost and it worked.

My offending AR6700.bcs code snippet with CTD-guarantee:

IF
OnCreation()
THEN
RESPONSE #100
Explore()
Continue()
END

IF
Global("BGTNPC6700","GLOBAL",0)
Level(Player1,1)
THEN
RESPONSE #100
SetGlobal("BGTNPC6700","GLOBAL",1)
CreateCreature("Garric",[2504.2270],5) // Garrick
END

IF
Global("BGTNPC6700","GLOBAL",0)
OR(2)
Level(Player1,2)
Level(Player1,3)
THEN
RESPONSE #100
SetGlobal("BGTNPC6700","GLOBAL",1)
CreateCreature("GARRIC2",[2504.2270],5) // Garrick
END

IF
Global("BGTNPC6700","GLOBAL",0)
OR(2)
Level(Player1,4)
Level(Player1,5)
THEN
RESPONSE #100
SetGlobal("BGTNPC6700","GLOBAL",1)
CreateCreature("GARRIC4",[2504.2270],5) // Garrick
END

IF
Global("BGTNPC6700","GLOBAL",0)
LevelGT(Player1,5)
THEN
RESPONSE #100
SetGlobal("BGTNPC6700","GLOBAL",1)
CreateCreature("GARRIC6",[2504.2270],5) // Garrick
END

IF
Global("Chapter","GLOBAL",4)
Global("ElminsterSpawn","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("ElminsterSpawn","GLOBAL",1)
CreateCreature("ELMIN2",[4710.3091],0) // Elminster
Continue()
END

IF
OnCreation()
Global("Chapter","GLOBAL",4)
Global("ChloeSpawn","GLOBAL",0)
!Exists("Chloe")
!Dead("Chloe") // Chloe
THEN
RESPONSE #100
SetGlobal("ChloeSpawn","GLOBAL",1)
CreateCreature("CHLOE",[4127.2881],0) // Chloe
Continue()
END


After moving the bolded part to the bottom I had no problems entering Beregost. The first OnCreation() is from BGT-Tweaks the remainder of the script is vanilla BGT. That was with BGT 1.05 and BGT-Tweak V7 but from what I could see in base\baf\ar6700.baf it's still a problem in 1.06


Scrap that. This code has no problems but the involved cre-files have BIG problems. Could someone move this thread to megamod help where it now rightfully belongs?

After removing the bolded parts I got into Beregost but that was only a removal of the symptoms of the true problem. Because as soon as it got to that bolded block of code it tried to create some really weird creatures.

garric.cre is okay but every other version of Garrick is weird to say the least.

Mods affecting GARRIC2.CRE:
00000: /* from game biffs */ ~SETUP-BGT.TP2~ 0 0 // Baldur's Gate Trilogy - Core 1.05b
00001: /* from game biffs */ ~SETUP-SCS.TP2~ 0 120 // Smarter general AI
00002: ~SETUP-SCS.TP2~ 0 160 // Smarter mages
00003: ~SCSII/SETUP-SCSII.TP2~ 0 4040 // Prevent party members from dying irreversibly
00004: ~BG2_TWEAKS/SETUP-BG2_TWEAKS.TP2~ 0 3010 // For All Creatures in Game
00005: ~BG2_TWEAKS/SETUP-BG2_TWEAKS.TP2~ 0 4020 // ToB-Style NPCs
00006: ~P5TWEAKS/SETUP-P5TWEAKS.TP2~ 0 20 // Drop Items on Disintegration

Instead of Weapon Proficiencies they've (garric2,4,6) got an attacks per round bonus which is totally messed up, moreover there's a bonus to AC which is equally weird.

For those interested in wacky cre-files I've attached them

10th

Attached Files


Edited by 10th, 10 August 2008 - 06:18 AM.

Avast! You cannot defeat our titan-mounted submarine staffed by cannibal vikings! - Nodwick

"I grab his deceased spirit and piledrive it back into his body, duplicating raise dead." - Psyren Oots board

#2 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 10 August 2008 - 12:30 AM

Except that I cannot reproduce the CTD in my game. The only fix I can make is to move the Chloe OnCreation() block to the top (don't know why it's at the bottom), but I won't guarantee that that fixes anything at all.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#3 10th

10th
  • Member
  • 621 posts

Posted 10 August 2008 - 06:59 AM

There is only one minor BGT-related error: Garric4.cre has GarrickL instead of GarrickM assigned as large portrait.

IF there are no more mods except those I posted from my changelog of garric2.cre which alter NPCs I can exclude BGT and SCS as those were already installed when I checked in one of my backup installations when the "corruption" occured.

10th
Avast! You cannot defeat our titan-mounted submarine staffed by cannibal vikings! - Nodwick

"I grab his deceased spirit and piledrive it back into his body, duplicating raise dead." - Psyren Oots board

#4 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 10 August 2008 - 07:05 PM

IF there are no more mods except those I posted from my changelog of garric2.cre which alter NPCs I can exclude BGT and SCS as those were already installed when I checked in one of my backup installations when the "corruption" occured.

I don't know why P5Tweaks would be messing with Garrick at all, unless some previous mod did something truly bizarre to him. You may as well attach your SETUP-P5TWEAKS.DEBUG file, and I suppose your DEBUGs from those other mods that changed him.

Edit: Actually, I do know what it would've been doing - fixing indexing errors (via Nythrun's macros) on his CRE file, again possibly caused by previous mods.

Edited by Miloch, 10 August 2008 - 07:06 PM.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#5 10th

10th
  • Member
  • 621 posts

Posted 11 August 2008 - 08:52 AM

P5Tweaks extended his script in order to add the various protection from loot loss upon death checks to BGGarrik.bcs.

I've attached all .Debug's which mention garric.cre moreover I've also included my WeiDu.log.

10th

Attached Files


Avast! You cannot defeat our titan-mounted submarine staffed by cannibal vikings! - Nodwick

"I grab his deceased spirit and piledrive it back into his body, duplicating raise dead." - Psyren Oots board

#6 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 11 August 2008 - 05:14 PM

P5Tweaks extended his script in order to add the various protection from loot loss upon death checks to BGGarrik.bcs.

Yes, that would've happened during the previous component (Frozen Death, which modded only his scripts not his CREs) but not the Disintegration component. For that component to change his CRE, a previous mod must've messed it up.

From what I can tell, this may have happened around ToB-Style NPCs, Higher HP on Level Up and/or Maximum HP Creatures, or possibly something even earlier. From its description, that first component should've removed his proficiencies so that you can choose them, right? Well it doesn't look like it did that properly, since there are remnants of the proficiency effects showing up improperly as you reported.

If you don't want to uninstall mods one by one to try to see the last place Garrick was ok (or do a full reinstall), you could scan your installation backups and look at those CREs instead. Just right-click on your BGT folder, go to Search and type 'garric2.cre' in the first field (you may need to mess with the settings a bit if you have Vista or the like). Then use an editor to go through them by date/time changed and find the last one that was uncorrupted. You might end up doing at least a partial reinstall anyway, but at least you'll know what to avoid for next time.

Edit: And if it is ToB-style NPCs, you can use Level 1 NPCs instead. But like I said, it may have been something even earlier. Exactly how "unofficial" is this "unofficial hotfix" for SCS?

Edited by Miloch, 11 August 2008 - 05:17 PM.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#7 10th

10th
  • Member
  • 621 posts

Posted 12 August 2008 - 09:04 AM

I "fixed" it manually in NI in the meantime. After deleting all messed up proficiencies in garric2,3,4 and doing a copy & paste job of the proficiencies from garric.cre everything was fine.

After a short glance, from someone not all that code-savvy, at bg2_tweaks\lib\tob_style_npcs.tpa, it seems that there is no removal at all.

UPDATE: Following your recommendation Miloch, I checked the various backup folders. Up to ToB-Style NPCs everything was fine. After ToB-Style NPCs you get the cre-filess from the RAR I've attached earlier.

And if I look at my WeiDu.log that's all that comes after it:
~BG2_TWEAKS/SETUP-BG2_TWEAKS.TP2~ #0 #4020 // ToB-Style NPCs
~BG2_TWEAKS/SETUP-BG2_TWEAKS.TP2~ #0 #4031 // Consistent Stats: Edwin -> Use BG2 Values
~BG2_TWEAKS/SETUP-BG2_TWEAKS.TP2~ #0 #4041 // Consistent Stats: Jaheira -> Use BG2 Values
~BG2_TWEAKS/SETUP-BG2_TWEAKS.TP2~ #0 #4061 // Consistent Stats: Minsc -> Use BG2 Values
~BG2_TWEAKS/SETUP-BG2_TWEAKS.TP2~ #0 #4071 // Consistent Stats: Viconia -> Use BG2 Values
~BG2_TWEAKS/SETUP-BG2_TWEAKS.TP2~ #0 #4080 // Make Khalid a Fighter-Mage (Domi)
~SETUP-D0TWEAK.TP2~ #0 #0 // Enhanced Goodberries
~SETUP-D0TWEAK.TP2~ #0 #4 // Tweaked Weapon Enchantments
~SETUP-D0TWEAK.TP2~ #0 #5 // Additional Racial Enemies
~SETUP-D0TWEAK.TP2~ #0 #6 // Summonning Cap Removal
~SETUP-D0TWEAK.TP2~ #0 #11 // Visual Ioun Stones
~P5TWEAKS/SETUP-P5TWEAKS.TP2~ #0 #10 // Drop Items on Frozen Death: v2
~P5TWEAKS/SETUP-P5TWEAKS.TP2~ #0 #20 // Drop Items on Disintegration: v2
~P5TWEAKS/SETUP-P5TWEAKS.TP2~ #0 #30 // Drop Items on Imprisonment: v2
~P5TWEAKS/SETUP-P5TWEAKS.TP2~ #0 #40 // Drop Items on Petrification: v2
~P5TWEAKS/SETUP-P5TWEAKS.TP2~ #0 #50 // Restore SoA Background Music for Promenade Cutscene: v2
~1PP_FLAMINGSWORDS/1PP_FLAMINGSWORDS.TP2~ #0 #0 // One Pixel Productions: Flaming Swords v1
~SETUP-BP-BGT-WORLDMAP.TP2~ #0 #0 // Worldmap for Baldur's Gate v7.0 - including colored Baldur's Gate map icons -> New Worldmap for use with Mega Modification...
~SETUP-BP-BGT-WORLDMAP.TP2~ #0 #2 // Worldmap for Throne of Bhall -> Use new Worldmap for Throne of Bhaal as well
~SETUP-BGTMUSIC.TP2~ #0 #0 // Baldur's Gate Trilogy - Music -> Full Baldur's Gate and Tales of the Sword Coast Music
~SETUP-GUI.TP2~ #0 #2 // Game Graphical User Interface (GUI) -> "Baldur's Gate Trilogy" (Elminster wielding staff)"

@ Unofficial hotfix for SCS
Taimon made SCS' tp2 WeiDu 208 compatible and made afaik some further changes to it. Moreover there are some bugfixes to various components, it's all over at G3's SCS forum sticky. Everything except the tp2 should already be included in the latest BiGWorld Fixpack.

10th

Edited by 10th, 12 August 2008 - 02:01 PM.

Avast! You cannot defeat our titan-mounted submarine staffed by cannibal vikings! - Nodwick

"I grab his deceased spirit and piledrive it back into his body, duplicating raise dead." - Psyren Oots board

#8 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 12 August 2008 - 07:16 PM

UPDATE: Following your recommendation Miloch, I checked the various backup folders. Up to ToB-Style NPCs everything was fine. After ToB-Style NPCs you get the cre-filess from the RAR I've attached earlier.

Did you check the other NPCs? It's odd that only Garrick would be hosed, but if just one offset was off, I can see how something like ToB NPCs could've hosed it even further. It should probably be using a CRE validator like the one from Nythrun I include with P5 Tweaks. If you want to attach your backup Garricks from before and after the problem occurred, I can try to see if I can figure out what went wrong.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#9 10th

10th
  • Member
  • 621 posts

Posted 13 August 2008 - 09:15 AM

Did you check the other NPCs? It's odd that only Garrick would be hosed, but if just one offset was off, I can see how something like ToB NPCs could've hosed it even further. It should probably be using a CRE validator like the one from Nythrun I include with P5 Tweaks. If you want to attach your backup Garricks from before and after the problem occurred, I can try to see if I can figure out what went wrong.


Here are Garrick's files. And after looking at other NPCs, it seems that the problem only occured with Garrick.

10th

Attached Files


Avast! You cannot defeat our titan-mounted submarine staffed by cannibal vikings! - Nodwick

"I grab his deceased spirit and piledrive it back into his body, duplicating raise dead." - Psyren Oots board

#10 Taimon

Taimon
  • Member
  • 387 posts

Posted 15 August 2008 - 05:54 AM

I think it's rather SCSII wrongly updating the offsets in the nochunk component.
Check scsII/misc/nochunk.tph lines 38-52 and 78-92. Try adding a = to the conditions, i. e.

/Edit:
Do not use the code below!
PATCH_IF !(~%knownspellsoffset%~<=~%effoffset%~) THEN BEGIN
	WRITE_LONG 0x2a0 ~%knownspellsoffset%~+~%gap%~
END
PATCH_IF !(~%memorizationoffset%~<=~%effoffset%~) THEN BEGIN
	WRITE_LONG 0x2a8 ~%memorizationoffset%~+~%gap%~
END
PATCH_IF !(~%memorizedoffset%~<=~%effoffset%~) THEN BEGIN
	WRITE_LONG 0x2b0 ~%memorizedoffset%~+~%gap%~
END
PATCH_IF !(~%itemsoffset%~<=~%effoffset%~) THEN BEGIN
	WRITE_LONG 0x2bc ~%itemsoffset%~+~%gap%~
END
PATCH_IF !(~%itemslotsoffset%~<=~%effoffset%~) THEN BEGIN
	WRITE_LONG 0x2b8 ~%itemslotsoffset%~+~%gap%~
END

Edited by Taimon, 17 August 2008 - 03:38 AM.


#11 DavidWallace

DavidWallace
  • Validating
  • 337 posts

Posted 17 August 2008 - 02:39 AM

Edit: And if it is ToB-style NPCs, you can use Level 1 NPCs instead. But like I said, it may have been something even earlier. Exactly how "unofficial" is this "unofficial hotfix" for SCS?


Put it this way: I've no idea what's in it.

Having said that, I have no objections to it (hence the pinned thread at the SCS forums). SCSII has seriously delayed my updating of the original SCS, so it would be churlish of me not to smile upon third-party fixes in the interim.

#12 DavidWallace

DavidWallace
  • Validating
  • 337 posts

Posted 17 August 2008 - 02:43 AM

I think it's rather SCSII wrongly updating the offsets in the nochunk component.


I need more convincing that this is a bug or that your change is a good idea.

Take (say) the memorized spells offset. There are four possibilities:

(a) It's less than the effect offset.
(b) It's greater than the effect offset.
© It's equal to the effect offset, because
(i) there are no effects, or
(ii) there are no memorized spells.

In case (a), the offset shouldn't be modified.
In case (b), it should be.
In case ©(i), it should be.
In case ©(ii), it doesn't matter whether it is.

My macro modifies the offset if it's greater than or equal to the effect offset - i.e., in cases (b) and ©. That seems fine. Your proposed modification modifies it only if it's greater than the offset - i.e., in case (b) only. I think this will break CRE files that don't currently have any effects.

(Am I misunderstanding?)

#13 Taimon

Taimon
  • Member
  • 387 posts

Posted 17 August 2008 - 03:23 AM

I think you are correct, the "fix" will fail if there are no effects but some memorized spells.

Your current implementation however fails on case ©(ii). It should not be updated with the 0x108 gap, because if the CRE already has some effects, updating will result in the offset pointing in the middle of the effects section.

#14 DavidWallace

DavidWallace
  • Validating
  • 337 posts

Posted 17 August 2008 - 03:27 AM

I think you are correct, the "fix" will fail if there are no effects but some memorized spells.

Your current implementation however fails on case ©(ii). It should not be updated with the 0x108 gap, because if the CRE already has some effects, updating will result in the offset pointing in the middle of the effects section.


Yep, agreed. Okay, add that to the to-do list.

#15 Bearwere

Bearwere
  • Member
  • 40 posts

Posted 17 August 2008 - 04:58 AM

Last time I was watching at weidu source (I actually did, though some time have passed since then), ADD_CRE_ITEM and alike functions only updated offsets that should be updated in default creature ordering. Macroses that update offsets dynamically, basing on actual ordering of offsets, have chance of reordering the creature themselves and therefore may cause failure of later mods, using these weidu functions. To me, the lesser of 2 evils seems to always assume that creature is ordered by default and build your macro on this assumption.

Edited by Bearwere, 17 August 2008 - 04:58 AM.


#16 Taimon

Taimon
  • Member
  • 387 posts

Posted 17 August 2008 - 06:27 AM

This has changed a bit.
WeiDU now has a cre module, which is able to deal with non-default ordering. (It reads the stuff into structures, modifies these and outputs the cre in default ordering.)

#17 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 17 August 2008 - 07:44 AM

Your current implementation however fails on case ©(ii). It should not be updated with the 0x108 gap, because if the CRE already has some effects, updating will result in the offset pointing in the middle of the effects section.

Can we assume this is what caused 10th's problem then? Saves me having to try to figure it out from the files.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#18 Bearwere

Bearwere
  • Member
  • 40 posts

Posted 17 August 2008 - 07:59 AM

This has changed a bit.
WeiDU now has a cre module, which is able to deal with non-default ordering. (It reads the stuff into structures, modifies these and outputs the cre in default ordering.)

that's good to to hear

#19 Taimon

Taimon
  • Member
  • 387 posts

Posted 17 August 2008 - 09:48 AM

Your current implementation however fails on case ©(ii). It should not be updated with the 0x108 gap, because if the CRE already has some effects, updating will result in the offset pointing in the middle of the effects section.

Can we assume this is what caused 10th's problem then? Saves me having to try to figure it out from the files.

Yes, I'm sure it is caused by this.

#20 DavidWallace

DavidWallace
  • Validating
  • 337 posts

Posted 18 August 2008 - 12:49 AM

Your current implementation however fails on case ©(ii). It should not be updated with the 0x108 gap, because if the CRE already has some effects, updating will result in the offset pointing in the middle of the effects section.

Can we assume this is what caused 10th's problem then? Saves me having to try to figure it out from the files.

Yes, I'm sure it is caused by this.


Looks plausible to me too.

The obvious workaround is to install SCSII last (which is what I normally recommend anyway, not that that justifies the bug). The only situations where it's going to cause problems (I reckon) are where a creature has no spells/items before SCSII is installed and then gets some via a mod afterwards (though doubtless someone will spot some other situation in due course). I'd estimate the next release of SCSII to be in about three weeks.

Edited by DavidWallace, 18 August 2008 - 12:49 AM.