(Serious?) Problem with Elixir internal spell effects

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

Remove all ads!
  1. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    I don't know if this is only the case with elixirs (of hiding, sneaking, vision) but it is the only ones I have found this problem on. To be clear, this problem happens with the files unchanged by me; this is not a result of my modding, though that is how I noticed it.

    In brief, these effects never end, internally. The skill bonus goes away after an hour, as it is supposed to, but the spell effect never ends, as can be seen by the fact that in the console the "Elixir of vision OnBeginRound" remains after months of in-game time, for example.

    I can't see any difference in the .py files, as compared to other spells, which would cause this difference. However, there ARE two lines commented out in the py files for all three elixirs, which say:

    spell.target_list.remove_target( target.obj )
    spell.spell_end( spell.id )

    Which is obviously an attempt to force the spell effect to end. And, indeed, if I remove the comment from those lines, the elixirs seem to work fine, and the elixir effect does not linger. However, given that they were commented out, I have to imagine there was a reason for that.

    I'm hoping someone has an idea what is causing this; it can't be good to have those spell effects lingering indefinitely, especially if you use multiple elixirs.

    For reference, the spell ids are 730-732.
     
  2. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    551
    Likes Received:
    27
    If it's any help I Beyond-Compared the original file from vanilla with the Co8 file from V8.1.0, and they are identical. So the commented out part has been there from the beginning.

    You're thinking someone either commented them out to debug something and forgot to uncomment them, or there wan a bug found and that was the best fix for it they could come up with. We'll probably never know unless you call the Troika customer support number. :roll:

    Next time I play, I'll try using one of them with those lines Uncommented to see if it messes up anything else in my adventure.
     
  3. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    I think I am going to just remove the comments; it seems safer than leaving the spell effect there eternally.

    If the comments had been made by the Co8 team, that would be one thing, but since they aren't, as you say, probably just another oversight in the code.

    Especially because, it turns out, there are many spells that do use those commands to end the spell. See spell 562, Deep Slumber, for example, or ray of frost, which uses the exact same commands.

    I'll wait a bit to add the change to a version of my mod, in case any of the experts round here have some thoughts on this, but for my own game I'm definitely removing the comments.
     
    Last edited: Mar 17, 2015
  4. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    I think I figured out why it is just the elixirs that this happens to.

    Every other spell, at least every one I've looked at, has one of two things true.

    One, they use the spell_end command to end the spell.

    Two, they use the condition_add_with_args command, and pass it spell.id and spell.duration as the second & third parameters.

    The elixir effects do not do either of these; they use the condition_add_with_args command, but do not pass it spell.id or spell.duration.

    Here is my working theory:

    The condition_add_with_args command has an internal routine which ends the spell effect when the added condition ends; this is why it needs spell.id and spell.duration as parameters. Spell code that do not use condition_add_with_args have to end the spell themselves, using spell_end.

    The elixir effects do not pass condition_add_with_args spell.id or spell.duration, and so there is no way for condition_add_with_args to end the spell, since it lacks the reference info. Indeed, I tested this by changing the parameters for the elixirs, and it did indeed fix the problem.

    However, this is not a useable fix, because for whatever idiotic reason, the 'Elixer Timed Skill Bonus' condition (not my spelling), which is what the elixirs use, uses the parameter that should be spell.id to instead get an index number which determines what skill to add the bonus to.

    Finally, I surmise that at some point the lines ending the spell were commented out because someone was going through, saw that the spell used condition_add_with_args, and assumed that would take care of ending the spell. But they were wrong.

    In conclusion: remove the comments. Unless someone experienced here gives me good reason not to, I'll be including that change in the next version of my little mod.
     
  5. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    551
    Likes Received:
    27
    Looks like a valid analysis, I agree.

    I'm just now starting to add all your mods to my adventure mod, but since my files diverged from the baseline last year when I started making changes myself, I can't just drop all your changed in all at once. I have to go thru each of you changes individually and painstakingly with Beyond Compare and add them in one by one. Ug.

    But this is seriously a ton of stuff I'd wanted to get to myself, so thanks for doing it for me. :)

    I was just thinking the other day that there was no non-enhanced Elven Chain, and saw you did that too. Nice move picking the regular mesh and not the whimsical purple elven chain sillyness.

    On topic with this thread, I'm wondering if you should make a Potion of Vision, just so there's a potion and elixir of each (sneaking, hiding, vision)?
     
  6. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    Nah; I don't think there's any reason to have two different items that do exactly the same thing. The only reason I didn't remove the Potions of Hiding and Sneaking is that they are already in the game, and Gaear didn't like the idea of me replacing them with the equivalent elixir.

    Were I doing this purely for myself, I would have substituted in elixirs only, since there is no "Potion of Sneaking" in PnP, but it's a minor complaint.
     
Our Host!