Holy Word killed my CG PC

Discussion in 'The Temple of Elemental Evil' started by florian1, Dec 15, 2017.

Remove all ads!
  1. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,009
    Likes Received:
    255
    I would suggest you check the other alignment based high level cleric spells for this bug too.
     
  2. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    706
    Likes Received:
    112
    Just found this little function in utilities.py. It's from vanilla, so they must have wanted it for a reason.

    Code:
    def pyspell_targetarray_copy_to_obj_list( spell ):
       copy_list = []
       for item in spell.target_list:
           copy_list.append( item.obj )
       return copy_list
    
    Though i don't ever see it used in code, I remember needing to do this for some spell where it was looping thru the list, and stopped half-way thru. Like there were 8 targets, and it only processed the first 4 of them. Doing this fixed the problem.

    Edit: It was when I got Dispel Magic to do an area effect instead of a single target. The loop stopped about half way through.
     
    Last edited: Dec 23, 2017
  3. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,627
    Likes Received:
    538
    That sort of thing is probably the intended usage. It's rather peculiar that you don't see it in any script. My guess is that the author (probably Huy Nguyen or Steve Moret) anticipated such cases and wrote this for those, but never used it in practice.

    I was quite troubled by the fact this bug supposedly hadn't manifested in vanilla, but as it turns out it CAN happen - just under very, very specific circumstances. Part of that is because of another, unrelated bug relating to caster level.
    To recreate it, you must:

    1. Have summoned / Extraplanar creatures die from the spell, but NOT due to having low HD relative to the caster. The reason is that it must apply the sp-Blindness or sp-Deafness conditions before killing the critter!
    This already restricts the situation to stuff like the Nodes (where Summoned / Extraplanar creatures are more common), so if you tested it elsewhere you might not see it.
    2. Relating to this is the Caster Level bug, which inflates the Caster Level for every target in the target list for casters with the Good domain (which is probably one of the most common ones since folks want to craft Holy weapons usually...). This would usually result in the critters being killed due to "low HD" (relative to the inflated Caster Level) rather than due to being Summoned.
    3. The order of the target list matters - I've had the bug kill the second Efreeti instead of a party member due to how it was ordered in one of the tries.

    It's funny because Temple+ fixes the Caster Level bug, only to have this one crop up instead :p

    Attached the file I used for diagnostics (without the fix). It'll create holyword.txt under modules\ToEE with the debug output.
     

    Attached Files:

    florian1 likes this.
  4. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    706
    Likes Received:
    112
    I was finally able to see the target list change, once I spawned some efreeti. :)

    So, just to clarify:

    The issue of caster level, and whether the creature is summoned or extraplanar are not the real problems, those were just roadblocks to recreating and finding the bug.

    The actual problem itself is that when you add one of the conditions (blindness, deafness, or hold monster) and then kill the creature by any means, the creature is removed from spell.target_list, upsetting the loop.

    The double kill happens in the code below. Right after the 52d52 kills the creature, that creature is removed from spell.target_list. Then in the very next line, when target_item.obj.critter_kill() is called, the wrong guy (often a PC) is killed since the list was altered.

    Code:
     # creature is sent back to its own plane
     # kill for now
     if not target_item.obj in game.leader.group_list():
         target_item.obj.damage( game.leader , D20DT_POSITIVE_ENERGY, dice_new("52d52"))
         # So you'll get awarded XP for the kill
    target_item.obj.critter_kill()
    
     
    Last edited: Dec 26, 2017
  5. Endarire

    Endarire Ronald Rynnwrathi

    Joined:
    Jan 7, 2004
    Messages:
    988
    Likes Received:
    122
    Remember that holy word acts similarly to dictum, blasphemy, and word of chaos. Ensure those are also fixed.
     
  6. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,627
    Likes Received:
    538
    Thanks, they also had the same issue (since they were nearly carbon copies..). Fixed.
     
Our Host!