-
Yesterday, 04:18 #1
- Join Date
- Feb 2021
- Posts
- 408
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.
-
Yesterday, 04:27 #2
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!
-
Yesterday, 05:00 #3
- Join Date
- Feb 2021
- Posts
- 408
Thank you!
-
Yesterday, 05:09 #4
- Join Date
- Feb 2021
- Posts
- 408
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
....
-
Yesterday, 05:38 #5
- Join Date
- Feb 2021
- Posts
- 408
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.
-
Yesterday, 15:30 #6
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);
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!
-
Yesterday, 18:44 #7
- Join Date
- Feb 2021
- Posts
- 408
-
Yesterday, 19:08 #8
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!
-
Yesterday, 20:53 #9
- Join Date
- Feb 2021
- Posts
- 408
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 }
...
-
Yesterday, 21:13 #10Private 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 2 users browsing this thread. (1 members and 1 guests)
Bookmarks