Skip to content

STATE_REALLY_DEAD in UDMPSWN.BCS is not reliable

switswit Member, Translator (NDA) Posts: 495
edited August 2015 in BGII:EE Bugs (v1.3.2064)
According to @CamDawg and @Erg STATE_REALLY_DEAD check is not always reliable when running on dying creature: http://gibberlings3.net/forums/index.php?showtopic=26728#entry227743
There is also a link to similar problem already fixed in BG2:EE in that topic.

I've encounterd similar problem in underdark AR2400 - there should be 1 respawn for UDMIND10.CRE located in a room at x=4195, y=1681. It has local script attached named UDMPSWN.BCS with this code:

IF
StateCheck(Myself,STATE_REALLY_DEAD)
Global("CDDieReplace","LOCALS",0)
THEN
RESPONSE #100
SetGlobalTimer("SpawnIllTimer","GLOBAL",TWELVE_MINUTES)
SetGlobal("spawnIll","AR2400",0)
SetGlobal("CDDieReplace","LOCALS",1)
END
In my game this block did not trigger (probably the script stopped working after creature death before it detected it). So I suggest moving this block to AR2400.BCS instead, to make it more reliable. For example like this:

IF
Global("CDDieReplace","AR2400",0)
OR(2)
StateCheck("udmind10",STATE_REALLY_DEAD)
Dead("udmind10")
THEN
RESPONSE #100
SetGlobalTimer("SpawnIllTimer","GLOBAL",TWELVE_MINUTES)
SetGlobal("spawnIll","AR2400",0)
SetGlobal("CDDieReplace","AR2400",1)
END
Sorry, I no longer have a save file. But it would be useless anyway as the STATE_REALLY_DEAD in local script problem seems to be a timing issue which is hard to reproduce.

@CamDawg, @Erg could you please comment on this issue if my workaround is indeed 100% reliable?

Comments

  • ErgErg Member Posts: 1,756
    edited August 2015
    Yes, the block should be moved from the dying creature to somewhere else, e.g. the area script, as you did or as I did here. In my case, the Dead() command was enough, but it may be preferable to add additional checks (STATE_REALLY_DEAD, etc.) just in case.

    Concerning reproducibility, see this or, for the Enhanced Editions, this.

    Edit: Sorry, I didn't take in account that there are several differences between your case and mine. In particular, in my case the creature was supposed to die only once. In your case Dead() will not work because it will return TRUE always once the first instance is dead. I think you should use Died("udmind10") instead.
    Post edited by Erg on
  • switswit Member, Translator (NDA) Posts: 495
    edited August 2015
    one more thing - in BG2 this script block in UDMPSWN.BCS looks like this:

    IF
    Die()
    THEN
    RESPONSE #100
    SetGlobalTimer("SpawnIllTimer","GLOBAL",TEN_ROUNDS)
    SetGlobal("spawnIll","AR2400",0)
    END
    which means that there should be infinite Mind Flyer spawn, not only 1 respawn like in BG2:EE. Not sure why CDDieReplace has been added to the script. That is why some people are confused with current behaviour:
    https://forums.beamdog.com/discussion/25072/i-ran-out-of-mind-flayers
    https://forums.beamdog.com/discussion/19686/mind-flayer-tunnels-spoilers-question
    https://forums.beamdog.com/discussion/28357/trapped-in-illithid-layer-bug-spoiler
  • ErgErg Member Posts: 1,756
    edited August 2015
    swit said:

    Not sure why CDDieReplace has been added to the script.

    Yes, it looks like a mistake. That single Mind Flyer is supposed to keep respawning, so players don't necessarily have to transform into the Slayer, if they want to avoid the reputation loss.

    Edit: in theory CDDieReplace should work if used locally to the creature, because it will be reset to zero once the creature is respawned, but it will not work if used locally to the area unless you add SetGlobal("CDDieReplace","AR2400",0) to the area script when the creature is respawned. Also see my edit above about replacing Dead() with Died().

    I cannot test in BGII:EE as I don't have it, but something like this should work:
    IF
    Global("CDDieReplace","AR2400",0)
    OR(2)
    StateCheck("udmind10",STATE_REALLY_DEAD)
    Died("udmind10")
    THEN
    RESPONSE #100
    SetGlobalTimer("SpawnIllTimer","GLOBAL",TWELVE_MINUTES)
    SetGlobal("spawnIll","AR2400",0)
    SetGlobal("CDDieReplace","AR2400",1)
    END
    followed but something like
    IF
    GlobalTimerExpired("SpawnillTimer","GLOBAL")
    GlobalGT("udMind","GLOBAL",17)
    Global("spawnill","AR2400",0)
    THEN
    RESPONSE #100
    SetGlobal("spawnill","AR2400",1)
    SetGlobal("CDDieReplace","AR2400",0)
    CreateCreatureDoor("udmind10",[4195.1681],4)
    END
    Post edited by Erg on
  • ErgErg Member Posts: 1,756
    edited August 2015
    One more thing:

    the modified script has now both variables "spawnill" and "CDDieReplace" on AR2400, but only one should be really required.

    Besides, maybe I'm overthinking it, but I'm not sure it is a good idea to use STATE_REALLY_DEAD here (IESDP says that CreateCreatureDoor requires 3.5 seconds for the creature to appear, and I'm not sure what StateCheck("udmind10",STATE_REALLY_DEAD) would return in that interval) and Died() should be enough, so maybe something like this in the area script is better:
    IF
    Global("CDDieReplace","AR2400",0)
    Died("udmind10")
    THEN
    RESPONSE #100
    SetGlobalTimer("SpawnIllTimer","GLOBAL",TWELVE_MINUTES)
    SetGlobal("CDDieReplace","AR2400",1)
    END

    IF
    GlobalTimerExpired("SpawnillTimer","GLOBAL")
    GlobalGT("udMind","GLOBAL",17)
    Global("CDDieReplace","AR2400",1)
    THEN
    RESPONSE #100
    SetGlobal("CDDieReplace","AR2400",0)
    CreateCreatureDoor("udmind10",[4195.1681],4)
    END
Sign In or Register to comment.