Fantasy Grounds Merchandise
  1. #1

    Duplicating the Type field in the NPC sheet and in the search of the NPC module

    Hello fellow roleplayers!

    I would like to know if there is an easier way to duplicate the "Type" field of the NPC sheet and also make it searchable in the NPC module like the "Type" field.

    I want to make a "Location" field and if possibly others.

    I believe there are at least two ways of doing that ?

    By modifying the existing master data or by using an extension ?

    What do you suggest and do you have any insight on how I might do that ?

    Thank you for your help!

    LordDante123

  2. #2

  3. #3

    Join Date
    Sep 2020
    Location
    Ballston Lake, NY
    Posts
    832
    Are you looking for something like in this image? It's highlighted in green boxes and it's called region rather than location.
    region.jpg
    Add feature suggestions for Savage Worlds to Fantasy Grounds Feature Request.

  4. #4
    Quote Originally Posted by damned View Post
    You will need to crack open the ruleset and look at the code and then write an extension.
    Thanks, I will look into it.

    Quote Originally Posted by Mike Serfass View Post
    Are you looking for something like in this image? It's highlighted in green boxes and it's called region rather than location.
    region.jpg
    Yes, that would be great. I only have Toughness, Type and Wilcard in the search and Type in the main tab of the NPC sheet.

  5. #5
    Doswelk's Avatar
    Join Date
    Jul 2005
    Location
    Surrey, UK
    Posts
    2,737
    Not all modules will have data there, until Savage Pathfinder came along (and I got Ikael to update the SWD/SWADE/SWPF Base code) that field was hidden and used to contain NPC I think it was used by the combat tracker, that said being able to search that field (assuming it has been filled out) is a brilliant idea, +1 from me!
    My players just defeated an army, had a dogfight with aliens, machine-gunned the zombies, stormed the tower, became Legendary and died heroically

    Yours are still on combat round 6

    Get Savage
    Ultimate License Holder.
    First GM to post a game for the original FG Con!

  6. #6
    Hey there,

    After some search in the ruleset, I think I've found most of the stuff if not all.

    So I guess I now need to make :
    • an extension to add another field
    • a script based on the one I found
    • and register them in some lua file or something


    Thank you for your help.

    Here is the file and code I've found :

    SavageWorlds.pak\campaign\record_npc_xml
    Code:
    <!-- 
    	Please see the license.html file included with this distribution for
    	attribution and copyright information.
     -->
    <root>
    <windowclass name="npc" copy="record_window_tabbed">
    <sizelimits>
    <minimum width="365" height="440"/>
    </sizelimits>
    <minimize>minimized_npc</minimize>
    <gmexport>npc</gmexport>
    <tab>
    <name>main</name>
    <resource>tab_main</resource>
    <class>npc_main</class>
    <embed/>
    </tab>
    <tab merge="add">
    <name>traits</name>
    <resource>tab_traits</resource>
    <class>npc_traits</class>
    <embed/>
    <activate/>
    </tab>
    <tab merge="add">
    <name>combat</name>
    <resource>tab_combat</resource>
    <class>npc_combat</class>
    <embed/>
    </tab>
    <tab merge="add">
    <name>pictures</name>
    <resource>tab_pictures</resource>
    <class>record_content_pictures</class>
    <embed/>
    </tab>
    <script> function onInit() super.onInit(); if Session.IsHost then NPCManagerSW.initializeAttackTypes(getDatabaseNode()); NPCManagerSW.initializePowers(getDatabaseNode()); end self.onIDChanged(); end function onIDChanged() self.onLockChanged(); if not Session.IsHost then local bID = LibraryData.getIDState("npc", getDatabaseNode(), true); tabs.setVisible(bID); end end </script>
    </windowclass>
    <windowclass name="npc_header" merge="join">
    <script> function update() super.update(); local nodeRecord = getDatabaseNode(); local bReadOnly = WindowManager.getReadOnlyState(nodeRecord); wildcardtool.update(bReadOnly); if not Session.IsHost then local bID = LibraryData.getIDState("npc", nodeRecord); wildcardtool.setVisible(bID); end end </script>
    <sheetdata>
    <hs name="wilddie"/>
    <hn name="wildcard"/>
    <record_wildcardtool name="wildcardtool" insertbefore="name"/>
    </sheetdata>
    </windowclass>
    <windowclass name="npc_main">
    <script file="campaign/scripts/npc_main.lua"/>
    <sheetdata>
    <anchor_column name="columnanchor"/>
    <label_column name="type_label">
    <static textres="npc_label_type"/>
    </label_column>
    <string_columnh name="type">
    <delaykeyupdate/>
    </string_columnh>
    <label_column name="conviction_label">
    <static textres="npc_label_conviction"/>
    <tooltip textres="npc_toolip_conviction"/>
    </label_column>
    <npc_conviction name="conviction"/>
    <line_column name="divider"/>
    <ft_columnh name="text">
    <empty textres="ft_empty"/>
    </ft_columnh>
    <header_column_sw name="gear_header">
    <static textres="npc_gear"/>
    </header_column_sw>
    <npc_gear name="gear"/>
    </sheetdata>
    </windowclass>

    SavageWorlds.pak\campaign\scripts\main_npc.lua

    Code:
    --
    -- Please see the license.html file included with this distribution for
    -- attribution and copyright information.
    --
    
    function onInit()
    	OptionsManager.registerCallback("CONV", update)
    	self.update()
    end
    function onClose()
    	OptionsManager.unregisterCallback("CONV", update)
    end
    function VisDataCleared()
    	self.update()
    end
    function InvisDataAdded()
    	self.update()
    end
    
    function update()
    	local nodeRecord = getDatabaseNode()
    	local bReadOnly = WindowManager.getReadOnlyState(nodeRecord)
    	local bID = LibraryData.getIDState("npc", nodeRecord)
    	local bHideConviction = not OptionsManager.isOption("CONV", "on")
    
    	local bSection1 = false
    	if type.update(bReadOnly) then bSection1 = true end
    	if conviction.update(bReadOnly, bHideConviction) then bSection1 = true end
    	divider.setVisible(bSection1)
    	
    	text.update(bReadOnly)
    	gear.update(bReadOnly)
    end
    
    function onDrop(x, y, draginfo)
    	if draginfo.isType("shortcut") then
    		local sClass = draginfo.getShortcutData()
    		if ItemManager2.getItemType(sClass) then
    			gear.onDrop(x, y, draginfo)
    		end
    	end
    end

  7. #7

    Join Date
    Sep 2020
    Location
    Ballston Lake, NY
    Posts
    832
    Give me a day or two and I'll put an extension on the Forge for this.
    Add feature suggestions for Savage Worlds to Fantasy Grounds Feature Request.

  8. #8
    Quote Originally Posted by Mike Serfass View Post
    Give me a day or two and I'll put an extension on the Forge for this.
    That would be awesome!

    My guess is to add only one new field like the "Type" in the NPC sheet and the search like "Type" in the NPC module.

    Would be amazing to know if we need to duplicate the code and adapt it if we want more fields.

    For my need I will be using it to add several fields so I guess it would be to duplicate the code and not make several extension in terms of performance.

    Sincerely,
    LordDante123

  9. #9

    Join Date
    Sep 2020
    Location
    Ballston Lake, NY
    Posts
    832
    I created the extension. It's pending approval in the Forge. I'll update the thread with the store link when it's available.
    [Extension] NPC Region
    Add feature suggestions for Savage Worlds to Fantasy Grounds Feature Request.

  10. #10
    Quote Originally Posted by Mike Serfass View Post
    I created the extension. It's pending approval in the Forge. I'll update the thread with the store link when it's available.
    [Extension] NPC Region
    Amazing! I'll try to look into it this week-end.

    Thank you for your work!

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 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
  •  
TALES of the VALIANT

Log in

Log in