-
June 28th, 2022, 10:50 #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
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 mannerLast edited by SilentRuin; June 28th, 2022 at 13:14.
Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
June 28th, 2022, 13:05 #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):
-
June 28th, 2022, 13:24 #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):
-
June 28th, 2022, 14:05 #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):
-
June 28th, 2022, 14:23 #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):
-
June 28th, 2022, 15:42 #36
These are the current open issues I'm waiting on an explanation from SW in TEST...
CT blank NPC action lines after nodes recreated - works in LIVE fails in TEST
CombatManager2.addNPC is no longer present and calling the CombatManager.addNPC in the callback causes infinite loop nowFree(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
June 28th, 2022, 16:36 #37
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,541
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
-
June 28th, 2022, 19:08 #38
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):
-
June 28th, 2022, 19:27 #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):
-
June 28th, 2022, 19:38 #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