Macintosh modding - a simple example

This forum is dedicated to platform-specific issues, discussions and tools relating to D2 modding for the Mac.

Moderator: Contrail

Locked

0
No votes
 
Total votes: 0

User avatar
Souricette
Retired staff
Paladin
Posts: 185
Joined: Sat May 03, 2003 9:25 am
Location: Nice, France
Contact:

Hand-picked

Macintosh modding - a simple example

Post by Souricette » Sat Nov 01, 2003 5:57 pm

That thread will describe the different steps required to achieve a trivial example of modding on Macintosh: making the Act1 Quill rat dropping the Unique "The Gnasher" item.

That example is based on the fact that you are using MacOS X. If you are on Classic MacOS, each time I refer to the "Diablo II (Carbon)", you have to replace it by "Diablo II", and each time I refer to "Diablo II Patch (Carbon)", you have to replace it by "Diablo II Patch".

It is also based on the 1.10 version of Diablo II, but the same recipes can be used for 1.09d.

You will need "Diablo II MPQ Tool" ( http://mpqtool.coucou.net/ ) and a Spreadsheet program (Excel, for example...). A text editor could replace it, but since we will edit multiple-tab-delimited-field files, a spreadsheet would really be a plus...

Step 1 - Locate your Patch file

You have to find the "Diablo II Patch (Carbon)" file used by your Diablo application. That file is located in your "Diablo II (Carbon)" application, in a "Diablo II Files" folder.

Once you have found it, BACKUP IT!

Step 2 - Extract the needed .txt files from the Patch file

To make the Quill rat drop the Gnasher unique item, you will need to edit 2 file:
- data\global\excel\uniqueitems.txt
- data\global\excel\treasureclassex.txt

To get these files, launch "Diablo II MPQ Tool", and select "Open" menu item of the "File" menu. Select your "Diablo II Patch (Carbon)" file in your Diablo II folder.
When the file is opened, you will see a list of files. Extract the data\global\excel\uniqueitems.txt and data\global\excel\treasureclassex.txt files, by dragging them from the window and dropping them in the Finder: this will create the "treasureclassex.txt" and "uniqueitems.txt" files.

Don't close that window, we will use it later.

Step 3 - Edit the .txt files

Open your "uniqueitems.txt" file with Excel. The first line is displaying labels, and the next lines are describing all the unique items. You can note that the second line is the one describing "The Gnasher" - good... :lol:
Now, select the columns number 7 and 8: their respective labels are "lvl" and "lvl req". Edit the "lvl" and "lvl req" value for the Gnasher line, by putting 1 in these cells: this will allow the item to be dropped for a character of level 1. In the column "nolimit" (column 6), put 1, to enable more than one unique to be dropped. If you don't, you will get one Gnasher, all next drops being rare hand axes... Note the 'code' value for that item: it's "hax", we will use it later. Save as tab-delimited file, and close it.
Open your "treasureclassex.txt" file with excel. That time, we will have to edit the colum for "Quill 1": it's the line number 650.
We want to make the quill rat drop the unique Gnasher, and there is a "unique" column... Put 1024 in the Unique column (column 5), put 0 in the NoDrop column (column 9), put "hax" in column "Item1" (column 10) - "hax" is the code we saw previously in UniqueItems.txt", put 100 in "Prob1" column (column 11), and clear the 2 next columns (Item2 and Prob2). Save as tab-delimited and close.

Step 4 - Putting the .txt files back in the Patch file

Well, that's very easy too! Using "Diablo II MPQ Tool", the only thing you will have to do is to drop the files from the Finder in the "Diablo II Patch (Carbon)" window of the application... The application handles the correct renaming of the file ("uniqueitems.txt" is renamed "data\global\excel\uniqueitems.txt" for the archive), and changes the carriage return to the appropriate one. Save the changes, we are done with it for now.

Step 5 - Generating .bin files

Diablo II no more handles .txt files directly, but their "compiled" version, the .bin files. While the Windows version of Diablo II has the built-in capability to generate them, we don't have such thing. But the good news is that this ability IS present in the application code, we only have to force it to be used! This will be one by patching the Diablo II application.
Duplicate the "Diablo II (Carbon)" application, and rename it "Diablo II (-txt)". We will patch that duplicate.
Another required step is that the .bin files will be created in a given folder: "data:global:excel", located in your application folder. So, you have to create such hierarchy: create a "data" folder in the same folder as your application, create a "global" folder in it, and then a "excel" folder in that "global" folder.
Use "Diablo II MPQ Tool" application to do the patch: execute the "Txt2Bin Conversion (1.10)" menu item of the "Diablo II" menu: that will open a window. You can read everything there, or go directly to the "Step 2" panel.
Click on the "Patch - Unpatch Diablo II application" button, an select the "Diablo II (-txt)" application - this will patch your application to have the built-in .bin generation process enabled! Don't close that window, since we will use it during the next step.
Now we have to make Diablo II generate the .bin files: launch the "Diablo II (-txt)" application, and create a new character (or open an existing one) - that will trigger the .bin file generation... When you are ready to play, you can quit the application: you no more need it.

Step 6 - Converting .bin files

Unfortunately, the Macintosh Diablo II version was never intended to build the .bin files, and they have been incorrectly generated - an additional step is required... That's the Step 3 of the Txt2Bin conversion!
Go back to your "Diablo II MPQ Tool" application, and go to the Step 3 of the Txt2Bin window. Click on the "Convert bin files..." button, and select the "excel" folder we created previously (when we created the "data:global:excel" hierarchy in the application's folder). The process may take a few minutes: be patient...

Step 7 - Testing the changes

To test it, you could either put the modified uniqueitems.bin and treasureclassex.bin back in your Patch file, using "Diablo II MPQ Tool" drag-and-drop, and use your "Diablo II (Carbon)" application to play it, or use the -direct feature of Diablo II...
The -direct feature is not available as-is in the Macintosh Diablo II application, you will need to patch it to have it enabled. This is done once again by "Diablo II MPQ Tool"...
First duplicate your "Diablo II (Carbon)" application, and rename the duplicate "Diablo II (-direct)".
Then, using the "Enable -direct Flag (1.10)" menu item of the "Diablo II" menu, patch your "Diablo II (-direct)" application.
This application will look in the "data:global:excel" for its files before looking in its Patch file - that's exactly what we were expecting, since we want to test the .bin files in the "data:global:excel" folder!
So, launch the "Diablo II (-direct)" application, and play your character normally - killing a Quill Rat will drop the unique "The Gnasher"...

Step 8 - Building my mod to distribute it

Well, it's very easy... Using "Diablo II MPQ Tool", drop the "uniqueitems.bin" and "treasureclassex.bin" files from your "data:global:excel" folder in your "Diablo II Patch (Carbon)" MPQ archive (the names will be converted dynamically to their good one, with data\global\excel), rename it to "patch_d2.mpq" (since it's the preferred way to distribute a mod), and publish that file...

-----------------------------

Happy modding,
Souricette

[Edit: updated the text to reflect pertinent Mihrginoc's remarks...]
[Edit october 2005: updated URLs to valid ones...]
Last edited by Souricette on Wed Oct 26, 2005 7:53 am, edited 2 times in total.

User avatar
Myhrginoc
Retired Admin
Cherub
Posts: 12100
Joined: Sat May 25, 2002 7:28 am
Location: Percussion U
United States of America

Hand-picked

Re: Macintosh modding - a simple example

Post by Myhrginoc » Sat Nov 01, 2003 7:55 pm

Nice write-up! Just one nitpick I see:
We want to make the quill rat drop the unique Gnasher, and there is a "unique" column... Put 2048 in the Unique column (column 5), put 0 in the NoDrop column (column 9), put "hax" in column "Item1" (column 10) - "hax" is the code we saw previously in UniqueItems.txt", put 100 in "Prob1" column (column 11), and clear the 2 next columns (Item2 and Prob2).
I doubt the Mac version of the treasure class evaluator is different than the Windows version (that would be horribly bizarre), so 1024 is sufficient to achieve certainty. It is worth noting in case your Mac modders read other documents about treasure classes.

Also, in UniqueItems unless you put a “1” in the “nolimit” field you will get a Gnasher from the first quill rat and a bunch of rare hand axes thereafter. One drop is enough to test a static object, but for variable properties the nolimit parameter will help. I know this is not mentioned in the Quill Rat Test exercise in the Beginner's Guide. But I have to make a minor update anyway now that the final is released, so I'll add that fact.
Do the right thing. It will gratify some people and astonish the rest.
~ Mark Twain
Run Diablo II in any version for mods: tutorial
The Terms of Service!! Know them, abide by them, and enjoy the forums at peace.
The Beginner's Guide v1.4: (MS Word | PDF) || Mod Running Scripts || TFW: Awakening

User avatar
Souricette
Retired staff
Paladin
Posts: 185
Joined: Sat May 03, 2003 9:25 am
Location: Nice, France
Contact:

Hand-picked

Re: Macintosh modding - a simple example

Post by Souricette » Sat Nov 01, 2003 10:02 pm

Well... What he said! :lol:

I updated the original message to reflect these changes.

Souricette

Argumentative
Posts: 5
Joined: Sun Nov 30, 2003 5:15 am

Re: Macintosh modding - a simple example

Post by Argumentative » Sun Nov 30, 2003 5:27 am

Hey,

I have an eMac G4 running OS X 10.2.8 with a legit copy of D2 LOD v1.10 (carbon patch installed).

I followed your instructions and made the mod, but when i tried to load the Diablo II (-direct) app i can only get as far as the initial menu for diablo. (single player, battle.net etc.) then the game crashes.

I tried adding the .bin files to the mpq and just loading the standard Diablo II (Carbon), the only change was that i could now get as far as choosing a character before the game crashed.

I went over the whole process again, (making the mod) and got the same problem(s).

Any ideas on what i could have done wrong?

Also, is there somewhere i can download a mod for the mac that has been tested on v1.10?

Thanks

Argumentative
Last edited by Argumentative on Sun Nov 30, 2003 5:32 am, edited 2 times in total.

Argumentative
Posts: 5
Joined: Sun Nov 30, 2003 5:15 am

Re: Macintosh modding - a simple example

Post by Argumentative » Sun Nov 30, 2003 6:21 am

Heh,

:oops: :roll: :oops:

I worked out what my problem was, I forgot to fix the .bin files after Diablo II made them. Once that was done, no problem!

Thanks for the excelent tutorial!

Reguards
Argumentative

User avatar
Souricette
Retired staff
Paladin
Posts: 185
Joined: Sat May 03, 2003 9:25 am
Location: Nice, France
Contact:

Hand-picked

Re: Macintosh modding - a simple example

Post by Souricette » Mon Dec 01, 2003 11:37 am

Argumentative";p="142027" wrote:I worked out what my problem was, I forgot to fix the .bin files after Diablo II made them. Once that was done, no problem!
Good, I like solving these kind of problems :)

Souricette

User avatar
Derakon
Posts: 82
Joined: Sun Jun 01, 2003 5:17 am
Location: Claremont, CA
Contact:

Re: Macintosh modding - a simple example

Post by Derakon » Thu Dec 04, 2003 11:04 pm

Interesting...I've successfully modified the game according to these rules. Now, I'm trying to change the drops of the Zombies...but I can't find an entry for them in the TreasureClassEx.txt file, nor in the TreatureClass.txt file. Where might they be stored? I've looked through the file guides on the Phrozen Keep proper and couldn't find this information.

Thanks for making the MPQ-Tool utility!

User avatar
Paul Siramy
Retired staff
Principality
Posts: 2828
Joined: Sat May 25, 2002 2:39 pm
Location: La Garenne Colombes (near Paris)
Contact:
France

Hand-picked

Re: Macintosh modding - a simple example

Post by Paul Siramy » Fri Dec 05, 2003 2:03 am

In MonStats.txt, check the columns TreasureClass1 to TreasureClass4(H) (the almost last columns) ;)

User avatar
Derakon
Posts: 82
Joined: Sun Jun 01, 2003 5:17 am
Location: Claremont, CA
Contact:

Re: Macintosh modding - a simple example

Post by Derakon » Fri Dec 05, 2003 3:56 am

Paul Siramy";p="142838" wrote:In MonStats.txt, check the columns TreasureClass1 to TreasureClass4(H) (the almost last columns) ;)
Ahh...I see. Evidently the Quill Rats are something of an exception, being so easy to modify. :) It's probably worth noting that changing the drops of other monsters requires a different approach, or rather, that changing the drops of other monsters is less obvious. The basic approach, if I am correct, is to look up the monster in the MonStats.txt file, see what its treasure classes are, and then go to the TreasureClassEx.txt file, find the appropriate treasure class, and modify it to be what you want.

Edit: I'm having some problems using MPQ Tool with OpenOffice (an open-source alternative to Microsoft Office). Notably, whether or not I'm successfully able to add a file back into the MPQ archive after modifying it is rather random; sometimes it works and sometimes it just refuses to add the file (it beeps but gives no error message). Oddly, if I open the file up again in TextEdit and just save it, then I'm able to import the file back into the archive; I suspect this means that OpenOffice tweaks the file format ever so slightly when I save the file, making it incompatible; TextEdit turns it back to "pure" plaintext and it works.

Anyway, monsters in Blood Moor now drop unique rings that anyone can use. ;)
Last edited by Derakon on Fri Dec 05, 2003 4:11 am, edited 1 time in total.

Argumentative
Posts: 5
Joined: Sun Nov 30, 2003 5:15 am

Re: Macintosh modding - a simple example

Post by Argumentative » Fri Dec 05, 2003 6:42 am

Derakon";p="142847" wrote: Edit: I'm having some problems using MPQ Tool with OpenOffice (an open-source alternative to Microsoft Office). Notably, whether or not I'm successfully able to add a file back into the MPQ archive after modifying it is rather random; sometimes it works and sometimes it just refuses to add the file (it beeps but gives no error message). Oddly, if I open the file up again in TextEdit and just save it, then I'm able to import the file back into the archive; I suspect this means that OpenOffice tweaks the file format ever so slightly when I save the file, making it incompatible; TextEdit turns it back to "pure" plaintext and it works.
Does OpenOffice support the tab delimited file format? Because if you save it as a spreadsheet document then you are bound to have that problem. I suggest you double check the 'save as' option when you next save a file from OpenOffice.

Cheers
Argumentative

User avatar
Derakon
Posts: 82
Joined: Sun Jun 01, 2003 5:17 am
Location: Claremont, CA
Contact:

Re: Macintosh modding - a simple example

Post by Derakon » Fri Dec 05, 2003 8:52 am

Argumentative";p="142866" wrote: Does OpenOffice support the tab delimited file format? Because if you save it as a spreadsheet document then you are bound to have that problem. I suggest you double check the 'save as' option when you next save a file from OpenOffice.
Oh, that's not the issue. OpenOffice handles a surprisingly large number of file formats, including .csv (Comma-Separated Values), which is essentially a plaintext method of encoding tables. When you tell it to open a file as a CSV file, it asks you what the delimeter is, as well as whether it should put quotation marks around strings (for some reason). Likewise you can tell it to save using tab-delimination. As far as I can tell, the file that it outputs from that is identical to the plaintext form, but there's something hidden that's screwing things up. Sometimes. At least there's a simple workaround.

User avatar
Souricette
Retired staff
Paladin
Posts: 185
Joined: Sat May 03, 2003 9:25 am
Location: Nice, France
Contact:

Hand-picked

Re: Macintosh modding - a simple example

Post by Souricette » Fri Dec 05, 2003 11:23 am

Derakon";p="142847" wrote:I'm having some problems using MPQ Tool with OpenOffice (an open-source alternative to Microsoft Office). Notably, whether or not I'm successfully able to add a file back into the MPQ archive after modifying it is rather random; sometimes it works and sometimes it just refuses to add the file (it beeps but gives no error message). Oddly, if I open the file up again in TextEdit and just save it, then I'm able to import the file back into the archive; I suspect this means that OpenOffice tweaks the file format ever so slightly when I save the file, making it incompatible; TextEdit turns it back to "pure" plaintext and it works.
Well... MPQ Tool will not bother about a file content - you can put whatever you want in a .txt file, it is not concerned, even if it's not a tab-delimited file! But it will replace all line endings by the Windows one (cr-lf), so your original file will be changed somehow.
It's strange that you don't have an error message when it fails to insert it, though... If you are on OSX, could you please launch the Console application (Applications:Utilities folder) after you have an unsuccessful insert, and look for something like an error message (marked with <SLPlugin>) there?

It may be also that OpenOffice does not CLOSE the file correctly - so MPQ Tool is not able to open it to change its line endings, I'll investigate the code to see where it beeps without displaying an error message...

Souricette

User avatar
Derakon
Posts: 82
Joined: Sun Jun 01, 2003 5:17 am
Location: Claremont, CA
Contact:

Re: Macintosh modding - a simple example

Post by Derakon » Fri Dec 05, 2003 7:49 pm

Souricette";p="142885" wrote: It's strange that you don't have an error message when it fails to insert it, though... If you are on OSX, could you please launch the Console application (Applications:Utilities folder) after you have an unsuccessful insert, and look for something like an error message (marked with <SLPlugin>) there?

It may be also that OpenOffice does not CLOSE the file correctly - so MPQ Tool is not able to open it to change its line endings, I'll investigate the code to see where it beeps without displaying an error message...
You got it the second time. I just had to close the file in one application so the other application could open it. :roll: Thanks for the help.

Though I didn't get an error on the Console...*shrug*

User avatar
Souricette
Retired staff
Paladin
Posts: 185
Joined: Sat May 03, 2003 9:25 am
Location: Nice, France
Contact:

Hand-picked

Re: Macintosh modding - a simple example

Post by Souricette » Sat Dec 06, 2003 8:04 pm

Derakon";p="142951" wrote:...
Though I didn't get an error on the Console...*shrug*
I'll investigate that, and display a message in that case for next version!

Souricette

User avatar
Logosphere
Posts: 1
Joined: Sun Jul 11, 2004 7:08 pm

Post by Logosphere » Sun Jul 11, 2004 7:19 pm

hey the mod makin advice doesn't work 4 me :cry: and :x the thing screwed up my diablo 2 version so i couldn't play on b net...i amm runnin OS 10.3.2 and i dunno whas rong... lolol 8-O

User avatar
Souricette
Retired staff
Paladin
Posts: 185
Joined: Sat May 03, 2003 9:25 am
Location: Nice, France
Contact:

Hand-picked

Post by Souricette » Mon Jul 12, 2004 8:48 am

Logosphere";p="182726" wrote:hey the mod makin advice doesn't work 4 me :cry: and :x the thing screwed up my diablo 2 version so i couldn't play on b net...i amm runnin OS 10.3.2 and i dunno whas rong... lolol 8-O
Of course you had a backup... :)
If it was not the case, you will have to reinstall your D2.

Did you try to follow EXACTLY the steps described in that thread, or did you try to create a mod on your own?
What's happening exactly?

Souricette

User avatar
SwanDruid
Posts: 4
Joined: Mon Mar 24, 2008 6:27 pm

Re: Macintosh modding - a simple example

Post by SwanDruid » Mon Mar 24, 2008 8:18 pm

Hey there -
how would I use this to generate a Red Rune Mod for the Mac? the tutorial looks great, but I am really new to modding :)
thanks!

User avatar
Contrail
Retired staff
Paladin
Posts: 169
Joined: Sun Jul 13, 2003 1:37 am
Location: Austin, TX
Contact:

Re: Macintosh modding - a simple example

Post by Contrail » Mon Mar 24, 2008 9:27 pm

Please do not reply to threads that are nearly four years old. The originator of this thread no longer visits the Keep on a regular basis. I will attempt to assist you in the other thread you started about this subject.

- Contrail

Locked

Return to “Mac Modding”