Bug Discussion: Unending Curses

Discussion in 'General Modification' started by Rudy, Mar 24, 2015.

Remove all ads!
  1. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    So, I was trying to create a Remove Curse potion, so to test it, I cast Bestow Curse on my barbarian, cursed him, then tried to use the potion. Curse remained. Okay, huh.

    Then I tested casting Remove Curse on him. Nothing. Multiple times.

    To make matters worse, neither the Bestow Curse nor the Remove Curse spell ever ends, judging by the console. This is spite of both codes using "spell.spell_end( spell.id )".

    I'm trying to figure out what might be going on, but any thoughts on the matter are appreciated.
     
  2. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    578
    Likes Received:
    60
    Bestow Curse has a duration of 'permanent', so maybe both actually stay on forever, cancelling each other out. My initial observation is that both spells have "spell.duration = 0" in their script, which is maybe a signal for infinite duration?

    I'm not sure why the Remove Curse isn't working, but I have confirmed your test that it is definitely NOT removing the curse. I'll post if I find anything more.
     
  3. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    I tried changing the spell duration, but it didn't fix the problem.

    Also, having Jaroo do the resurrection thing doesn't fix the problem either. Still cursed.
     
  4. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    What are some monsters that curse you? I should test this with curses cast by hostiles.
     
  5. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    578
    Likes Received:
    60
    create 14425

    It's a witch from the broken tower. The 4th spell she casts is "Bestow Curse" every time. Just set your wisdom low so u fail your save. I can't remove her curse either.
     
  6. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    Figured part of the problem out, and boy is it stupid.

    The code for remove curse currently reads:

    return_val = target.partsys_id = game.particles( 'sp-Remove Curse', target.obj )
    if return_val == 1:
    target.obj.condition_add_with_args( 'sp-Remove Curse', spell.id, spell.duration, 0 )

    Which basically says "Apply the particle effect; if the particle effect returns 1, then remove the curse". What is should say is:

    if target.obj.condition_add_with_args( 'sp-Remove Curse', spell.id, spell.duration, 0 ):
    target.partsys_id = game.particles( 'sp-Remove Curse', target.obj )

    Aka "Remove the curse; if the curse is removed, apply the particle effect".

    The code switched the condition and the effect :facepalm:.

    Making that change causes the curse to be removed correctly, and ends the Bestow Curse Spell. The Remove Curse spell still appears to be eternal, though, so working on figuring that out.
     
  7. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    578
    Likes Received:
    60
    Nice detective work! But that's some really screwed up code. Looks like someone copy/pasted in haste and never tested it.

    Just searched the forums for remove curse and quite a few frustrated posts about curses never going away. I guess they were never used enough by enemies for it to upset enough players to be a concern.
     
  8. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    Fixed the second problem; it needed a:

    spell.target_list.remove_target( target.obj )

    before ending the spell. Useful information I didn't know before: apparently you cannot manually end a spell while it still has targets; that's why so many of the spells have code like spell.target_list = [] at the end.

    Anyway, I'll document and include this in my next version.

    Thanks for the input and thoughts.
     
  9. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    Heh, yeah; just looked at that too. Not clear that it was ever acknowledged to be an independent bug, as opposed to the claims of 'generic spell permanency bug'.
     
  10. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    There's a similar problem with Remove Fear; it's got the same backward effect/condition coding. Fixing it, though, doesn't actually cause it to, you know, actually remove fear. As tested by casting "Cause Fear" on one of my party members, then trying to remove it.

    I'm not going to poke at it anymore right now, because I'm more interested in working on other things at the moment. Just a note for now.
     
  11. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    578
    Likes Received:
    60
    Well here's a few that partially work, maybe you know about them and can confirm or deny this is true. This is what I've experienced.

    Remove Paralysis:
    - removes effect of hold person
    - does not remove a lacedon's paralysis​

    Lesser Restoration:
    - removes stat damage from crippling strike
    - does not remove stats drain from ray of enfeeblement ​


    Thanks for the remove fear fix, I'll be adding that too.
     
  12. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    I'm not sure about Remove Paralysis, but Lesser Restoration is working as intended there; ray of enfeeblement gives you a strength penalty; it does not cause strength damage, and so can't be restored. It can be dispelled, or one can wait for it to wear off.

    And, to be clear on the remove fear, the "fix" doesn't actually fix it. It still doesn't remove fear :(
     
  13. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    578
    Likes Received:
    60
    Hmm, PHB 3.5 and also the TOEE help says it's supposed to remove the damage from ray of enfeeblement too. The game has implemented it as you say, but I don't think that's how it is meant to work.

    Yeah I notice the Cause Fear fix didn't work either too. The duration is so short it's hard to test.

    Also, how did you manage to have the potion only have 1 target, did you create a new spell for these?
     
  14. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    Ah, you are correct here. I was thinking of Pathfinder rules, where lesser restoration affects ability damage but not penalties. However, I don't think there is anything that one could do in the spell code to fix this; it would require a targeted dispel of the ray of enfeeblement, and that's not something that I think can be done.

    Oh, no; I didn't make a potion of Remove Fear; I'm testing with just the spells themselves.

    Unfortunately, as you suspect, any spell that can have more than one target, such as Remove Fear, requires that you create an internal spell; note that the potion of haste which is craftable in the base game has an internal Potion of Haste spell to account for this.

    I also didn't make the Rage potion, which is already in the protos, craftable for the same reason.

    I'm not sure it will be worthwhile to create an internal spell for remove fear; it certainly won't be worthwhile if the spell doesn't do anything, as is currently the case.
     
  15. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    578
    Likes Received:
    60
    Need to test this, but the description of Remove Fear says:

    "You instill courage in the subject, granting it a +4 morale bonus against fear effects for 10 minutes. If the subject is under the influence of a fear effect when receiving the spell, that effect is suppressed for the duration of the spell. "

    And in the script we have:

    spell.duration = 0


    That's probably why it isn't working. I'm playing with the duration (which is supposed to be 10 minutes/level), and I'll see what happens.

    It is an abjuration with a duration, as opposed to a conjuration (cures/remove paralysis/remove disease/remove blindness), so it really could be called Protection from Fear.

    Can't get it to work. 'sp-Remove Fear' is probably not functioning internally.
     
    Last edited: Mar 24, 2015
Our Host!