Starfinder Playlist
Page 4 of 5 First ... 2345 Last
  1. #31
    Apologies, when Death Indicators was found to no longer be able to call CombatManager2.addNPC and it got replaced with CombatManager.addNPC - then for some reason its override of onHostAddNPC [CombatManager.setCustomAddNPC(onHostAddNPC);] started to infinite loop at this area of its code.

    Code:
    ---------------------------------------------------------------------------------------
    -- Called on the server to add a NPC to the combat tracker
    ---------------------------------------------------------------------------------------
    
    function onHostAddNPC(sClass, nodeNPC, sName)
    
    	-- Validate the nodeNPC parameter
    
    	if not nodeNPC then
    		Debug.console("NpcTokenManager.onHostAddNPC: Invalid nodeNPC parameter");
    		return nil;
    	end
    
    	-- Add the NPC to the combat tracker
    
    	local nodeCT = CombatManager.addNPC(sClass, nodeNPC, sName);
    
    	if not nodeCT then
    		Debug.console("NpcTokenManager.onHostAddNPC: Invalid combat tracker node");
    		return nil;
    	end
    
    	-- Retrieve the configured NPC token
    	
    	local sToken = getConfiguredNpcToken(nodeCT);
    
    	if not sToken or sToken == "" then
    		Debug.console("NpcTokenManager.onHostAddNPC: Invalid NPC token")
    		return nil;
    	end
    
    	if not Interface.isToken(sToken) then
    		Debug.console("NpcTokenManager.onHostAddNPC: Interface.isToken(" .. sToken .. ") = false")
    		return nil;
    	end
    		
    	-- Update the combat tracker node with the correct token and return
    
    	--Debug.console("manager_npc_token:onHostAddNPC; update CT token");
    	--Debug.console(sToken);
    	DB.setValue(nodeCT, "token", "token", sToken);
    	
    	return nodeCT;
    
    end
    My guess is that being forced to replace the original call to CombatManager2.addNPC with CombatManager.addNPC is what is causing this infinite loop.

    As I have no idea what the intent of this area of the code is, not having written it, I will have to delve into why CombatMnager2.addNPC was removed and what I can do to make this work now that it has.

    Thanks to MeAndUnique for pointing out my idiocy on "not returning the node" in an indirect manner
    Last edited by SilentRuin; June 28th, 2022 at 13:14.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  2. #32
    Ok I can see that CombatManager2.addNPC while removed has similar but not the same coding in CombatManager2.onNPCPostAdd. I am officially confused. What can I use to replace the original CombatManager2.addNPC behavior without suffering a callback infinite loop? They (addNPC vs onNPCPostAdd) differ in setting size and other things it appears.
    Last edited by SilentRuin; June 28th, 2022 at 13:12.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  3. #33
    Now equipped effects no longer works when dropping NPC into CT and applying effects. I'll have to find out what changed there too. Is there something that tells us the reasons things are changing and how? The single sentence in updates gives no clue as to what will be broken.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  4. #34
    Appears equipped effects is not processing the call

    local swClass, swRecord = DB.getValue(nodeCT, "link", "", "");

    for my npc as it used to - coming up both blank.
    Last edited by SilentRuin; June 28th, 2022 at 14:11.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  5. #35
    I think I see a recurring theme in some of my many issues that cropped up with the last release of TEST. I have overrides for CombatManager.addNPC - which are done as part of stuff I use to insure I get a hook in to all things that get added into the CT. But now doing a printstack - to see how I'm reaching some of the calls I'm getting - I see that those calls while calling addNPC are now calling them out of the new manager combat record. So even though it "appears" all my stuff is working in terms of overrides - they will now never be called.

    the new "function CombatRecordManager.addNPC(tCustom)"

    vs

    the old "function CombatManager.addNPC(sClass, nodeNPC, sName)"

    is very misleading. While you can call the old one still - overriding it will get you nothing - because nothing in the handlers/callbacks ever calls it anymore.

    I have changed all my old references and overrides to CombatManager.addNPC to CombatRecordManager.addNPC - this way I'm sure my overrides are being implemented across the board always no matter who's custom stuff is in play.
    Last edited by SilentRuin; June 28th, 2022 at 14:51.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  6. #36

  7. #37
    Do not override the CombatRecordManager.addNPC. There are now very specific calls you can make to override the existing behavior without monkeying around with the internals of the CoreRPG scripts (which will cause future breakage).

    Specifically,
    to override the overall NPC add behavior, you can use CombatRecordManager.setRecordTypeCallback("npc", fn)
    to just append to the default NPC add behavior, you can use CombatRecordManager.setRecordTypePostAddCallback(" npc", fn)

    Regards,
    JPG

  8. #38
    Quote Originally Posted by Moon Wizard View Post
    Do not override the CombatRecordManager.addNPC. There are now very specific calls you can make to override the existing behavior without monkeying around with the internals of the CoreRPG scripts (which will cause future breakage).

    Specifically,
    to override the overall NPC add behavior, you can use CombatRecordManager.setRecordTypeCallback("npc", fn)
    to just append to the default NPC add behavior, you can use CombatRecordManager.setRecordTypePostAddCallback(" npc", fn)

    Regards,
    JPG
    For what I'm doing the setRecordTypePostAddCallback will cause multiple errors and blank CT lines when I try to use it - and the setRecordTypeCallback looks to be designed that only the last person to define it will get to have that the behavior - meaning two extensions can't both override it as currently can be done when overriding COmbatRecordManager.addNPC. Or am I reading that wrong? I live in a many extension environment.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  9. #39
    I also found out why those CT lines are blank after the polymorphism. Because this call stack is no longer happening when I trigger the node change.

    From LIVE I get this for my override of parseNPCPower...

    stack traceback:
    [string "scripts/manager_equipped_effects.lua"]:439: in function 'parseNPCPower'
    [string "scripts/manager_combat2.lua"]:316: in function 'parseNPCPower'
    [string "scripts/manager_combat2.lua"]:206: in function 'addNPC'
    [string "scripts/manager_npc_token.lua"]:55: in function <[string "scripts/manager_npc_token.lua"]:44>
    (tail call): ?
    [string "scripts/manager_equipped_effects.lua"]:347: in function 'addNPC'
    [string "scripts/manager_campaigndata.lua"]:107: in function <[string "scripts/manager_campaigndata.lua"]:87>
    (tail call): ?

    For TEST I get nothing. Hence blank CT lines.

    All my issues seem to come back to manger_combat2.lua removal of addNPC - what is going on there? Why would I not get something similar triggered in the new overrides?
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  10. #40
    My problem is I need parseNPCpower called when a node is changed in the CT. Which works in LIVE but does not in TEST.

    In TEST the stack is this.

    Dropped NPC onto CT:

    stack traceback:
    [string "scripts/manager_equipped_effects.lua"]:439: in function 'parseNPCPower'
    [string "scripts/manager_combat2.lua"]:281: in function 'parseNPCPower'
    [string "scripts/manager_combat2.lua"]:204: in function <[string "scripts/manager_combat2.lua"]:107>
    (tail call): ?
    (tail call): ?
    [string "scripts/manager_combat_record.lua"]:36: in function 'onRecordTypeEvent'
    [string "scripts/manager_combat_drop.lua"]:124: in function 'handleLinkDropEvent'
    [string "scripts/manager_combat_drop.lua"]:78: in function <[string "scripts/manager_combat_drop.lua"]:70>
    (tail call): ?
    (tail call): ?


    Polymorph changing the nodes:

    parseNPCPower never called - no stack.


    In LIVE the stacks are both present as I would expect:

    Dropped NPC onto CT:

    stack traceback:
    [string "scripts/manager_equipped_effects.lua"]:439: in function 'parseNPCPower'
    [string "scripts/manager_combat2.lua"]:316: in function 'parseNPCPower'
    [string "scripts/manager_combat2.lua"]:206: in function 'addNPC'
    [string "scripts/manager_npc_token.lua"]:55: in function <[string "scripts/manager_npc_token.lua"]:44>
    (tail call): ?
    [string "scripts/manager_equipped_effects.lua"]:347: in function 'addNPC'
    [string "scripts/manager_campaigndata.lua"]:107: in function <[string "scripts/manager_campaigndata.lua"]:87>
    (tail call): ?

    Polymorph changing the nodes:

    stack traceback:
    [string "scripts/manager_equipped_effects.lua"]:439: in function 'parseNPCPower'
    [string "scripts/manager_combat2.lua"]:316: in function 'parseNPCPower'
    [string "scripts/manager_combat2.lua"]:221: in function 'addNPC'
    [string "scripts/manager_npc_token.lua"]:55: in function <[string "scripts/manager_npc_token.lua"]:44>
    (tail call): ?
    [string "scripts/manager_equipped_effects.lua"]:347: in function 'addNPC'
    [string "scripts/manager_polymorphism.lua"]:2223: in function 'savePolymorphActivated'
    [string "scripts/manager_AssistantGM.lua"]:82: in function 'PolymorphActivated'
    [string "scripts/manager_polymorphism.lua"]:363: in function 'fResult'
    [string "scripts/manager_actions.lua"]:622: in function 'resolveAction'
    [string "scripts/manager_actions.lua"]:595: in function 'handleResolution'
    [string "scripts/manager_actions.lua"]:570: in function <[string "scripts/manager_actions.lua"]:563>
    Last edited by SilentRuin; June 28th, 2022 at 19:45.
    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
  •  
5E Character Create Playlist

Log in

Log in