Skip to content

[Mod Tutorial] How to make Items

ValendaleValendale Member Posts: 34
edited November 2013 in BGII:EE Mods
Sparing others the pain I went through trying to learn this, this thread is meant to walk you through it step by step and tell you, specifically, how to make items.

First you need to copy your dialog.tlk file to your root directory and make a backup of it. You can find dialog.tlk in \Baldur's Gate II Enhanced Edition\lang\YourLanguageHere. Just move it back to the \Baldur's Gate II Enhanced Edition\ folder.

Next download WeiDU and place it in your \Baldur's Gate II Enhanced Edition folder, I think you can just extract the WeiDU folder there and copy/paste WeiDU.exe but I'm not sure because I copied everything while trouble shooting.

After that, you need to open a notepad or text file and edit it to read something like this. Just copy and paste the following bit to get started, make sure word wrap is turned off if you're using it.

BACKUP ~Silky/backup~

AUTHOR ~YourAuthorName, at http://forum.baldursgate.com~ // if you want, you can put your email here instead

BEGIN ~Silver Silk Chainmail~

COPY_EXISTING chan18.itm ~override/Silky.itm~ //note that the total file name, excluding file extension, must not exceed 8 characters.
SAY NAME1 ~Soft Mail~
SAY NAME2 ~Silver Silk Chainmail~
WRITE_LONG 0x1e THIS BAND BNOT BIT29 // Silver Spider Thread
SAY 0x50 ~At first glance it's hard to tell whether this is meant to be used as protection, but the fibers seem strong enough to deflect blows. Maybe someone can help identify it.~ // General description
SAY 0x54 ~The Silver Silk Chainmail was sewn from the webs of silver spiders, offering the protection of mail and the flexibility of cloth. It is believed that such rare vestments originate from a hidden monk sanctuary high atop a mountain at the Spine of the World.~ // Identified description
COPY_EXISTING ~ribald.sto~ ~override~
ADD_STORE_ITEM "Silky" #10 #0 #0 ~IDENTIFIED~ #5
Rename that txt file something like Silky.tp2. You can open it with your favorite text editor at any time if you right click and select "Open with..." (if extensions like .txt and .tp2 are hidden you may have to enable them in your folder option). Then rename a copy of WeiDU.exe to setup-Silky.exe and run it. This should create a copy chan18.itm and place it in your override folder with the new name and description. You're not done yet though!

Now you need to download Near Infinity, and if you don't already have it, you'll also need Java to run it. After downloading it with Java installed, extract it to your \Baldur's Gate II Enhanced Edition\ folder, to run it simply run NearInfinity-1.3.0.jar (there may also be a NearInfinity-1.3.0-ci.jar, I'm not sure of any difference). You should be able to find your new item under Override with the file name you gave it.

View gives you an overview, and if you click edit you can easily modify and delete stats and effects. If you want to make the armor usable by anyone for example, click "unusuable by" and uncheck everything on each section. Also if you want to remove any sneak or arcane casting penalties, you can do so by selecting the effects and clicking remove. You can modify it to your liking adding and removing effects and toying with the colors and attributes. It may be best to make a backup of it before you save it if you're not sure, but when you're done just click export.

If you'd like to add it straight to your inventory when starting the game, in your Baldur.ini file after 'Program Options', add
	'Debug Mode',	'1'
IE
'Program Options',	'Debug Mode',	'1'
Then once you load a game you can hold CLT and press Space bar and inter the following command. CLUAConsole:AddItem("Silky")

Alternately if all went well you should be able to find your new armor in Ribald's store.
Post edited by Valendale on

Comments

  • ValendaleValendale Member Posts: 34
    edited November 2013
    Ok but I don't have any clue how to get WeiDU to do that, or how to install Near Infinity properly and get it working right. Can you walk me through it like I'm a total noob trying for the first time and don't know ANYTHING I need to do to get started, assuming the Read Me's don't even help because they assume a starting point I obviously haven't reached yet and don't get to the specifics of "Create Item" in a clear enough manner?

    WeiDU seems to do an awful lot and it's indecipherable to me right now, even the readmes are indecipherable. Back on BG2 Vanilla, I believe with one I used Shadow Keeper to copy an item and then a GUI Editor of some sort to edit it and it's description, but that was like 10 years ago and nothing seems to work now. Obviously I have to copy and move files around and stuff but I have no clue exactly what to place where, besides what I needed to move to get Shadowkeeper to run.
  • WispWisp Member Posts: 1,102
    edited November 2013
    Near Infinity (NI) requires Java. Past that it's just a matter of running the program.

    WeiDU requires you to create a text file called mymod.tp2 in your game folder, where "mymod" is the name of your mod. Once you have that file, you paste the mod template into it, and round it out with TP2 code that does what you want to do (e.g., the snippet I posted here). Once your TP2 file is in order, you download WeiDU and copy weidu.exe into your game folder. Rename weidu.exe into setup-mymod.exe and you are ready to install. If you have installed a WeiDU mod before, it should be pretty obvious. If you haven't, you should first familiarise yourself with how you install them. Looking at already created mods is also a good way to learn ('course, it's also a good way to pick up bad habits or bad ways of doing things, but that's just how it is).

    If you prefer a graphical tool, NI can edit and create items just fine. There is also a tool called DLTCEP that gives you a more abstracted view of the files you edit. Unfortunately, I don't have a download link handy. Neither NI nor DLTCEP will allow you to create a distributable mod, however (for that you need WeiDU).
  • ValendaleValendale Member Posts: 34
    edited November 2013
    Ok so I'm still a little confused. Suppose I want to use chan01.itm as in the example, do I just run this script in WeiDU and it will automatically copy the relevant file and alter the description?

    If so that's one problem solved, and if I can use this exact template with other items, it's a phenomenal help (assuming I can figure out how to make WeiDU run the script) but how do I alter the item's attributes?

    !!!

    Before I couldn't install a mod because I needed to delete all local content and reinstall the game. Much to my pleasant surprise, this has also made Near Infinity work. I have no clue what strangeness was preventing everything from working before, maybe something downloaded wrong the first time. Thanks for the help!
  • WispWisp Member Posts: 1,102
    Valendale said:

    Ok so I'm still a little confused. Suppose I want to use chan01.itm as in the example, do I just run this script in WeiDU and it will automatically copy the relevant file and alter the description?

    Yes. COPY_EXISTING sources it's files from the override and the game's biff archives (in that order of priority). In other words, you can use COPY_EXISTING to work on any file that already exists in the game.
  • ValendaleValendale Member Posts: 34
    Hmm it seems a weakness of NI is that altering the description of a custom item also alters the description of the items they're based on. There's probably an easy solution from within NI, I seem to recall one about 10 years ago.
  • ErgErg Member Posts: 1,756
    edited November 2013
    Valendale said:

    Hmm it seems a weakness of NI is that altering the description of a custom item also alters the description of the items they're based on. There's probably an easy solution from within NI, I seem to recall one about 10 years ago.

    There is, but don't do that :)

    I mean don't use NI to change descriptions if you want to share your mod with others. In fact item descriptions are stored in DIALOG.TLK instead of the ITM file.

    Sharing your DIALOG.TLK with others simply can't be done, because the actual content of this file depends on several factors (game version, other mods, etc.).

    Using WeiDU and the command SAY, like in @Wisp example, can solve both problems at once, i.e. you can easily have a different description for the original and the edited item and at the same time your mod will work for others too. In fact WeiDU will be able to update DIALOG.TLK, during mod installation, and in the correct manner for each user of your mod.
  • ValendaleValendale Member Posts: 34
    I'm sure this is a really noob question, but how do I run "mymod.tp2" with WeiDU and how do I know if it worked? Like, do I need to place "mymod.tp2" in a specific folder, do I need to have the executables in a specific folder, which executable do I run it with, will the result go straight to the override folder or will I have to move it from somewhere?

    It's all really confusing, and the readme is arcane if you don't already have an idea what you're doing.
  • ValendaleValendale Member Posts: 34
    Once I get the hang of it I think I'll place items on monsters Muahahaha, MUAHAHAHAHAHA yes I can use Shadowkeeper for that I believe...

    That way I could add all kinds of nice little surprises and scatter them around to named beasts our hero will kill regardless of alignment.
  • ErgErg Member Posts: 1,756
    Valendale said:

    I'm sure this is a really noob question, but how do I run "mymod.tp2" with WeiDU and how do I know if it worked? Like, do I need to place "mymod.tp2" in a specific folder, do I need to have the executables in a specific folder, which executable do I run it with, will the result go straight to the override folder or will I have to move it from somewhere?

    It's all really confusing, and the readme is arcane if you don't already have an idea what you're doing.

    To run "mymod.tp2" with WeiDU, just rename WeiDU.exe -> setup-mymod.exe and double click on it.

    If it works you'll get the message "SUCCESSFULLY INSTALLED mymod".

    I normally create a folder "mymod" containing all the relevant files (including mymod.tp2) and subfolders, except setup-mymod.exe that I put just outside the folder "mymod".

    Both the folder "mymod" and "setup-mymod.exe" need to be in the main game directory (i.e. the one with chitin.key in it) for the installation to work.

    If you have code like

    COPY_EXISTING chan01.itm ~override/prefix#cha01.itm~ //note that the total file name, excluding file extension, must not exceed 8 characters.

    in your tp2 file, then the resulting item will go directly to override.
  • ValendaleValendale Member Posts: 34
    Ok so let's say I copy and paste this exactly into a text file using Notepad, then rename that file, extension and all, to monky.tp2

    /*
    * Start with an item that is already close to what you want and change the things
    * you want to change about it.
    */
    COPY_EXISTING chan01.itm ~override/prefix#cha01.itm~ //note that the total file name, excluding file extension, must not exceed 8 characters.
    SAY NAME1 ~Mail of the Monk~
    SAY NAME2 ~Mail of the Monk~
    WRITE_LONG 0x1e THIS BAND BNOT BIT29 // Everyone loves bit flipping. And it's perfectly intelligible too! Make the armour usable by Monks
    SAY 0x50 ~Chain Mail so breezy, even Monks can wear it!~ // General description
    SAY 0x54 ~Chain Mail so breezy, even Monks can wear it!~ // Identified description

    Then with that file placed in my root directory for /Baldur's Gate II Enhanced Edition, I copy and paste weidu.exe there, and rename it setup-monky.exe and run it.

    What am I doing wrong?
  • ErgErg Member Posts: 1,756
    Valendale said:

    What am I doing wrong?

    That doesn't work because it is just a snippet and not the whole tp2 script.

    Try with something like

    BACKUP ~monky/backup~

    AUTHOR ~Valendale, at http://forum.baldursgate.com~ // if you want, you can put your email here instead

    BEGIN ~Monky Mod~

    COPY_EXISTING chan01.itm ~override/prefix#cha01.itm~ //note that the total file name, excluding file extension, must not exceed 8 characters.
    SAY NAME1 ~Mail of the Monk~
    SAY NAME2 ~Mail of the Monk~
    WRITE_LONG 0x1e THIS BAND BNOT BIT29 // Everyone loves bit flipping. And it's perfectly intelligible too! Make the armour usable by Monks
    SAY 0x50 ~Chain Mail so breezy, even Monks can wear it!~ // General description
    SAY 0x54 ~Chain Mail so breezy, even Monks can wear it!~ // Identified description

    Also replace "prefix#" above with your actual prefix or, if you don't have one yet, at least something short (2-3 characters max) otherwise it will not work.

    Finally, be sure to be in the right folder. In the Enhanced Edition this may not be the root folder. It must be the folder with chitin.key in it.
  • ValendaleValendale Member Posts: 34
    Muahaha... MUAHAHAHAHAHA.

    THANK YOU that's everything I needed to know to get started!
  • ValendaleValendale Member Posts: 34
    edited November 2013
    Gah! I just realized I was having problems because I was leaving in prefix#, it actually needs to be something like this it seems.

    BACKUP ~Silky/backup~

    AUTHOR ~Valendale, at http://forum.baldursgate.com~ // if you want, you can put your email here instead

    BEGIN ~Silver Silk Chainmail~

    COPY_EXISTING chan18.itm ~override/Silky.itm~ //note that the total file name, excluding file extension, must not exceed 8 characters.
    SAY NAME1 ~Soft Mail~
    SAY NAME2 ~Silver Silk Chainmail~
    WRITE_LONG 0x1e THIS BAND BNOT BIT29 // Silver Spider Thread
    SAY 0x50 ~At first glance it's hard to tell whether this is meant to be used as protection, but the fibers seem strong enough to deflect blows. Maybe someone can help identify it.~ // General description
    SAY 0x54 ~The Silver Silk Chainmail was sewn from the webs of silver spiders, offering the protection of mail and the flexibility of cloth. It is believed that such rare vestments originate from a hidden monk sanctuary high atop a mountain at the Spine of the World.~ // Identified description

  • Saigon1983Saigon1983 Member Posts: 157
    @Valendale, @Erg, @Wisp,
    I have few questions:
    1. If I use tra-file for description and names of my items, what command should I include in (for example) this code? So, I want not ==SAY NAME1 ~Soft Mail~== but ==SAY NAME1 @100== and my tra is named mytra.tra and located somwhere in mod directrory.
    2. What the hell is ==THIS BAND BNOT BIT29== And what it tells to weidu? And for what purpose WRITE_LONG is used here, but not SAY command?
  • Saigon1983Saigon1983 Member Posts: 157
    If you could, tell me about that both for vanilla & EE games
  • WispWisp Member Posts: 1,102
    @Saigon1983
    1. Place your TRA file somewhere appropriate inside your mod folder. Use the LANGUAGE statement to have it loaded. LANGUAGE looks like
    LANGUAGE English english ~mymod/tra/english/somefile.tra~ and goes after any TP2 flags and before the first component.

    2. Without getting overly technical, THIS is the value of the field being written to. The whole thing (WRITE_LONG 0x1e THIS BAND BNOT BIT29) makes the item usable by monks, by manipulating the usability bitfield at offset 0x1e. Bit 29 is the bit controlling usability by monks (if the bit is set, can't use the item).

    SAY is used for converting strings into string references and writing the value resulting from that conversion. WRITE_LONG writes an integer to a field 8 bytes long (a dword). SAY and WRITE_LONG are similar but not interchangeable.
  • Saigon1983Saigon1983 Member Posts: 157
    @Wisp, thanks. The first part I've already understand myself. Second is very useful!
  • metalmunkimetalmunki Member Posts: 67
    Assuming this tutorial still applies, any idea if this just replaces an existing item rather than creating a new one? I can't see anywhere in the code that suggests it's an entirely new item.
  • The user and all related content has been deleted.
  • NoloirNoloir Member, Mobile Tester Posts: 380
    @Subtledoctor

    In the mod template above where would stastical information be written?
  • Daeros_TrollkillerDaeros_Trollkiller Member Posts: 327
    Thank you very much for this tutorial, it has been a great help with learning WeiDu specifically for some item mods I am working on.
  • shevy123456shevy123456 Member Posts: 265
    edited December 2023
    I gained some insights from this thread, such as the explanation about the
    bit-flag (very helpful explanation, by the way; I mean this without sarcasm,
    the monk no-use bit explanation was very useful).

    It's a bit unfortunate that all that information is spread out
    all over the world wide web, including the webforum here. I looked
    at the WEIDU documentation too, but this one is a bit confusing.

    That spellstudio page, on the other hand, is probably one of the
    best references I have found so far.

    For instance it lists entries such as:

    SPWI118 Chromatic Orb

    So I can kind of understand that as a mapping, e. g. the filename or
    identifier, to the particular spell as such.

    The ideal situation would be a complete reference, such as the spellstudio
    pages, but also a useful, up-to-date tutorial there. I think so far I found
    only two tutorials, but they were not extremely helpful. I kind of need
    more of a reference with examples of things that I see in various mods.

    Once I understand the format, I think I can autogenerate tons of things.

    For instance, in one quest mod the sahuagin or so are listed that way:

    FILENAME NAME TYPE LEVEL STR STR+ DEX CON INT WIS CHA HP AC THAC0 APR EXP CLASS KIT APPEARANCE WEAPON1 WEAPON2 QUIVER1 QUIVER2 QUIVER3 MEMORIZATION >
    sahkng01 King Ixilthetocal Overridden 20 22 0 9 9 13 9 18 90 5 1 5 4000 Sahuagin none Sahuagin Large Skull none none none none none none 8,10,9,9,11 n>

    I am pretty certain I can simply autogenerate such text files, using
    data from other files that I already have (from .yml files), due to
    prior rpg-related projects I created or noted down. Right now it is
    a bit confusing to understand all these macros in use.
Sign In or Register to comment.