Jump to content


Photo

Area CRE Checker


5 replies to this topic

#1 Miloch

Miloch

    Barbarian

  • Modder
  • 6209 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
================================================================
"My definition of an intellectual is someone who can listen to the William Tell Overture without thinking of the Lone Ranger." -Billy Connolly


#2 Chevalier

Chevalier

    Knight of the Realms

  • Modder
  • 2303 posts

Posted 18 April 2011 - 12:53 AM

Great tool!!!!! Thanks!
I Ride for the King!


a.k.a. Chev

#3 cmorgan

cmorgan
  • Staff
  • 2254 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
  • 79 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
  • 6209 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
================================================================
"My definition of an intellectual is someone who can listen to the William Tell Overture without thinking of the Lone Ranger." -Billy Connolly


#6 shadowlich

shadowlich
  • Member
  • 79 posts

Posted 19 November 2013 - 01:49 PM

Thanks Miloch  :) 





Reply to this topic