Holy Word killed my CG PC

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

Remove all ads!
  1. florian1

    florian1 Established Member

    Joined:
    Mar 15, 2010
    Messages:
    460
    Likes Received:
    17
    According to the description, Holy Word should only affect non-good creatures. They were in the Fire Node at the time. My wizard went from full hit points to dead. In the box that shows the die rolls and such, it just reported that the wizard died. No damage amount was indicated.

    I should mention that other good-PCs (including CG) that were within range of the spell did not suffer any ill effects.
     
  2. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    567
    Likes Received:
    30
    Fire node you say? Were you fighting Bodaks at the time? It may have cast a death gaze on you right after the spell was done, making it look like the Holy Word did it.

    If not, this is the big test in the Holy Words's script file. Only targets that pass this test will be affected:

    Code:
    if (alignment & ALIGNMENT_EVIL) or ( (alignment & ALIGNMENT_NEUTRAL) and not (alignment & ALIGNMENT_GOOD) ):
     
  3. florian1

    florian1 Established Member

    Joined:
    Mar 15, 2010
    Messages:
    460
    Likes Received:
    17
    It was against the guardian Balor. The wizard clearly died during my Cleric's turn. The Wizard had just taken a 5 five foot step away from three lesser demons that the Balor had summoned. Not sure if their deaths caused the wizard to die or not.

    Maybe the wizard had an evil thought just as the Holy Word let loose.
     
  4. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,438
    Likes Received:
    386
    Is it repeatable in any circumstance
     
  5. florian1

    florian1 Established Member

    Joined:
    Mar 15, 2010
    Messages:
    460
    Likes Received:
    17
    In will try and get back to you.
     
  6. florian1

    florian1 Established Member

    Joined:
    Mar 15, 2010
    Messages:
    460
    Likes Received:
    17
    OK, I just recreated the same situation, fighting the Guardian Balor in the Fire Node. This time my CG Dwarf Fighter died. It clearly happened during the Cleric's turn, as the Cleric still had to end his turn. I can email you the save file and and log file if you like.
     
  7. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    567
    Likes Received:
    30
    Can you post the save file here? I am very curious about this.
     
  8. florian1

    florian1 Established Member

    Joined:
    Mar 15, 2010
    Messages:
    460
    Likes Received:
    17
    Here is the save files bundled together in .rar file, and the temple+ log file also in .rar format. Using Co8 8.1 NC, and temple+ 0.56

    I hope I did the .rar files correctly.
     

    Attached Files:

  9. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    567
    Likes Received:
    30
    I think this may be a Temple+ issue, so I better leave this to the big boys. I was not able to see anything that could possibly do this in the spell's script from C08 8.1.
     
  10. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,438
    Likes Received:
    386
    I'll take a look this weekend. Really swamped right now.
     
  11. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,438
    Likes Received:
    386
    Ok that was a devious one. It was due to the manually-inflicted 52d52 damage that was being applied before the critter_kill effect.

    This triggered the spell_end event to fire for the killed critter, which removed it from the spell's target list (due to engine internals).
    After that, the target_item pointed to the next object in the list, which could be a party member, and it would then apply the critter_kill() method, killing them as well.
    I guess the short of it is that iterators are evil :p
    I think this would happen in vanilla ToEE as well, not 100% sure though.

    I'll issue a fix for Holy Word. Are there other AoE spells with instakill effects?

    Come to think of it, this could affect a whole bunch of AoE spells if targets get killed in the middle. Hmm...

    Edit: Ok, I was getting worried that it might fuck up spells like Fireball as well, but experience has shown that it doesn't.

    This is because other than killing targets that it shouldn't, the Holy Word bug was also shortening the target_list while iterating it, so in effect it would skip over targets (the ones immediately after anyone who got killed). I verified that this happened in Holy Word, but not in Fireball.

    The difference between Holy Word and Fireball is that Holy Word applies effect such as 'sp-Blindness' and 'sp-Deafness' before killing the critter. These spell conditions have callbacks that cause the target to be removed from the spell's target list when it is killed. In Holy Word, this causes the target list to change mid-script, and hence the fuckup reported above. In Fireball, you don't apply any such conditions, you just iterate over the target_list and apply damage via script, so you don't have these target-removing callbacks being called in the process.

    This is arguably due to mis-use of the above spells, but it's one of those cases where it's hard to separate the hard-core internals from scripting. I have a feeling Troika struggled with that sort of bug as well, which is why many AoE spell effects are hardcoded. Oh well. Will fix Holy Word at any rate.
     
    Last edited: Dec 23, 2017
    florian1 likes this.
  12. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    567
    Likes Received:
    30
    This could be fixed in the script by just making a duplicate of the target list and then looping thru the copy instead, leaving spell.target_list away from the processing in case it mutates along the way.

    BTW, I tested this for a few hours when I first saw the problem, and ran though countless scenarios and never saw the list change at any time. I'm not running Temple+ so I couldn't actually test florian's exact save.
     
  13. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,438
    Likes Received:
    386
    Yeah that's what I did. To be precise, you must copy the obj handles and bot the target_list itself.

    For this to trigger you have to have critters killed. Having more than 1 killed will increase the likelihood of this happening.
    The list changes between the applied damage and critter_kill lines.
     
  14. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    567
    Likes Received:
    30
    Somthing like this?

    Code:
    target_list_local = []
    for t in spell.target_list:
        target_list_local.append(t)
    
    for target_item in target_list_local:
    
    I want to put it into the spells on my mod just to be safe, even though I have yet to duplicate the problem.

    Also, while you're here :)

    Why do some spells remove the target list at the end of OnSpellEffect(), and some do not? If it only takes a short time to explain.
     
  15. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,438
    Likes Received:
    386
    Small but significant correction in 3rd line: append(t.obj)

    And then in the second for loop, you need to replace target_item.obj with just target_item. Unless you need its particle system id...

    I'm not 100% sure why some spells don't remove the target list. I think some spells inherently need to maintain a list of afflicted targets (AoE spells like Grease, for instance). I also know that for a spell to properly end when using spell.spell_end, it must have an empty target list (unless you force it by using spell.spell_end(spell.id, 1) ). So you should see remove_list right before spell_end, and vice versa.
     
Our Host!