Thread: Creating NPC entries
-
May 27th, 2016, 04:12 #1
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();
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.
-
May 27th, 2016, 05:07 #2
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....
-
May 27th, 2016, 06:34 #3
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.
-
May 27th, 2016, 06:59 #4
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,613
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
-
May 27th, 2016, 07:52 #5
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'?
-
May 27th, 2016, 11:25 #6
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...
-
May 27th, 2016, 23:28 #7
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,613
DB.findNode("npc")
will you get you the correct node in this particular scenario.
Regards,
JPG
-
May 28th, 2016, 14:13 #8
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
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks