Bug #38977

Timer variables not reset on character import, affects CHARNAME’s AI

Added by Caleb Joiner about 1 year ago. Updated 12 months ago.

Status:Closed - FixedStart date:10/13/2018
Classification:Public ItemDue date:
Assignee:-% Done:


Target version:Public Bug Reports - Next Update
Found In Version:Public Bug Reports -


When importing a previously played character into the start of a new game, certain timer variables aren’t reset, spoiling the AI’s use of certain character abilities until enough in-game time has passed. I noticed it first trying to get the AI to use Hide in Shadows on a level 10 thief I imported. I found a detailed explanation for the symptoms on the Beamdog Forums.

Internal report #39009

Ref: https://forums.beamdog.com/discussion/64106/advanced-ai-doesnt-work-properly-for-exported-characters-thank-you-bubb-and-kjeron-for-the-fix#latest

The Advanced AI script is BDDEFAI, and the problem is caused by a timer called BD_CAST. I don't fully understand how timers work, but it seems exporting to a new game resets the game's current tick. It looks as if the timer stores an absolute tick in the LOCALS of the creature, not a relative one. Thus, when you export a character, the timer is now set to a very large, very far in the future time.

The BD_CAST timer is not the only timer that goes haywire when a character is exported. In the Advanced AI script alone, there are 15 timers which can become stuck upon export.
BD_Blind; Blind
BD_Cast; Controls one-round casting delay
BD_CLTM; Zone Of Sweet Air
BD_Dharm; Defensive Harmony
BD_DInv; Detect Invisibility
BD_Glitter; Glitterdust
BD_Haste; Haste
BD_HIDE; Hide in Shadows ability
BD_Horror; Horror
BD_RParal; Remove Paralysis
BD_SCLAR; Spiritual Clarity
BD_Slow; Slow
BD_Spook; Spook
BD_Support; Controls delay between buffing-spells
BD_Wand; Controls delay between wand usages
If your character has done ANY of these things, at ANY point before exporting, you will have to reset the corresponding timer to zero in order for that function to work again.

There are workarounds and fixes posted in the forum thread, but all of them require access to the console command bar. I play on iOS, so can’t use them. According to the thread, this may affect BG2 and ToB as well, I’m not sure.

000000001-Quick-Save-4.bg1save (146 KB) Caleb Joiner, 10/16/2018 07:57 PM


#1 Updated by Richard Hilton about 1 year ago

  • Status changed from New to Needs More Info

You can export a save via long-tap of quicksave if you want to fix it for your game or require assistance doing so.

Presumably you are playing through BG:EE multiple times with exported and re-imported characters. It may be the case that only SoD and BGII:EE check these as that would be the expectation of where imported characters will be used, but we should allow for replays of the first game so if you can confirm we'll get this reported.


#2 Updated by Caleb Joiner about 1 year ago

I did The Black Pits first, then imported. The Pits only took a couple days of in game time, so the problem clears up eventually, once the current game timer passes that point. I’ll attach an early save file.

#3 Updated by Richard Hilton about 1 year ago

  • Description updated (diff)
  • Status changed from Needs More Info to Submitted


#4 Updated by Richard Hilton 12 months ago

  • Status changed from Submitted to Closed - Fixed

Fixed in version

#5 Updated by Anders Svensson 12 months ago

  • Target version set to Next Update
  • % Done changed from 0 to 100

Also available in: Atom PDF