News: Go to the front page portal to create a Torchmodders account | Visit the wiki!
September 21, 2017, 10:30:07 AM
collapse

*
Information

Please contribute to our


Sign up for a forum account at the Front Page. | Remember to Tag your posts.
Having problems logging in to the forums? Go the front page, log out and back in again.

Author Topic: [REQUEST] Item Unit file maker Script  (Read 7591 times)

Offline Anarch16sync

  • The Ripper
  • Developer
  • Legendary
  • *
  • Posts: 530
  • Country: ar
  • Back on track
    • status study
    • View Profile
  • Mood: mood huh
[REQUEST] Item Unit file maker Script
« on: May 18, 2017, 01:41:02 AM »
So this is a request mostly for @Vkoslak about a discussion we had on Discord about ans script to make it easier to add items to TL2.

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
_AXES = AXES
_BOWS = BOWS
_CANNONS = CANNONS
_CROSSBOWS = CROSSBOWS
_FISTS = FISTS
_GREATAXES = 2HAXE
_GREATHAMMERS = 2HMACE
_GREATSWORDS = 2HSWORD
_HAMMERS = MACES
_PISTOLS = PISTOLS
_POLEARMS = POLEARMS
_RIFLES = RIFLES
_SHIELDS = SHIELDS
_STAVES = STAVES
_SWORDS = SWORDS
_WANDS = WANDS

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
_AXES = BASE_AXE
_BOWS = BASE_BOW
_CANNONS = BASE_CANNON
_CROSSBOWS = BASE_CROSSBOW
_FISTS = BASE_FIST
_GREATAXES = BASE_2HAXE
_GREATHAMMERS = BASE_2HMACE
_GREATSWORDS = BASE_2HSWORD
_HAMMERS = BASE_MACE
_PISTOLS = BASE_PISTOL
_POLEARMS = BASE_POLEARM
_RIFLES = BASE_RIFLE
_SHIELDS = BASE_SHIELD
_STAVES = BASE_STAFF
_SWORDS = BASE_SWORD
_WANDS = BASE_WAND

List of folder name and unittype equivalencies
Spoiler
_AXES = 1HAXE
_BOWS = BOW
_CANNONS = CANNON
_CROSSBOWS = CROSSBOW
_FISTS = FIST
_GREATAXES = 2HAXE
_GREATHAMMERS = 2HMACE
_GREATSWORDS = 2HSWORD
_HAMMERS = 1HMACE
_PISTOLS = PISTOL
_POLEARMS = POLEARM
_RIFLES = RIFLE
_SHIELDS = SHIELD
_STAVES = STAFF
_SWORDS = 1HSWORD
_WANDS = WAND

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
Script inputs:

3d Model (Full access route)
Item Rarity
Name Tag
Item Level

Options:
Make Alternative clones
Make NG+ Clones

Full Example:
Input 3d Model: D:\Steam\SteamApps\common\Torchlight II\MODS\ITEM_MOD\MEDIA\MODELS\WEAPONS\_SWORDS\Sword_model_01
Input Rarity: Magic
Input tag: TEST
Input item level: 15
Make Alt Clones [Y/N]: Y

Result:
sword_TESTm01.dat
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
        <STRING>BASEFILE:media\units\items\swords\base_sword_magic.dat
<STRING>UNITTYPE:MAGIC 1HSWORD
        <STRING>NAME:sword_TESTm01
<INTEGER>LEVEL:15
<INTEGER>MINLEVEL:13
<INTEGER>MAXLEVEL:19
[/UNIT]

sword_TESTm01b
Created in:  D:\Steam\SteamApps\common\Torchlight II\MODS\ITEM_MOD\MEDIA\UNITS\ITEMS\SWORDS\
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]

sword_TESTm01C
Created in:  D:\Steam\SteamApps\common\Torchlight II\MODS\ITEM_MOD\MEDIA\UNITS\ITEMS\SWORDS\
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]
« Last Edit: May 18, 2017, 03:28:14 PM by Anarch16sync »

Offline Anarch16sync

  • The Ripper
  • Developer
  • Legendary
  • *
  • Posts: 530
  • Country: ar
  • Back on track
    • status study
    • View Profile
  • Mood: mood huh
Re: [REQUEST] Item Unit file maker Script
« Reply #1 on: May 18, 2017, 01:41:45 AM »
---Reserved ----

Offline Vkoslak

  • Rare
  • *
  • Posts: 100
    • View Profile
Re: [REQUEST] Item Unit file maker Script
« Reply #2 on: May 18, 2017, 05:05:13 AM »
Great write-up. That sounds fairly reasonable to implement.

Offline Anarch16sync

  • The Ripper
  • Developer
  • Legendary
  • *
  • Posts: 530
  • Country: ar
  • Back on track
    • status study
    • View Profile
  • Mood: mood huh
Re: [REQUEST] Item Unit file maker Script
« Reply #3 on: May 18, 2017, 03:29:12 PM »
Added how the Make NG+ clones should work part.

Offline Vkoslak

  • Rare
  • *
  • Posts: 100
    • View Profile
Re: [REQUEST] Item Unit file maker Script
« Reply #4 on: May 30, 2017, 06:31:37 AM »
Not completed, but I got a good start on it.

https://github.com/Vkoslak/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.

Offline Phanjam

  • Operator
  • Legendary
  • *
  • Posts: 2200
  • Country: ph
  • previous avatar was too serious lol!
    • status ready
    • View Profile
  • Mood: mood angel
Re: [REQUEST] Item Unit file maker Script
« Reply #5 on: May 31, 2017, 10: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



Offline Vkoslak

  • Rare
  • *
  • Posts: 100
    • View Profile
Re: [REQUEST] Item Unit file maker Script
« Reply #6 on: June 22, 2017, 04:17:34 AM »
I was out of town for a couple of weeks.  I can get back on this now.

Offline Vkoslak

  • Rare
  • *
  • Posts: 100
    • View Profile
Re: [REQUEST] Item Unit file maker Script
« Reply #7 on: July 02, 2017, 10: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/Vkoslak/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.

Offline Etherhead

  • Mod Designer
  • Common
  • *
  • Posts: 19
  • Country: us
  • There is no spork...
    • status ready
    • View Profile
  • Mood: mood huh
Re: [REQUEST] Item Unit file maker Script
« Reply #8 on: July 21, 2017, 01:17:10 AM »
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

Offline Anarch16sync

  • The Ripper
  • Developer
  • Legendary
  • *
  • Posts: 530
  • Country: ar
  • Back on track
    • status study
    • View Profile
  • Mood: mood huh
Re: [REQUEST] Item Unit file maker Script
« Reply #9 on: September 03, 2017, 10: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

Offline Vkoslak

  • Rare
  • *
  • Posts: 100
    • View Profile
Re: [REQUEST] Item Unit file maker Script
« Reply #10 on: September 04, 2017, 04:28:55 AM »

Offline Phanjam

  • Operator
  • Legendary
  • *
  • Posts: 2200
  • Country: ph
  • previous avatar was too serious lol!
    • status ready
    • View Profile
  • Mood: mood angel
Re: [REQUEST] Item Unit file maker Script
« Reply #11 on: September 04, 2017, 10:00:20 AM »
Thanks @Vkoslak for the hard work!  And @Anarch16sync it's nice to hear from u again!



Tags:
 

* Quick Search


* Member Information

 
 
Welcome, Guest. Please login or register.

* Mod Boards Activity

* Who's Online

  • Dot Guests: 3
  • Dot Hidden: 0
  • Dot Users: 1
  • Dot Users Online:

* Calendar

September 2017
Sun Mon Tue Wed Thu Fri Sat
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 [21] 22 23
24 25 26 27 28 29 30

No calendar events were found.

* Recent Topics

Some Bugs Report and Request Idea by Sch123
[September 18, 2017, 01:07:29 PM]


Triggerable annoyance by Viz
[September 18, 2017, 02:38:39 AM]


TIDBI.RU Build Calcularor Support For Custom Classes by Phanjam
[September 17, 2017, 10:37:37 PM]


Skills Expansion: Bugs Report & Ideas by Sch123
[September 16, 2017, 05:18:25 PM]


Anything you'd like to see changed or added her on TM? by Phanjam
[September 16, 2017, 03:41:32 AM]


Quick Skill Group question by Phanjam
[September 16, 2017, 03:18:17 AM]


Attribute / player stats question by Phanjam
[September 14, 2017, 10:03:56 AM]


Character Stats by lolesch
[September 14, 2017, 02:30:40 AM]


Wardrobe Mod Progress, Issues, Updates by Phanjam
[September 13, 2017, 11:13:30 AM]


Merge Requests: Exclusive to doudley's mods by Sch123
[September 13, 2017, 06:34:41 AM]


Character Progression Concept by Phanjam
[September 10, 2017, 10:57:08 AM]


1st Class Creation - Lightbringer by Rhythmier
[September 09, 2017, 01:40:31 AM]


Vast Improvement Project by Phanjam
[September 08, 2017, 11:27:03 PM]


hard code? add/edit Effects by Phanjam
[September 08, 2017, 11:25:13 PM]


MORE GIBS! by Phanjam
[September 08, 2017, 01:19:42 PM]

* Popular Topics