Menu

Ability to add Custom Parts to WillowTree#?

K V
2019-05-01
2019-05-04
  • K V

    K V - 2019-05-01

    We all know there are many mods available for Borderlands, nearly all of which work just fine with the Enhanced version. Some of these mods add new weapons in to the game, or fix existing ones like the displayed name of the Maliwan Plague for instance. I've so far only been able to update the partnames.xml file to add in new parts. I'm unable to add rarity values or other data for things due to the way I assume the data files work. I noticed partnames.xml has the entire string for the item in question typed out, but other xml files in data only have a portion of it with the common part between them being the name of the xml file itself. Is it possible to throw new xml files in the data folder and have WillowTree# load them? So far I haven't been able to, I assume it's only looking for specific files. Would be nice if I could get a little more info on how to do this.

     
  • matt911

    matt911 - 2019-05-03

    The data file that WillowTree# uses are in the Data folder. There are a whole bunch of .txt files that correspond with the names of the unreal packages that the game uses. When you have a grip for instance in your weapon that's named "gd_weap_patrol_smg;.Grip.grip1", whatever property data willowtree has in relation to that part is listed in the file gd_weap_patrol_smg.txt.

    PartString = gd_weap_patrol_smg.Grip.grip1

    The package name is the part before the first period. That's the name of the unreal package that holds this data.
    Package = gd_weap_patrol_smg

    The object path is the part after the first period. That's the path that unreal uses to locate the object inside its unreal package.
    ObjectPath = Grip.grip1

    The WT# data file name is just the package name with .txt on the end of it.
    DataFileName = gd_weap_patrol_smg.txt

    Inside that file there are data sections for aech part. The section starts with a line that has the object path in brackets and below that it lists the properties one per line. The data section for this part looks like this.
    [Grip.grip1]
    PartName="Tediore"
    CashValueModifier=WeaponPartCost1_Common
    Rarity=0

    Now when you use the part selector inside WT# it lists the parts for the packages that apply to the type of item you are editing: weapon or item. The way it knows which package files to list is through the files weapon_tabs.txt and item_tabs.txt in the Data folder. The format of that file is just one continuous text line that contains all the package names separated by semicolons.

    Item_tabs.txt looks like this:

    gd_itemgrades;gd_customitems;gd_manufacturers;gd_CommandDecks;gd_ElementalUpgrade;gd_HealthDrops;gd_shields;gd_StorageDeckUpgrade;gd_tunercuffs;dlc3_gd_itemgrades;dlc3_gd_item_UniqueParts;dlc3_gd_CommandDecks;dlc3_gd_customitems;dlc2_gd_items;dlc2_gd_BankUpgrade;dlc2_gd_Bank

    Now as for the specifics of finding the name from an item, you can look at the algorithm in the source code file InventoryEntry.cs, in the methods RecalculateDataWeapon() and RecalculateDataItem(). To calculate the name of a weapon you need the PartNumberAddend and Rarity of the magazine and stock and the PartName of the prefix, title, body and material parts to compute what the parts of the name should be. In order to make name resolving in WillowTree3 faster there is a file called PartNames.ini in the Data folder that has the PartName from every part in every package all in one place. The PartName="blahblah" that you see in each data section of the .txt data files is what is displayed in the part selector for informational purposes but it actually retrieves the part name from PartNames.ini, so if you don't edit the part names in that file too they won't actually be used in RecalculateDataItem or RecalculateDataWeapon

    Steps to add an additional part to WT#
    1) Create a new package .txt file for its package if there is no already a file with that name in the Data folder.
    2) Edit the package's .txt file to add a section for your new part..
    3) If you added a new package .txt file in step 1 then edit weapon_tabs.txt or item_tabs.txt to add your package to its list so you'll see your new package somewhere in the part selector.
    4) Edit PartNames.ini to add an entry for your part if it has a PartName property. Not all parts have a PartName so if it doesn't have one you don't need to put anything in PartNames.ini. The lines are of the form PartString="nametext", so for instance it would say gd_weap_patrol_smg.Grip.grip1="Tediore" for instance somewhere in there.
    5) Launch WT# and it will build a new XML file and start using your part to the extent that it understands how.

     
  • matt911

    matt911 - 2019-05-04

    I will point out to you that WT# can't possibly name some items correctly the way its currently written because WT# doesn't have any values for the properties bTypeNameIsFullName, TypeName, bItemNameIsFullName, ItemName on the weapon type defiition or item definition part and it doesn't have values for bNameIsUnique on the title part and it doesn't have code to consider those properties during its naming process. I'm not really sure if Borderlands uses the first four in the actual naming process or if that's for some other purpose, but I'm certain that the unique flag is used on unique items to keep from having the extra parts of the name, but I only just now looked it up in the database to find the exact name of the property and which part it was on that was causing the name to be limited. Ultimately having less name is not particularly valuable to editing of savegames because the name is what helps you differentiate two similar items so its something that I was aware of in the past but I didn't really spend any time worrying about it.

    When I update the data in WT# I will include those data so that it can properly name items with the official name. I hope that will be done within a day or two, but its taken much longer than I expected it to due to the inadequacy of my tools, unexpected bugs in them that took me a long time to track down, and general lack of understanding of how some data works that is only resolved through writing of new tools to parse, dump, and help me analyze data. Everything would be simple if there was just spot in the data that had a name and a value and that was all I needed, but there are fomulas and variable references in the data that are encoded in a way that I don't have full understanding of and some of it that I might have had an understanding of years ago when I did most of the work on WT but I've forgotten by now and I've had to rediscover.

     
  • K V

    K V - 2019-05-04

    Thanks for the detailed response as always, I've accomplished what I set out to do. I'm not particularly bothered by the Uniques having extra info in their names either. I was under the impression that it was set by the Prefix to remove all that extra part info from the name though.
    gd_customweapons.BSG_Weapons.TitleU_BSG_PrefixOverride and gd_weap_names_shared.Prefix.PrefixU_blank for instance. I didn't think there were other values making the changes.

     
    • matt911

      matt911 - 2019-05-04

      You certainly could be right about that. I haven't explored the whole topic yet. I only just looked up the name of the unique variable because you asked about the naming. Once I put in code to handle it then it'll spit out some names and I'll know if that variable is what I need or not. Experimentation is what takes the time. If I knew how everything worked in the unreal engine and in Borderlands the whole thing probably would have been done in two days, but I dont so I have to guess at things and try to figure it out and when it doesn't produce the correct results I make a new hypothesis and try that. Sometimes I never do figure out what is going on.

      I'm not a priveledged software developer with the unreal engine source and borderlands source code I'm just a guy with a hex editor and some free programming tools that I use to try to figure stuff out. Sometimes I succeed but it takes time.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.