Thread: Reload Items
-
October 26th, 2022, 16:33 #1
-
October 26th, 2022, 16:51 #2
- Join Date
- Apr 2020
- Posts
- 181
In general, it is possible to force windows to reload.
-
October 26th, 2022, 17:14 #3
-
October 26th, 2022, 17:29 #4
- Join Date
- Apr 2020
- Posts
- 181
Well that depends on what you want to trigger the reload
-
October 26th, 2022, 18:02 #5
Ok, it is the case that I explain better and tell you what I did and what I want to achieve.
So in my data_library I have defined more management classes for the Items and I have defined a function that associates the right class to the itemtype field of each object.
To try it out, I manually created a couple of Items in the campaign DB. The Item window shows them well and when I try to open them everything works fine. The problem is that I created them by hand, so I need a system that allows me to create the Item I want. The idea that came to my mind was to create a default class for Items. This class is used to open objects that do not have the itemtype field set. This class contains a field named itemtype (associated with a combobox) that allows me to select the item type of the object.
It almost works well. When I create a new item I can choose the item name and I can select the itemtype. On the campaign DB everything is written well.
The problem is that the generic Item window has already associated a class to the Item and does not recognize this variation until I restart the session. If I try to open the Item without restarting it always opens it with the default class.
A little bit of code:Code:["item"] = { bExport = true, bID = true, aDataMap = { "itemdescription", "reference.itemdata.itemdrescription" }, aRecordDisplayClasses = {"reference_item_weapon", "reference_item_armor", "reference_item_choice"}, fRecordDisplayClass = getItemRecordDisplayClass, -- sRecordDisplayClass = "item", }, function getItemRecordDisplayClass(vNode) local sRecordDisplayClass = "reference_item_choice"; if vNode ~= nil and vNode.getChild("itemtype") then local itemType = vNode.getChild("itemtype").getValue() if itemType == "Weapon" then sRecordDisplayClass = "reference_item_weapon"; elseif itemType == "Armor" then sRecordDisplayClass = "reference_item_armor"; end end return sRecordDisplayClass; end
-
October 26th, 2022, 18:05 #6
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,654
All of the D&D rulesets have a Type field that changes the fields available in the item record window based on the value of the Type field. I would look at any of the D&D rulesets for that (5E, 3.5E, etc.)
Regards,
JPG
-
October 26th, 2022, 19:42 #7
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks