Best way to load in players?

A hub for everything related to NBA 2K22 modding. Releases, previews, requests, and other modding discussion belongs here.

Best way to load in players?

Postby VampyTrout on Thu Mar 10, 2022 1:59 pm

Hi all, hopefully I’m in the right place. I’m not super experienced with 2k modding but I’ve messed around with a few tools. In any case, I’ve got a bunch of text files corresponding to players I want to create. These files contain pretty much all the info you would need to enter when creating a player—physical stats, attributes, tendencies, badges, dribble move/dunk packages etc. Previously I wrote a script that enters all this info into the game manually, simulating keypresses and everything. While (mostly) functional, this takes quite a while, prevents me from using my computer, and is obnoxious to update when options change.

I did this because I couldn’t figure out a better way (or how 2k player data was stored). Having played around with Looyhs hook, there clearly is the ability to edit all these attributes programmatically, and I was wondering if any of y’all had any insight or resources. Ideally there’d be a way to go straight from files to players created (or edited), but I suppose in the worst case I could just go from files to simulated input into the hook lol. Would love to get y’all’s thoughts!
VampyTrout
 
Posts: 5
Joined: Fri Apr 09, 2021 1:38 am

Re: Best way to load in players?

Postby TGsoGood on Fri Mar 11, 2022 1:35 am

just use 2K tools, it has the functionality that you are looking for.
You can copy a players complete DNA from outside of the game and paste it into a different roster easily.
Follow me on PATREON https://www.patreon.com/TGsoGood
Consider donating: http://cash.me/$TheJohnsonFamily or http://paypal.me/4TheGoods
Follow me on twitter @TGsoGood
Check me out on youtube https://www.youtube.com/channel/UCPydhZ ... PeRSmEVynQ

NBA 2K21 TGsoGood Mods and releases - viewtopic.php?f=267&t=110608
NBA 2K17 TGsoGood Mods and releases - viewtopic.php?f=225&t=102251#p1860681
NBA 2K14 TGsoGood Mods and releases - viewtopic.php?f=153&t=96056
User avatar
TGsoGood
Contributor
Contributor
 
Posts: 6433
Joined: Thu Jul 28, 2011 4:03 am
Location: Nashville, TN

Re: Best way to load in players?

Postby vetmin on Fri Mar 11, 2022 1:36 am

I've attached an Excel workbook with 2K Tools templates for both Attributes and Tendencies. When you open it, it will look broken, because there are #REF's everywhere, but that's because the template is trying to pull from a non-existent datasheet of Attribute and Tendency values, so you need to make one and edit each cell of the template so that it points to the right place in your datasheet. (I could've created a datasheet template as well, but the datasheet could be organized however one wishes, and everybody is going to have different preferences, so IMO that's better left to the user.)

In the Attribute cells, the bit you'll be replacing is the one that looks like (#REF!-25)*3. You'll change #REF! to something like Attributes!A1, so it'll say something like (Attributes!A1-25)*3. Each cell has 2K Tools' descriptor for what the attribute is, so you just look at what it says and point the cell at the corresponding spot in your datasheet.

In the Tendency cells, it's a little simpler, since you just have to replace #REF! with something like Tendencies!A1. There is no subtracting of 25 and multiplying by 3. The only complicating factor is that when I stripped this template apart from its original datasheet, the target cell values (i.e., rendered as #REF!) became stuck to the ampersand preceding it (i.e., &#REF!). In reality, it needs to be rendered like "blah blah blah...& Tendencies!A1 &...blah blah blah"; that is, you need to be sure to add a space between that initial ampersand and your datasheet cell value (e.g., "& Tendencies!A1" = good; "&Tendencies!A1" = bad).

Note as well that, particularly in terms of tendencies, in some cases there is no #REF! block, but instead just a static number. That's because for some tendencies I like them to be the same throughout the league; for instance Drive-R tendency is set to 50, because I prefer for the CPU AI to take whatever I give them defensively and not be afraid to drive on either side. Also, I prefer for all shot location tendencies to be at 0, for similar reasons. If you want to have them be actual cell values in your datasheet rather than static values, then just change any of my static numbers to instead point to the proper cell in your datasheet (i.e., following the correct format above: #REF! for tendencies and (#REF!-25)*3 for attributes). By the same token you can replace any of the datasheet cell pointers to instead just be static numbers (note that for attributes, 25 <-> 99 in game is 0 <-> 222 in 2K Tools' scaling), like if you want everyone in your league to have Triple Threat Idle Tendency at 0 (or you could just make them uniform in the datasheet; that would actually be better practice IMO).

Once it looks good in Excel, if you want to paste any of these into 2K Tools, what you would do is first select the entire row, copy it to the clipboard, and paste into a text editor (I use Notepad++). You'll see when you do this that, when pasted, each of the pasted cells in the row are now separated by a tab character (a big giant single-character space). Copy one of those tab characters to the clipboard, then open up your editor's Find / Replace interface. Use that interface to replace each tab character with a single comma (no spaces around the comma; replace tab character with comma character). Once you do that, it's in 2K Tools format and you can just copy and paste it right in. Be sure, of course, to not copy any extraneous data you may have had in your spreadsheet for organizational purposes. Like, for instance, if you added 4 columns before the template begins and entered the player's season, team, last name, and first name, then you might end up with something like this in your text editor:

1965,LAKERS,Baylor,Elgin,[{"module":"PLAYER","tab":"ATTRIBUTES" ... "POTENTIAL":"190"}}]

When pasting into 2K Tools you only want to select whatever is within the brackets. That's the actual data; the other stuff is just your own personal metadata.

Please let me know if this all makes sense or if you have any questions. And pro-tip: The best thing to do is paste your entire roster into your text editor at once and replace tabs with commas throughout the entire roster text in one go. Then just save the text file somewhere and pull it up whenever you need to paste something. I recommend having extra columns like I did above with Elgin Baylor so that when you're transferring the data into 2K Tools and you want, say, Seth Curry, you can just search "Curry,Se" and he'll come right up.
You do not have the required permissions to view the files attached to this post.
vetmin
 
Posts: 321
Joined: Sat Mar 14, 2020 8:26 am

Re: Best way to load in players?

Postby VampyTrout on Fri Mar 11, 2022 10:59 am

oh snap! Thank y'all so much! I feel a little silly for spending so much time on that script--I will definitely have to check this stuff out.

Somewhat related, you guys know if there's an easy way to export season data? Like if at the end of every season in a league I wanted to get all team/player stats into spreadsheets? All of this is in service of putting a bunch of rookie players my friends make through a website I made into a draft class and then tracking their careers.
VampyTrout
 
Posts: 5
Joined: Fri Apr 09, 2021 1:38 am

Re: Best way to load in players?

Postby TGsoGood on Mon Mar 14, 2022 4:48 am

VampyTrout wrote:oh snap! Thank y'all so much! I feel a little silly for spending so much time on that script--I will definitely have to check this stuff out.

Somewhat related, you guys know if there's an easy way to export season data? Like if at the end of every season in a league I wanted to get all team/player stats into spreadsheets? All of this is in service of putting a bunch of rookie players my friends make through a website I made into a draft class and then tracking their careers.


I don't know of a way to do this
Follow me on PATREON https://www.patreon.com/TGsoGood
Consider donating: http://cash.me/$TheJohnsonFamily or http://paypal.me/4TheGoods
Follow me on twitter @TGsoGood
Check me out on youtube https://www.youtube.com/channel/UCPydhZ ... PeRSmEVynQ

NBA 2K21 TGsoGood Mods and releases - viewtopic.php?f=267&t=110608
NBA 2K17 TGsoGood Mods and releases - viewtopic.php?f=225&t=102251#p1860681
NBA 2K14 TGsoGood Mods and releases - viewtopic.php?f=153&t=96056
User avatar
TGsoGood
Contributor
Contributor
 
Posts: 6433
Joined: Thu Jul 28, 2011 4:03 am
Location: Nashville, TN

Re: Best way to load in players?

Postby vetmin on Mon Mar 14, 2022 3:10 pm

VampyTrout wrote:oh snap! Thank y'all so much! I feel a little silly for spending so much time on that script--I will definitely have to check this stuff out.

Somewhat related, you guys know if there's an easy way to export season data? Like if at the end of every season in a league I wanted to get all team/player stats into spreadsheets? All of this is in service of putting a bunch of rookie players my friends make through a website I made into a draft class and then tracking their careers.


There's no one-click way to do this, but you can grab all of this data essentially by doing the opposite of what I described above for inserting players.

What you would do is:

1. For any player or team, open them up in 2K Tools.
2. Go to Stats.
3. Scroll down to where it has entries for individual years.
4. Click the dropdown for Current Year Stats.
5. Click "Edit".
6. In the new box that pops up, click the bottom right icon for the list of options.
7. Click "Copy "Edit" to Clipboard".
8. Paste into a text editor.

Once you've done this for every player and team, you have all the data, so from there you should be able to just rename the resultant text file(s) to CSV extension, open it in Excel, and clean up the appearance of the data (for instance by applying a macro/script/whatever to remove the non-numerical data from each cell, leaving you with only your desired numbers.

EDIT: Obviously this is the kind of thing you'd only want to do once per season (like immediately after the final game of the Finals or something). You could also let the season change into the new season and then copy the data from the previous year's stats (i.e., it doesn't have to be Current Year Stats; you can do the above with any of the stat years).
vetmin
 
Posts: 321
Joined: Sat Mar 14, 2020 8:26 am

Re: Best way to load in players?

Postby TGsoGood on Sat Apr 02, 2022 11:38 pm

Vetmin,
Can you show us how to use your spreadsheet? I'm trying to use it but can't figure which part to change.
Follow me on PATREON https://www.patreon.com/TGsoGood
Consider donating: http://cash.me/$TheJohnsonFamily or http://paypal.me/4TheGoods
Follow me on twitter @TGsoGood
Check me out on youtube https://www.youtube.com/channel/UCPydhZ ... PeRSmEVynQ

NBA 2K21 TGsoGood Mods and releases - viewtopic.php?f=267&t=110608
NBA 2K17 TGsoGood Mods and releases - viewtopic.php?f=225&t=102251#p1860681
NBA 2K14 TGsoGood Mods and releases - viewtopic.php?f=153&t=96056
User avatar
TGsoGood
Contributor
Contributor
 
Posts: 6433
Joined: Thu Jul 28, 2011 4:03 am
Location: Nashville, TN

Re: Best way to load in players?

Postby vetmin on Tue Apr 05, 2022 2:19 am

TGsoGood wrote:Vetmin,
Can you show us how to use your spreadsheet? I'm trying to use it but can't figure which part to change.


Sure, here you go: https://youtu.be/8_2E5x2-4eY
vetmin
 
Posts: 321
Joined: Sat Mar 14, 2020 8:26 am


Return to NBA 2K22 Modding

Who is online

Users browsing this forum: No registered users and 1 guest