Fantasy Grounds Fridays Pre
Page 2 of 2 First 12
  1. #11
    That is strange. This extension doesn't really do anything most of the time. It just hooks into the 'addNPC' path which is only triggered when a new creature is added to the combat tracker. The rest of the time it does nothing.

    Perhaps the other extension you're using is also hooking into this path and there is a conflict. What is the other extension, perhaps I can take a look?

    EDIT: Looking at the CombatManager code, it looks like there is another way to implement my extension that will avoid conflicts. Stay tuned...

    EDIT2: I couldn't get the alternative way to work. I still don't understand why you're seeing the symptoms you're seeing, it makes no sense.
    Last edited by darrenan; October 4th, 2021 at 18:33.

  2. #12
    This is really the entire extension, maybe one of the devs can explain why what I'm doing is causing the symptoms dellanx is seeing?

    local fPreviousAddCustomNPC;
    function onInit()
    	local msg = {sender = "", font = "emotefont"};  
    	msg.text = "Constant Effect Apply v1.01 for Fantasy Grounds PFRPG ruleset. Copyright 2021 Smiteworks. By darrenan"
    	fPreviousAddCustomNPC = CombatManager.getCustomAddNPC();
    function addNPC(sClass, nodeNPC, sName)
    	-- Call the previous function first.
    	local nodeEntry = fPreviousAddCustomNPC(sClass, nodeNPC, sName);
    	local aEffects = {};
    	local nodeSpellset = nodeEntry.getChild("spellset");
    	if nodeSpellset then
    		for _,nodeSpellClass in pairs(nodeSpellset.getChildren()) do
    			local nodeLevels = nodeSpellClass.getChild("levels");
    			if nodeLevels then
    				for _,nodeSpellLevel in pairs(nodeLevels.getChildren()) do
    					local nodeSpells = nodeSpellLevel.getChild("spells");
    					if nodeSpells then
    						for _,nodeSpell in pairs(nodeSpells.getChildren()) do
    							local nodeActions = nodeSpell.getChild("actions");
    							if nodeActions then
    								for _,nodeAction in pairs(nodeActions.getChildren()) do
    									local nodeApplyOnLoad = nodeAction.getChild("applyonload");
    									if nodeApplyOnLoad and nodeApplyOnLoad.getValue() == 1 then
    										local sEffect = nodeAction.getChild("label").getValue();
    										EffectManager.addEffect("", "", nodeEntry, {sName = sEffect, nDuration = 0, nGMOnly = 1}, false);
    	return nodeEntry;

  3. #13
    The other way I tried doing this today, was to add 'onUpdate' handlers to the 'applyonload' and 'label' nodes using DB.addHandler with wild-carded paths. I would store the updated node values for both nodes in a table, and when I had both values I would call EffectManager.addEffect. Even though the parameters to EffectManager.addEffect were identical to those in the code snippet above, for some reason the effect would not get added to the CT Node. Is that some peculiarity of trying this within an 'onUpdate' handler? I don't know. I also tried changing EffectManager.addEffect to EffectManager.notifyApply, which uses an out-of-band message to add the effect. This also did not work, the effect did not get applied.

Thread Information

Users Browsing this Thread

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

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 Forge

Log in

Log in