Starfinder Playlist
  1. #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();
    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.

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,693
    Blog Entries
    1
    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....

  3. #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.

  4. #4
    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

  5. #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'?

  6. #6
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,693
    Blog Entries
    1
    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...

  7. #7
    DB.findNode("npc")
    will you get you the correct node in this particular scenario.

    Regards,
    JPG

  8. #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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in