5E Character Create Playlist
  1. #1

    Core+5E - Altering NPC names in the combat tracker

    Hi,

    I'm looking into altering the NPC names in the combat tracker, as pr. this post: https://www.fantasygrounds.com/forum...combat-tracker

    As far as I can tell, the added number to the NPCs name (e.g. Thug 87) is done in the addNPCHelper in the core combat_manager.lua script.
    The 5e ruleset then uses the setCustomAddNPC function to add 5e specific stuff to the NPC node, doing this after calling addNPCHelper directly.

    If I want to change the name of the NPCs after this, I'm unsure of how to go about it.

    I can't really use the setCustomAddNPC, since that would replace the 5e function, correct? And I don't really want to override the 5e function, since that would tie the extension to the 5e ruleset and require an update each time the function changes.

    Any suggestion on how to go about this?

    Regards,
    Tideturner

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    No matter what you do and how you do it your changes can be affected by changes to Core/5e.
    I havent looked at the code but if the code is partly set in Core and further modified in 5e then you ay end up with a 5e only extension.
    The way to make an extension that has the least ongoing maintenance required is to only modify those functions from those files that actually directly relate to your task.
    Create a new folder in your /extensions directory called /extensions/npcnames and create an extension.xml file
    this file will link to / include all your additional files for this extension.
    If you create a new function/template/etc with the same name as an existing one - then this one will be used (depending on exactly how it is called).
    Then you would just need to check what files were updated in CoreRPG/5e when a new release comes out.

  3. #3
    Right, thanks, that got me started.

    If I just copy the entire CoreRPG/scripts/manager_combat.lua and add the following at the bottom:
    Code:
    function getCustomAddNPC()
        return fCustomAddNPC;
    end
    That will allow me to chain the 5E addNPC function without messing with either the core or 5e code, making maintenance much easier.

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
  •  
STAR TREK 2d20

Log in

Log in