The Black Wyrm Lair Forums
The Black Wyrm's Lair Terms of Use Help Search Members Calendar

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How to gather clues when debugging stuttering
The Bigg
post May 24 2008, 12:57 PM
Post #1





Forum Member
Posts: 165
Joined: 29-January 05
From: Modena (Italy)




The most common cause of stuttering characters (that is, characters who stop walking 'without reason') is a script block which fires multiple times and causes the character to stop his current action (Dialogue() when there's no valid entry state is a common example, but not the only one). With this short tp2 code and instruction uses, I hope to help you research with more ease which script block is actually causing the problem. It only gives you a nudge in the 'right' direction, but not the full solution (and in some cases, stuttering is caused by a conflict animation or something completely different anyway).

This tutorial assumes you know the fundamentals of modding (creating a tp2, viewing/reading game resources and variables, understanding scripts). Also, correctly running this code requires a WeiDU feature that is only available in WeiDU 207 or later. PM me if you need the beta for the purposes of this tutorial. It is possible to do a similar thing with WeiDU 206, but it will be much more cumbersome to use, since you'll get printed a random TLK string rather than the script file and block number.

Steps:
1) open your save game, view the creature file that is affected by the stutter, and write down a list of the script files it has as well as the script for the area you're in.

2) create a tp2 like the following one, edit the stuff I marked in the comments, and install it:
CODE
BACKUP ~stutter_test/backup~
AUTHOR ~blah~

BEGIN ~Test stuttering~
COPY_EXISTING ~scriptfile1.bcs~ ~override~ // be sure to change the file names to point to the relevant ones
    ~scriptfile2.bcs~ ~override~
    ~scriptfileN.bcs~ ~override~
    ~AreaScript.bcs~ ~override~ // ditto
    ~Baldur(25?).bcs~ ~override~ // use either baldur.bcs or baldur25.bcs wether you're in SoA or in ToB.
    SET x = 0 - 1
    DECOMPILE_BCS_TO_BAF
        REPLACE_EVALUATE ~\(RESPONSE #[0-9]+\)~ BEGIN
            x += 1
        END "\1
        ActionOverride(Player1,DisplayString(Myself,~Running block %x% of %SOURCE_RES%.BCS~))"
    COMPILE_BAF_TO_BCS


3) load up your game. You'll see the dialogue window spammed with lines like:
<CHARNAME>: Running block 5 of BALDUR.BCS
<CHARNAME>: Running block 123 of DPLAYER2.BCS
etc.
These lines identify which BCS blocks are running. Wait for a bit (30 seconds are fine), and see which ones fire only once, and which ones are firing endlessly. The latter ones are more likely the cause of your stuttering issues.

4) If you don't get repeating blocks, it's time to get bored and add more scripts to the list. Try adding your party members' scripts to the list in step 3. If that doesn't work, try adding all the scripts for all creatures in the area (someday I could write code to automate this as well) - although by this point you'll get spammed by tons of unrelevant AI blocks firing off.

5) Open up those scripts in your favorite game editor (or decompile them with WeiDU and read their contents in your favorite text editors). Try to identify which of those blocks are affecting your stuttering character, and why are they causing him to stutter (is one firing a Dialogue() which doesn't display? Is he under a constant ActionOverride()? NoAction()? *CastSpell()?).

6) If step 5 didn't help identify your issues, try repeating step 4.

I hope this will be useful to some people, and all comments and criticsm (constructive or not) are very welcome. If possible, try to write your feedback in a public post rather than in a PM, so that it's accessible to more people.


This is the code that will run under WeiDU 206, probably all the way back to WeiDU 185. <CHARNAME> will fire off random item descriptions, dialogue lines, sound effects without associated printed dialog, etc. You'll need to decompile all the script files you listed (wether they fired off or not) and seek the tlk string that gets spammed in the dialogue window.
CODE
BACKUP ~stutter_test/backup~
AUTHOR ~blah~

BEGIN ~Test stuttering~
COPY_EXISTING ~sw1h01.itm~ ~override~
    SET x = 0
BUT_ONLY_IF_IT_CHANGES

COPY_EXISTING ~scriptfile1.bcs~ ~override~ // be sure to change the file names to point to the relevant ones
    ~scriptfile2.bcs~ ~override~
    ~scriptfileN.bcs~ ~override~
    ~AreaScript.bcs~ ~override~ // ditto
    ~Baldur(25?).bcs~ ~override~ // use either baldur.bcs or baldur25.bcs wether you're in SoA or in ToB.
    DECOMPILE_BCS_TO_BAF
        REPLACE_EVALUATE ~\(RESPONSE #[0-9]+\)~ BEGIN
            x += 1
        END "\1
        ActionOverride(Player1,DisplayString(Myself,#%x%))"
    COMPILE_BAF_TO_BCS


EDIT: fix suggested by Taimon in the comments at G3.

This post has been edited by The Bigg: May 25 2008, 02:11 AM


--------------------
Please do not contact me for assistance in using BGT, BP, any other of the 'large mods', or a mod I didn't write or contribute to. I'm not your paid support staff, so I'd suggest you to direct your help questions to the forum relative to the mod you're playing.

Thanks for your cooperation.
Go to the top of the page
 
Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:



- Lo-Fi Version Time is now: 12th November 2024 - 11:36 AM