-
Creating NPC entries
I'm not clear on how to create NPC entries, or any entries for that matter, into the database such that they show up.
Looking at
* CoreRPG/campaign/template_campaign.xml
* CoreRPG/campaign/scripts/campaign_button_new.lua
* CoreRPG/campaign/campaign_npcs.xml
* CoreRPG/campaign/record_npc.xml
It appears that I need to create a database node through createChild() which will create a node beneath npc from
ln 8 @ campaign_button_new.lua
Code:
local node = window.getDatabaseNode().createChild();
Which I infer that the node is based off the window from where the button is pressed which is the npc list ? I'll try this out later, I'm just sensing around the structure.
I'm assuming that I'd need to get the node of the npc list as my method will be external and not launch from the npc list, so I need a way to get a node by name. From raking through the ruleset reference, I'm not coming up with anything.
-
Im not sure I understand where/what you are doing.
CoreRPG has all that built in. You would normally expand via (layered) ruleset or extension, the attributes of the NPC and all the work on creating the base nodes is already done for you in those files.
Apologies if I have misunderstood what you are trying to do....
-
I'm creating an extension that adds NPC entries. The goal here is to get a reference to the npc list node object without relying on receiving it from windowinstance.
-
The NPC list is opened from a sidebar button that specifies that a window be opened using the "npclist" class and the "npc" data path. From there, the new button gets the "npc" data path node with the window.getDatabaseNode() call to make the createChild() call.
Basically, to add a record within a ruleset, you have to know the data path where the ruleset expects records of a specific type to be stored. In this case, NPCs are stored under the "npc" data path.
Regards,
JPG
-
So how can I get a database node of /root/npc such that I can create entries for it without working off a window connected to the npc 'data path'?
-
what interface are you intending to use to add these?
at the moment when you create objects within FG it is usually done from within the campaign tool (like npcs) and sometimes it can also be done from a char sheet (like inventory) - but these will be stored under the character node and not the item node...
-
DB.findNode("npc")
will you get you the correct node in this particular scenario.
Regards,
JPG
-
Thanks Moon, Damned.
It seems it was there all along; but I was more fixated on DatabaseNode for some reason.
https://www.fantasygrounds.com/refdoc/DB.xcp#findNode