Torchmodders

Modding => Tips & Tools => Topic started by: Anarch16sync on May 17, 2017, 06:41:02 pm


Title: [Tool] Item Unit file maker Script
Post by: Anarch16sync on May 17, 2017, 06:41:02 pm
Request Fullfilled  :D
Ok. I think I took care of everything.  I wrote a bunch of tests to catch errors. And then tested a bit.

Binaries for windows 7+ and osx available here:

https://github.com/RobJames-Texas/TL2_ItemDatMaker/releases

I added functionality so that you should be able to drag and drop your mesh file from your mod folder onto the exe and it should then ask you for the rest of the parameters.

Let me know if you have any issues.

Here I'll make a rundown of what the script should do:

Given a 3d model as input, that means the file name and folder location, the scritp should generate a corresponding item unit file in a specific folder.

Example:
Input: D:\Steam\SteamApps\common\Torchlight II\MODS\ITEM_MOD\MEDIA\MODELS\WEAPONS\_SWORDS\Sword_model_01

Unit file:
Created in:  D:\Steam\SteamApps\common\Torchlight II\MODS\ITEM_MOD\MEDIA\UNITS\ITEMS\SWORDS\
Code: [Select]
[UNIT]
        <STRING>RESOURCEDIRECTORY:media/models/weapons/_Swords
<STRING>MESHFILE:Sword_model_01
[/UNIT]

List of folders equivalencies
Spoiler (hover to show)

Now, this file is totally imcomplete, it needs some basic things, a name, a unittype and a base file. But this things are related to one variable, rarity.

So a second input should be item rarity, the options being, Normal, Magic (Blue), Unique and Legendary. With this we can determine the base file and the unittype of the item. The type of item, that being an sword, axe, greataxe, etc, should be determined using the folder in which the model is stored.

Example:
Rarity input: Magic
Unit file:
Code: [Select]
[UNIT]
        <STRING>BASEFILE:media\units\items\swords\base_sword_magic.dat
<STRING>UNITTYPE:MAGIC 1HSWORD
[/UNIT]

List of folder name and base file equivalency
Spoiler (hover to show)

List of folder name and unittype equivalencies
Spoiler (hover to show)

Exception, there is no _legendary base file, they use the unique base file.

Now for the name, the name should follow the vanilla convention with a tag added. the tag should be another input. ([itemtype]_[TAG][Rarityletter][Number])

Example:
Input tag: TEST

Unit file:
Code: [Select]
[UNIT]
<STRING>NAME:sword_TESTm01
[/UNIT]

Now the last input should be item level, but to make the script have extra option, it should have 2 funtions:
Make Alternative clones, creates two more files using the first as base increasing its level by a predefined amount
Make NG+ Clones, this one should be one of the more interesting function. It would make clones of the item increasing their level simulating the NG+ calculation of GUTS for increasing level.

Example:

Input item level: 15
Make Alt Clones [Y/N]: Y

Unit file:
Code: [Select]
[UNIT]
<INTEGER>LEVEL:15
<INTEGER>MINLEVEL:13
<INTEGER>MAXLEVEL:19
[/UNIT]

Alternative Clones:
B:
Code: [Select]
[UNIT]
        <STRING>NAME:sword_TESTm01b
<STRING>BASEFILE:media\units\items\swords\sword_TESTm01.dat
<INTEGER>LEVEL:19
        <INTEGER>MINLEVEL:17
<INTEGER>MAXLEVEL:22
[/UNIT]

C
Code: [Select]
[UNIT]
        <STRING>NAME:sword_TESTm01C
<STRING>BASEFILE:media\units\items\swords\sword_TESTm01.dat
<INTEGER>LEVEL:23
        <INTEGER>MINLEVEL:21
<INTEGER>MAXLEVEL:26
[/UNIT]

The MINLEVEL should be LEVEL-2, and MAXLEVEL = LEVEL + 3. The increase in level for the alternatives should be LEVEL+4.

Now how should the "Make NG+ Clones" work, the clones should have a level increase using the equation:

For Item level in the NG range (default 0<i-level<=50)

NG+ Clone (default range : 51 to 80)
I-LevelNG+= 51+[(i-level/50) * (80-51)]

NG++ clone (default range : 81 to 100)
I-levelNG+2 = 81+[(i-level/50) * (100-81)]

NG+++ Clone (default range : 101 to 120)
I-levelNG+3 = 105

For item level in the NG+ range (default 51<=i-level<=80)

NG++ clone (default range : 81 to 100)
I-levelNG+2 = 81+{[(i-level-50)/(80-50)] * (100-81)}

NG+++ Clone (default range : 101 to 120)
I-levelNG+3 = 105

For item level in the NG++ range (default 81<=i-level<=100)
NG+++ Clone (default range : 101 to 120)
I-levelNG+3 = 105

This option should be able to interact with "make alternative clones" in a way that every alteranative clone, get their corresponging NG+ clones.

Example:

Input item level: 15
Make Alt Clones [Y/N]: N
Make NG+ Clones [Y/N]: Y

Unit file:
Code: [Select]
[UNIT]
<INTEGER>LEVEL:15
<INTEGER>MINLEVEL:13
<INTEGER>MAXLEVEL:19
[/UNIT]

NG+ Clones:
NG+
Code: [Select]
[UNIT]
        <STRING>NAME:sword_TESTm01NG+
<STRING>BASEFILE:media\units\items\swords\sword_TESTm01.dat
<INTEGER>LEVEL:60
        <INTEGER>MINLEVEL:58
<INTEGER>MAXLEVEL:63
[/UNIT]

NG+2
Code: [Select]
[UNIT]
        <STRING>NAME:sword_TESTm01NG+2
<STRING>BASEFILE:media\units\items\swords\sword_TESTm01.dat
<INTEGER>LEVEL:87
        <INTEGER>MINLEVEL:85
<INTEGER>MAXLEVEL:90
[/UNIT]

NG+3 (exception in Minlevel and Maxlevel, also has level_requiered:101 added.)
Code: [Select]
[UNIT]
        <STRING>NAME:sword_TESTm01NG+3
<STRING>BASEFILE:media\units\items\swords\sword_TESTm01.dat
<INTEGER>LEVEL:105
        <INTEGER>MINLEVEL:99
<INTEGER>MAXLEVEL:999
<INTEGER>LEVEL_REQUIRED:101
[/UNIT]

TL;DR:
Spoiler (hover to show)
Title: Re: [REQUEST] Item Unit file maker Script
Post by: Anarch16sync on May 17, 2017, 06:41:45 pm
---Reserved ----
Title: Re: [REQUEST] Item Unit file maker Script
Post by: Vkoslak on May 17, 2017, 10:05:13 pm
Great write-up. That sounds fairly reasonable to implement.
Title: Re: [REQUEST] Item Unit file maker Script
Post by: Anarch16sync on May 18, 2017, 08:29:12 am
Added how the Make NG+ clones should work part.
Title: Re: [REQUEST] Item Unit file maker Script
Post by: Vkoslak on May 29, 2017, 11:31:37 pm
Not completed, but I got a good start on it.

https://github.com/RobJames-Texas/TL2_ItemDatMaker

Once it's further along I'll post a binary somewhere.

I can write some code to generate the guids as well. 

I noticed the legendary items do something a little different with the name.

   <STRING>NAME:legendary_greataxe01

instead of

   <STRING>NAME:greataxe_u01

so that will need fixed.
Title: Re: [REQUEST] Item Unit file maker Script
Post by: Phanjam on May 31, 2017, 03:35:17 am
okay not fully sure how to interpret you guys' progress, so i'll just yell "go,go,GO!" from the sidelines! :D
Title: Re: [REQUEST] Item Unit file maker Script
Post by: Vkoslak on June 21, 2017, 09:17:34 pm
I was out of town for a couple of weeks.  I can get back on this now.
Title: Re: [REQUEST] Item Unit file maker Script
Post by: Vkoslak on July 02, 2017, 03:51:09 pm
Ok. I think I took care of everything.  I wrote a bunch of tests to catch errors. And then tested a bit.

Binaries for windows 7+ and osx available here:

https://github.com/RobJames-Texas/TL2_ItemDatMaker/releases

I added functionality so that you should be able to drag and drop your mesh file from your mod folder onto the exe and it should then ask you for the rest of the parameters.

Let me know if you have any issues.
Title: Re: [REQUEST] Item Unit file maker Script
Post by: Etherhead on July 20, 2017, 06:17:10 pm
Ok. I think I took care of everything.  *...snip...*

Sweet man! This will help so many of us out so much! Does this board have kudos ;P
Title: Re: [REQUEST] Item Unit file maker Script
Post by: Anarch16sync on September 03, 2017, 03:07:17 pm
Awesome work @Vkoslak, I just tested this with some models I had laying around,I found some issues: the way the files are coded, for some reason, GUTS won't read them, I checked and they are saved in UNIX format, (I use windows 7 x86, not a big deal it takes seconds to change, and I'm not even sure Guts notice the difference), and  are encoded in UTF-8 without Bom, when the files GUTS use seems to be in UCS-2 Little Endian ( Guts won't handle this, says something about guessing it's ASCII and some other things ), at leas thats what Notepad++ tells me... can that be an issue with my pc lenguage configuration or something like that, or any other thing that I need to check in my end?
 And the other one is the <STRING>MESHFILE: line, the exe writes the .mesh extension at the end of the name, if that happens guts can't find the mesh file.

Again, thanks for this, even with this issues is a great tool  :D
Title: Re: [REQUEST] Item Unit file maker Script
Post by: Vkoslak on September 03, 2017, 09:28:55 pm
This should fix the things you mentioned:

https://github.com/RobJames-Texas/TL2_ItemDatMaker/releases/tag/v0.9.1
Title: Re: [REQUEST] Item Unit file maker Script
Post by: Phanjam on September 04, 2017, 03:00:20 am
Thanks @Vkoslak for the hard work!  And @Anarch16sync it's nice to hear from u again!
Title: Re: [REQUEST] Item Unit file maker Script
Post by: Anarch16sync on October 23, 2018, 06:48:01 am
Ok, posting for a bump on this awesome tool. And also for a piece of advice for people using it.

Advice 1: The .dat files produced by this tool don't work right of the bat, you need to edit them to replace the "spaces"  before new lines for a "Tab", I didn't post this as a bug because is a common problem with text exporters to replace a "tap" for multiple spaces, I don't know if this is the case but It's my guess. Notepad++ has tools to do this, a "Search and replace" or "Space to Tab" both work.

Advice 2: The alternative clones and NG+ clones won't appear in GUTS to edit or in game mode, but work right in game when the mod is build, this is because the "Basefile:" line doesn't have the "mods/[mod_name]/" before the "media/..." naming of the directory, again a "Search and replace" works, or you can let this like that and edit the item files in notepad++

With that piece of advice, I recommend all people to use this awesome tool to make their items.
Title: Re: [Tool] Item Unit file maker Script
Post by: Vkoslak on October 24, 2018, 04:05:37 pm
I didn't know about the tab thing.  I can change that easy enough.  I'm sure that I put spaces in there because for my programming I always use spaces instead of tabs.
Title: Re: [Tool] Item Unit file maker Script
Post by: Anarch16sync on October 24, 2018, 04:52:51 pm
I didn't know about the tab thing.  I can change that easy enough.  I'm sure that I put spaces in there because for my programming I always use spaces instead of tabs.

Oh, as long as is not a big deal that would be nice. You're awesome @Vkoslak !
Title: Re: [Tool] Item Unit file maker Script
Post by: Vkoslak on October 25, 2018, 10:15:57 pm
New version posted. v0.9.2 Give it a whirl!

I updated it to dot net core 2.1 while I was at it.

I've been thinking of making dot net framework versions in addition to core so I can release a single exe for windows.

Url of project:  https://github.com/RobJames-Texas/TL2_ItemDatMaker

Newest downloads: https://github.com/RobJames-Texas/TL2_ItemDatMaker/releases/tag/v0.9.2
Title: Re: [Tool] Item Unit file maker Script
Post by: Phanjam on October 26, 2018, 03:06:08 am
Thanks v v much @Vkoslak !
Title: Re: [Tool] Item Unit file maker Script
Post by: Anarch16sync on October 26, 2018, 09:13:27 am
Awesome! Thanks @Vkoslak
Title: Re: [Tool] Item Unit file maker Script
Post by: Phanjam on October 21, 2019, 06:36:42 am
Hi @Anarch16sync and @Vkoslak ! So ive been using this script to build-out the unit files for some custom mesh weapons. It works fantastically well i want to tell you! But i'd like to make an added feature suggestion if i may ;)

Is it possible to assign the str, foc, dex and vit requirements via this script? I ask because i noticed the base files for the items i'm building out (greathammers) all have requirements of "0" except for the base_normal file. So the unit DATs will inherit that 0, which is probably not what most builders have in mind :P

Maybe the requirements could just be randomized from a Min/Max range that is appropriate to M, U and L items? It wont be perfect but at least builders wont have to add all the requirements by hand.  I dont mind entering the DISPLAYNAME and DESCRIPTION by hand tho; i think those have to stay with the builder ;)

Thanks for listening!