Jump to content


Photo

Area CRE Checker


  • Please log in to reply
10 replies to this topic

#1 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 17 April 2011 - 04:50 PM

File Name: Area CRE Checker
File Submitter: Miloch
File Submitted: 18 Apr 2011
File Category: IE Modding Tools

Area CRE Checker v2 by Miloch
A utility for the Baldur's Gate II engine
http://www.shsforums.net/index.php

This is a small utility that scans all creature references in a particular area and its script. Its goal is to locate faulty creatures that can cause the game to crash. The main issues include:

- Creature does not exist
- Animation does not exist
- Animation is invalid
- Creature weapons cause animation glitches

The utility will output a list of creatures and animations to /areatest/arealog.txt for further analysis. A sample output from unmodded BG2's ar0406 (Copper Coronet) is:

File CRE Name Animation AnimName AnimType
ar0406.bcs escort1a Cominda nprohg1e.bam harlot_woman bg1_char_simple
ar0406.bcs escort2a Kerstia cifb1a6.bam fighter_female_halfling bg2_character
ar0406.bcs escort3a Jenthan chmb1a6.bam fighter_male_human bg2_character
ar0406.bcs copamb01 Gladiator chmb1a6.bam fighter_male_human bg2_character
ar0406.bcs copamb02 Copper Coronet Guard chmb1a6.bam cleric_male_human bg2_character
ar0406.bcs copamb03 Gladiator cemb1a6.bam fighter_male_elf bg2_character
ar0406.bcs copamb04 Gladiator cdmb1a6.bam fighter_male_dwarf bg2_character
ar0406.bcs copamb05 Copper Coronet Guard chmb1a6.bam cleric_male_human bg2_character
ar0406.bcs doug Festule the Alchemist cemb1a6.bam thief_male_elf bg2_character
ar0406.bcs bunkin Bunkin chfb1a6.bam fighter_female_halforc bg2_character
ar0406.bcs gorf Gorf the Squisher moghg1e.bam half_ogre bg1_monster
ar0406.bcs ccguard1 Copper Coronet Guard chmb1a6.bam cleric_male_human bg2_character
ar0406.bcs ccguard2 Copper Coronet Guard chmb1a6.bam fighter_male_human bg2_character
ar0406.are lehtin Lehtinan chmb1a6.bam fighter_male_human bg2_character
ar0406.are surly Surly chmb1a6.bam fighter_male_halforc bg2_character
ar0406.are wench1 Tavern Wench nprohg1e.bam harlot_woman bg1_char_simple
ar0406.are ruffian Amalas chmb1a6.bam fighter_male_human bg2_character
ar0406.are rufpal1 Ruffian chmb1a6.bam fighter_male_human bg2_character

The utility also generates a test area and script that will automatically spawn each creature to see which (if any) causes an issue. This saves you from having to go through the list and spawn each creature manually, as you can simply MoveToArea("t-test") from the in-game console.

Usage:
1. Consult bg1aref.htm or bg2aref.htm in the areatest folder to look up your area code (or use the IESDP)
2. Double-click on setup-areatest.exe in your game folder and input the area code when prompted
3. View the output of areatest/arealog.txt
4. If no issues are apparent in arealog.txt (such as UNKNOWN_CRE or UNKNOWN_BAM), start or load a game
5. In the game, select only your main character (not other party members)
6. Press Ctrl+Space to open a console window and type: MoveToArea("t-test")
7. Wait while the test area script spawns and purges each creature
8. Wait until you see either "Done and done!" or you get a freeze/crash (CTD)
9. If you encounter a crash or freeze, note the last creature the script was attempting to spawn
10. Open a command prompt to your game folder (Start > Run > cmd)*
11. Type: cd C:\Games\BG2 (substituting the path for where your game is installed)
12. Type: weidu --change-log crefile.cre --out crefile.txt (where crefile is the CRE that caused a crash)
13. Type: weidu --change-log anim.bam --out anim.txt (where anim is the Animation from arealog.txt)
14. Report the issue in the proper forum for the mod (output by the change-log) if relevant

* As an alternative, you can use the change-log utility (see http://www.shsforums...or-the-megamods).

The full IESDP is available at http://iesdp.gibberlings3.net/.

Version History:

Version 2: 17 Apr 2011
- Enhanced CRE listing (mod CREs first)
- Added animation info to arealog.txt
- Added test script to loop through spawning all creatures
- Added readme

Version 1: 18 Feb 2011
- Initial release

Click here to download this file

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


#2 Chevalier

Chevalier

    Knight of the Realms

  • Modder
  • 2405 posts

Posted 18 April 2011 - 12:53 AM

Great tool!!!!! Thanks!

I Ride for the King!


a.k.a. Chev


#3 cmorgan

cmorgan
  • Modder
  • 2301 posts

Posted 18 April 2011 - 04:56 AM

Very much appreciated - I think I need to steal the idea and create a companion to this that lets people test cutscenes and the like!

#4 shadowlich

shadowlich
  • Member
  • 102 posts

Posted 30 October 2013 - 11:51 AM

What do you check to know that an - Animation is invalid and that  a - Creature weapons cause animation glitches?



#5 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 03 November 2013 - 11:58 AM

It's been a while, but I think for valid animations, the code checks to make sure the animation suffix matches a known type compatible with the engine, otherwise returns UNKNOWN_TYPE, e.g.:

      ACTION_IF FILE_EXISTS_IN_GAME ~%anpre%de.bam~ BEGIN
        OUTER_TEXT_SPRINT anbam ~%anpre%de.bam~
        OUTER_TEXT_SPRINT antype ~iwd_style~
      END ELSE BEGIN
        ACTION_IF FILE_EXISTS_IN_GAME ~%anpre%1100.bam~ BEGIN
          OUTER_TEXT_SPRINT anbam ~%anpre%1100.bam~
          OUTER_TEXT_SPRINT antype ~bg2_dragon~
        END ELSE BEGIN
          ACTION_IF FILE_EXISTS_IN_GAME ~%anpre%1a6e.bam~ BEGIN
            OUTER_TEXT_SPRINT anbam ~%anpre%1a6e.bam~
            OUTER_TEXT_SPRINT antype ~bg1_character~
          END ELSE BEGIN
            ACTION_IF FILE_EXISTS_IN_GAME ~%anpre%g11e.bam~ BEGIN
              OUTER_TEXT_SPRINT anbam ~%anpre%g11e.bam~
              OUTER_TEXT_SPRINT antype ~bg1_monster_big~
            END ELSE BEGIN
              ACTION_IF FILE_EXISTS_IN_GAME ~%anpre%hg1e.bam~ BEGIN
                OUTER_TEXT_SPRINT anbam ~%anpre%hg1e.bam~
                OUTER_TEXT_SPRINT antype ~bg1_char_simple~
              END ELSE BEGIN
                ACTION_IF FILE_EXISTS_IN_GAME ~%anpre%g1e.bam~ BEGIN
                  OUTER_TEXT_SPRINT anbam ~%anpre%g1e.bam~
                  OUTER_TEXT_SPRINT antype ~bg1_monster~
                END ELSE BEGIN
                  ACTION_IF FILE_EXISTS_IN_GAME ~%anpre%1a6.bam~ BEGIN
                    OUTER_TEXT_SPRINT anbam ~%anpre%1a6.bam~
                    OUTER_TEXT_SPRINT antype ~bg2_character~
                  END ELSE BEGIN
                    ACTION_IF FILE_EXISTS_IN_GAME ~%anpre%g111.bam~ BEGIN
                      OUTER_TEXT_SPRINT anbam ~%anpre%g111.bam~
                      OUTER_TEXT_SPRINT antype ~bg2_monster_big~
                    END ELSE BEGIN
                      ACTION_IF FILE_EXISTS_IN_GAME ~%anpre%g1.bam~ BEGIN
                        OUTER_TEXT_SPRINT anbam ~%anpre%g1.bam~
                        OUTER_TEXT_SPRINT antype ~bg2_monster~
                      END ELSE BEGIN
                        OUTER_TEXT_SPRINT anbam ~%anpre%~
                        OUTER_TEXT_SPRINT antype ~UNKNOWN_TYPE~
                      END

For weapon validity, it theoretically checks that nothing is in the shield/offhand weapon slot if a two-handed weapon is equipped, or that only a shield is in the shield slot if the animation can't support offhand weapon animations (e.g. BG1 character animations). But from the looks of it, the actual code for that might be in Creature Checker rather than Area CRE Checker, and this probably just relies on the engine assertions to determine those errors via baldur.err logging.


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


#6 shadowlich

shadowlich
  • Member
  • 102 posts

Posted 19 November 2013 - 01:49 PM

Thanks Miloch  :) 



#7 LLeroy

LLeroy
  • Member
  • 6 posts

Posted 28 April 2015 - 08:39 AM

Hi,

I always have the message "An Assertion failed in ObjCreature.cpp at line number 12162" after meeting the clone in Irenicus Dungeon.

I try your thing, but when i type: MoveToArea("t-test") in the console window, i have the message "lua call expression not function".

 

Is there something i can do, except violently destroy my computer in millions of pieces out of frustration ?


Edited by LLeroy, 11 May 2015 - 02:13 PM.


#8 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5155 posts

Posted 28 April 2015 - 09:06 AM

, but when i type: MoveToArea("t-test") in the console window,

The command needs to be:

CLUAConsole:MoveToArea("t-test") 

Yes, all the commands have the same prefix... aka: CLUAConsole:

And in EE games(v2.0 or above), the command is just: C:MoveToArea("t-test")


Edited by The Imp, 16 September 2017 - 11:10 AM.

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.


#9 LLeroy

LLeroy
  • Member
  • 6 posts

Posted 28 April 2015 - 11:46 PM

Yes, all the commands have the same prefix... aka: CLUAConsole:

 

D:

 

Gentlemen, i felt so stupid after reading this...

 

 

OK so i run the show, and of all the creatures, dsthief (Shadow Thief) was created, purged BUT didn't appear as "Dead". What should I do now ?

 

 

Btw I have a BGT install. Do you guys need my WeiDU log ?


Edited by LLeroy, 28 April 2015 - 11:54 PM.


#10 LLeroy

LLeroy
  • Member
  • 6 posts

Posted 14 May 2015 - 01:06 PM

Hello ?


Edited by LLeroy, 31 May 2015 - 01:17 AM.


#11 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 16 September 2017 - 09:39 AM

Hello ?

"Yo, Leeeeroy!"

 

Sorry, couldn't resist a necropost that references both the Beastie Boys and WoW.

 

*However*, I'm mainly bumping this (my own) post because a friend ran into a problem of this nature and might find my utility useful. Andrea: please report here if it helps (maybe some poor soul will develop the utility further if not).

 

Edit: Erm, in the offchance that LLeroy from two years ago happens back here, no ignorance intended, I truly didn't see the post, so yes, a WeiDU.log or other info would help.


Edited by Miloch, 16 September 2017 - 09:41 AM.

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