5E Character Create Playlist
  1. #1

    Timing error when concentration fails remove effect triggering removal of node

    The problem is that 5E/scripts/manager_action_save.lua has the function expireConcentrationEffects triggered after a failed constitution saving throw.

    This loops over the current concentration effects in the CT entries and expires each one of them.

    Unfortunately, one of these nodeEffect entries triggers another function to remove a CT node entry. Which has concentration effects on it. The removed NPCs concentration effects were actually part of the expireConcentrationEffects aSourceConcentrationEffects list of concentration effects in CT, so that when the looping over of aSourceConcentrationEffects hits one of the ones in NPC CT entry - its treated as userdata instead of a database node. As its gone out of scope from the deletion of the CT entry containing them.

    This used to work fine, and I actually saw one of my many tests for this ERROR work also. So its timing.

    The error itself is

    [5/7/2024 11:22:33 AM] [ERROR] Handler error: [string "CoreRPG:scripts/manager_effect.lua"]:579: getValue: Invalid parameter 1
    stack traceback:
    [C]: in function 'getValue'
    [string "CoreRPG:scripts/manager_effect.lua"]:579: in function 'isGMEffect'
    [string "CoreRPG:scripts/manager_effect.lua"]:769: in function 'expireEffect'
    [string "5E:scripts/manager_action_save.lua"]:874: in function 'expireConcentrationEffects'
    [string "5E:scripts/manager_action_save.lua"]:868: in function 'applyConcentrationRoll'
    [string "5E:scripts/manager_action_save.lua"]:778: in function 'fHandler'
    [string "CoreRPG:scripts/manager_oob.lua"]:28: in function <[string "CoreRPG:scripts/manager_oob.lua"]:20>
    [C]: in function 'deliverOOBMessage'
    [string "5E:scripts/manager_action_save.lua"]:795: in function 'notifyApplyConc'
    [string "5E:scripts/manager_action_save.lua"]:832: in function 'fResult'
    [string "CoreRPG:scripts/manager_actions.lua"]:636: in function 'resolveAction'
    [string "CoreRPG:scripts/manager_actions.lua"]:609: in function 'handleResolution'
    [string "CoreRPG:scripts/manager_actions.lua"]:584: in function <[string "CoreRPG:scripts/manager_actions.lua"]:577>
    (tail call): ?

    What the above shows me is that while in the epireConcentrationEffects looping it does the first one successfully (effect is expired) - which triggers deletion of CT NPC node - then the next concentration effect in the loop gets hit but its nodeEffect is now userdata (instead of database). Not going to show the prints and overrides i temporarily did to code to verify my analysis was the correct one.

    The error itself happens after all my stuff (NPC node) is cleaned up - making it look like it worked - though i'm sure if there were other CT entry concentration effects from a different still existing entry - that it would fail to expire those.

    So, the question is how do I guard against the type userdata popping into things. I tried to override expireEffect and expireConcentrationEffects but of course it failed to recognize my changes (if type(nodeEffect) ~= "database" then don't process), likely caused by this being in some registered trigger function someplace (my override function has already been cached and my override is not actually on the one that got cached before my onInit). As this "used" to work, how do I get it to actually work?
    Last edited by SilentRuin; May 7th, 2024 at 17:35.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  2. #2
    It is unlikely that this used to work; as the situation you are describing was not coded to be handled and depending on execution order could have just not happened before.
    (i.e. there is nothing in the base 5E ruleset that would delete a CT entry when an effect is deleted; so that is not considered in the handling.)

    Since this is unique to your implementation, you would have to make sure that any references that could be deleted during your processes are not saved in any of the effect functions that could be mid-process. Given that I've added named calls to most of the global scripts, you should be able to override them unless there are calls remaining that aren't named.

    Regards,
    JPG

  3. #3
    Thanks! This made me try it again and I realized (in page 1 of this post) that the type is not database but databasenode. All fixed.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
FG Spreadshirt Swag

Log in

Log in