1 Attachment(s)
Further digging into the Encounter/NPC code break
So, further digging into the Encounter/NPC code break, I unzipped the CoreRPG ruleset and found the file/reference the error produces - "campaign/scripts/encounter_npclist.lua" which looks like this:
Code:
if draginfo.isType("shortcut") then
local sClass,sRecord = draginfo.getShortcutData();
NPCManager.addLinkToBattle(window.getDatabaseNode(), sClass, sRecord);
return true;
end
end
and the actual addLinkToBattle function (in CoreRPG's "manager_npc.lua" file)
Code:
function addLinkToBattle(nodeBattle, sLinkClass, sLinkRecord, nCount)
local sTargetNPCList = LibraryData.getCustomData("battle", "npclist") or "npclist";
if sLinkClass == "battle" then
local nodeTargetNPCList = DB.createChild(nodeBattle, sTargetNPCList);
for _,nodeSrcNPC in pairs(DB.getChildren(DB.getPath(sLinkRecord, sTargetNPCList))) do
local nodeTargetNPC = DB.createChild(nodeTargetNPCList);
DB.copyNode(nodeSrcNPC, nodeTargetNPC);
if nCount then
DB.setValue(nodeTargetNPC, "count", "number", DB.getValue(nodeTargetNPC, "count", 1) * nCount);
end
end
else
local bHandle = false;
local sLinkSourceType = NPCManager.getNPCSourceType(sLinkRecord);
if sLinkSourceType == "npc" then
bHandle = true;
else
local aCombatClasses = LibraryData.getCustomData("battle", "acceptdrop") or { "npc" };
if StringManager.contains(aCombatClasses, sLinkSourceType) then
bHandle = true;
elseif StringManager.contains(aCombatClasses, sLinkClass) then
ChatManager.SystemMessage(Interface.getString("battle_message_wrong_source"));
return false;
end
end
if bHandle then
local sName = DB.getValue(DB.getPath(sLinkRecord, "name"), "");
local nodeTargetNPCList = DB.createChild(nodeBattle, sTargetNPCList);
local nodeTargetNPC = DB.createChild(nodeTargetNPCList);
DB.setValue(nodeTargetNPC, "count", "number", nCount or 1);
DB.setValue(nodeTargetNPC, "name", "string", sName);
DB.setValue(nodeTargetNPC, "link", "windowreference", sLinkClass, sLinkRecord);
local nodeID = DB.getChild(sLinkRecord, "isidentified");
if nodeID then
DB.setValue(nodeTargetNPC, "isidentified", "number", nodeID.getValue());
end
local sToken = DB.getValue(DB.getPath(sLinkRecord, "token"), "");
if sToken == "" or not Interface.isToken(sToken) then
local sLetter = StringManager.trim(sName):match("^([a-zA-Z])");
if sLetter then
sToken = "tokens/Medium/" .. sLetter:lower() .. ".png@Letter Tokens";
else
sToken = "tokens/Medium/z.png@Letter Tokens";
end
end
DB.setValue(nodeTargetNPC, "token", "token", sToken);
else
return false;
end
end
return true;
end
So it's either breaking on the DatabaseNode, the Class, or the Record. Since this works in native MoreCore (which is probably calling these nodes correctly), it's something inside the OSE handler for NPCs that is missing data in one of these 3 things - which is weird because it looks like basic data handling (you can still drag NPCs, by their shortcuts, into the Combat Tracker).
How MoreCore displays NPCs in Encounters.
Attachment 48683
I think OSE has some kind of missing/broken link to any of the elements shown in the MoreCore Encouter/NPCs : The token, the # of NPCs, the name string, the ID, the Faction, the Skull shortcut (to the individual NPC stats)
Where these are stored/defined in the OSE rules, I do not know. Some kind of definition file for NPC data OR the way the NPC data is handled (like the above manager_npc.lua file). From what I can see inside the OSE ruleset, there doesn't seem to be any custom handler so it relies on the CoreRPG/MoreCore functionality and breaks due to a disconnect of fields/datatypes stored.
Really wish the Extension creator hadn't abandoned their code for a year.