TALES of the VALIANT
  1. #1

    Looking for piece of code that is fired when an effect is deleted

    effect_delete.PNG

    I tried "removeEffect" in manager_effect.lua script and that is not it.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    34,049
    This is handled in CoreRPG scripts\manager_combat.lua.

    onDeleteCombatantEffectEvent will be called, and this will run any custom delete combat effects functions that have been registered with setCustomDeleteCombatantEffectHandler in the same script. For an example, look at how this is used in scripts\manager_actor_display.lua where a function is registered with CombatManager.setCustomDeleteCombatantEffectHandle r.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3

  4. #4
    BTW, what is "nodEffectList"? is it a string?
    I tried this and got an error
    function onDeleteCombatantEffectEvent(nodeEffectList)
    local nodeCT = DB.getChild(nodeEffectList, "..");
    for _,nodeEffect in ipairs(nodeEffectList) do
    ....

  5. #5
    I tried using a Debug.chat("effect list " .. tostring(nodeEffectList)) and got this

    s'effect list userdata: 000001E473665388'

    What do I do with that? I am just trying to get the name of the effect being deleted.

  6. #6
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    34,049
    Sorry, I didn't fully look at the example I provided as I was in a rush. That is for deleting effects when an actor is removed from the combat tracker. Sorry about the false lead.

    With a brief search, I can't find an individual effect delete handler in CoreRPG. If you're coding on top of another ruleset, there may be one already in that ruleset. Otherwise, you can setup a DB handler to process the on delete events, for example, the following code will run a custom "onCTEffectDelete" function when any effect is deleted from any actor in the combat tracker:

    Code:
    DB.addHandler("combattracker.list.*.effects.*"), "onDelete", onCTEffectDelete);
    Refer to the DB.addHandler function here: https://fantasygroundsunity.atlassia...s/996644582/DB
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  7. #7
    Quote Originally Posted by Trenloe View Post
    Sorry, I didn't fully look at the example I provided as I was in a rush. That is for deleting effects when an actor is removed from the combat tracker. Sorry about the false lead.

    With a brief search, I can't find an individual effect delete handler in CoreRPG. If you're coding on top of another ruleset, there may be one already in that ruleset. Otherwise, you can setup a DB handler to process the on delete events, for example, the following code will run a custom "onCTEffectDelete" function when any effect is deleted from any actor in the combat tracker:

    Code:
    DB.addHandler("combattracker.list.*.effects.*"), "onDelete", onCTEffectDelete);
    Refer to the DB.addHandler function here: https://fantasygroundsunity.atlassia...s/996644582/DB
    Actually I think you were on the right track, I added a little "Hello" debug statement in that function when the effect is deleted and it fired. I just need to find out how to process the nodeEffectList user data.

  8. #8
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    34,049
    Quote Originally Posted by alloowishus View Post
    Actually I think you were on the right track, I added a little "Hello" debug statement in that function when the effect is deleted and it fired. I just need to find out how to process the nodeEffectList user data.
    In this process you will just get the node that was being deleted. It's a FG databasenode object: https://fantasygroundsunity.atlassia...2/databasenode Hence why you get user data if you try to convert it to a string, as you can't convert an object to a string. Just output the object as part of the debug output but use a comma after the text string and FG will provide appropriate information relating to the object:

    Code:
    function onCTEffectDelete(nodeEffect)
      Debug.chat("Node being deleted = ", nodeEffect))
    end
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  9. #9
    Ok it looks like it is just the list of effects, not the actual effect that is being deleted

    s'effect list ' | databasenode = { combattracker.list.id-00006.effects }


    ...

  10. #10
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    34,049
    Quote Originally Posted by alloowishus View Post
    Ok it looks like it is just the list of effects, not the actual effect that is being deleted

    s'effect list ' | databasenode = { combattracker.list.id-00006.effects }


    ...
    Please provide the exact code you're using to setup the handler (DB.addHandler) and the handler function code.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

Thread Information

Users Browsing this Thread

There are currently 3 users browsing this thread. (0 members and 3 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
  •  
5E Character Create Playlist

Log in

Log in