Skip to content

[MODS] NearInfinity Tutorial for BGII:EE Available?

Merak_HaguenMerak_Haguen Member Posts: 2
Hello and good day.
Although i visit the forum a lot, i have never created an account until now.
After installing some mods I decided that as a programer I could do one my self. With some research on the forum I discovered that I needed Near Infinity software. I downloaded it and got it running. Did some researches and I did not find exacly how to start and how to publish them with WeiDU. I wanted at first to develop a class kit, a simple one. Could any provide some information? Links? The content I have found on the web did not help much, nor the videos on YouTube.

Comments

  • GusindaGusinda Member Posts: 1,917
    Hi @Merak_Haguen, and welcome to the forum. I type this on the presumption that you are using Windows when recommending some tools.

    I am currently doing the same and am sitting at level 1 with almost enough XP to advance to level 2, but I have gathered together various references. This is part of what I have found to date:

    WeiDU
    WeiDU Manual - Best reference out there for WeiDU. Also grab the mymod.tp2 tutorial file as well. It is old and I found it difficult to read the first time, but as I go back to it and reread (when trying to find out how to do something), it becomes more understandable.

    WeiDU Forum - Interesting to keep an eye on.

    Making a weidu mod with your custom item - Great starting tutorial and would be the place I recommend you start at. The author recommends ConTEXT, tried it but I prefer and suggest Notepad++ as the editor. Although it is an item mod and not a kit mod, it helps you understand the relationship between the modname.tp2 file and the associated translation file(s).

    IESDP - Helps you understand the workings of the file structures in Infinity Engine files.

    Comprehensive IE Modding Tutorial Index - Haven't gone through them all yet (I am only looking at these places when I am trying to find things out, like WTF does that syntax mean was in that mod!). Some of the links are outdated as the site has been moved but the links haven't been updated or they just no longer exist.

    Definitions, Tools and Resources - good general reading but it also has links to some further tools you might want later on.


    Kit specific:
    Beamdog Forums: [How to] Making kit mods for the EE! - there are a lot of pages here but it was a starting point.

    Barbarian/Sharman: @Raduziel was kind enough to add some great comments when putting this mod together. It is more of a tutorial (but still works as a kit mod) and has been very helpful.

    fl-add_kit_ee - seeing that you are making a kit, you will probably want to keep an eye on this as well. It is a library file for adding kits to EE.


    NearInfinity:
    Apart from the content in the main threads in Beamdog and Spellhold Studios, it has mostly been getting ideas out of the forum itself and taking in the problems that have been presented and looking at the solution and the discussion leading up to the solution. You certainly need to sit down and play with NI to come to grips with the interface and how IE stores it's files though.

    Other:
    All those mods that exist out there already. A number of authors keep their mods detailed with comments inside. This makes it easier to read and understand what is going on. Using Notepad++ with the WeiDU highlighter will make the comments stand out for reading.


    Recommendations:
    I have only writen a couple of small mods (mostly item based) but have drawn up some outlines for a couple of kits, so I am definately not experienced in the matter but I recommend grabbing yourself some other tools:
    EEKeeper - Whenever I have been modding, I have both NI and EEKeeper open to see what is happening with the items and saved games. It is also easier to identify the item codes you might be chasing.

    Notepad++. Being a programmer, you are likely to have this already but add in the WeiDU Highlighter that was created by @Argent77. It has been a godsend. I have also setup Notepad++ to use a monospaced font (Consolas) to make reading easier.


    I find at the moment, that I read each mod's internals before installing (for my own games) so I can try to understand what is going on, then follow it through during and after install. I find it just as interesting/challenging and frustrating as playing the game... It does take a long time to setup a game though.

    I have a number of other resource links and info but I have probably put too much here already to a point of 'where do I start now?'. Others resources though go into scripting and NPC construction... and I am building my own resource kit such as a mod Template, library file collection, readme and folder structure (still a long way to go as it is prob 0.1 Alpha).

    Hopefully that helps and and gets you to a point where you can understand the concepts and at least get a start on the syntax. I almost forgot the best resource of them all; that is the knowledge of the members within this forum. If you get stuck, then pose the question and I am sure that some smart individual out there will provide the answer...

    For others reading this, if there any more references avaiable (and I am sure there is), please add them.

    Gus
  • RaduzielRaduziel Member Posts: 4,714
    edited April 2019
    Welcome @Merak_Haguen

    First, keep in mind that you will fail. A lot. Near Infinity is not intuitive and lots of things work in mysterious and undocumented ways, so every now and then you'll have everything packed right and your code will somehow misbehave.

    That leads me to the second thing: ask around. As a rule of thumb, this community is very helpful. We have a thread for general questions that is huge by now but I advice you to read it.

    Third thing: Reverse-engineer. If you want to make a kit mod, download kit mods and look inside their files. I honestly think that nobody in this community made more kits than I did so far, so feel free to download anything I've uploaded to see how I made things work. I try to keep my coding as organized as possible exactly for people like you.

    As @Gusinda said, I've built a small kit-tutorial - a good starting point. Deities of Faerûn is by far my most complex kitpack, so it is not a good place to start. Maybe my Charlatan would better fit in this situation. Or something in between like I Hate Undead.

    Here is my list of sites under my "Modding" favorite folder:

    Script Tutorial. You probably won't use it for kits (I had to use on two occasions, though).

    http://www.pocketplane.net/tutorials/simscript.html

    More Script - Actions. Things that your script does.

    https://gibberlings3.github.io/iesdp/scripting/actions/bgeeactions.htm

    More Script - Triggers. Things that allow your script to do something.

    https://gibberlings3.github.io/iesdp/scripting/triggers/bgeetriggers.htm

    IDS Files - this is how the game recognizes things.

    https://gibberlings3.github.io/iesdp/files/ids/bgee/index.htm

    Opcodes - self-explanatory for a programmer, I suppose.

    https://gibberlings3.github.io/iesdp/opcodes/bgee.htm

    2DA files - things the game reads to do stuff

    https://gibberlings3.github.io/iesdp/files/2da/2da_bgee/index.htm

    Strings and Token - this is pretty much for dialogues and texts in general.

    https://gibberlings3.github.io/iesdp/appendices/token_lists/bgeetokens.htm

    Weidu Manual (Gusinda already posted it) - I find it very confusing, but I'm dumb as a brick

    http://weidu.org/~thebigg/README-WeiDU.html

    Hexadecimal to Decimal Converter

    https://www.binaryhexconverter.com/hex-to-decimal-converter

    Decimal to Hexadecimal Converter - because Infinity Engine hates you and uses both

    https://www.binaryhexconverter.com/decimal-to-hex-converter

    Some opcodes work with colors, I use this site to know what to input in them

    https://www.rapidtables.com/web/color/RGB_Color.html

    A free image editor - always useful for things like icons for your kit's special abilities. Works online and is pretty much stupidproof (that's why I use it)

    https://pixlr.com/editor/

    TSR Monster Manual ( @JuliusBorisov if this breaks any copyright stuff feel free to edit it out ) - useful for creating spells that summons stuff or for having a parameter to define how strong a creature related to your kit should be

    http://dedpihto.narod.ru/games/Monsters1/MM00000.htm#854236a9

    My inbox is open.
    Post edited by Raduziel on
  • AlonsoAlonso Member Posts: 806
    edited May 2019
    I am going over the WeiDU readme and I have a zillion questions. Before I start asking, I'd like to know what is the best place to ask. The WeiDU forum seems like an obvious candidate, but the discussions there seem quite advanced, and my questions are basic.

    As an example, my first question would be: What is the D format and why is it important to learn it?
    Gusinda wrote: »
    I have a number of other resource links and info but I have probably put too much here already to a point of 'where do I start now?'.
    I would be quite interested in checking those other resources, at least those which are suitable for beginners.
    Post edited by Alonso on
  • GusindaGusinda Member Posts: 1,917
    Hi @Alonso, most of the links that I have are already posted under @Raduziel links. Anything else is about what others have done with their mods (esp those that are documented). That is where the treasures are found.

    My understanding about the .D format is a .dlg format that it is not yet compiled (all about dialog). It is easier to read for us and generate, but not so the game...

    I personally haven't looked at any of that yet as the mods I am looked at first were all about items/spells etc. It was easier for me to start there to get the fundamentals of WeiDU prior to getting into any interacting components. It was: create an item (with NearInfinity), place it into the game with description etc to understand the linkage between WeiDU and dialog.tlk.

    Next step (what I am doing now), is creating the item using WeiDU and offset editing to understand how WeiDU works with other 'simpler?' components of the game and get into loops to do things a bit more efficiently. Once I am happy that I understand that part, I will look at an NPC of some sort or perhaps a familiar (have an idea for that one already) and interacting with the group or just the protagonist, which is more about dialog and scripting.

    If you read the mymod.tpa that goes with the manual, you begin to understand what the manual is trying to do. That .tpa is documented and there is reference to it throughout the manual. It took a couple of reads though...

    Gus
  • jasteyjastey Member Posts: 2,781
    @Alonso A d-file is a text file where the uncompiled dialogue is written into. It's readable for us and upon installation, it will be compiled to the dlg-file the game uses. (Sidenote: there can be more in a d-file than just one dialogue, there can also be patches to other dlgs or several dialogues in one d-file.)
    The thing with the IE-engine is the following: all text lines of names, dialogue, and descriptions is inside the "dialog.tlk". Every dialogue, character name field, or item description just points to the string number inside this dialog.tlk file. So, if you take a (compiled) dlg-file out of your game and put it into someone else's, it would be of no use since the pointers would now point to string numbers in their dialog-tlk which results in random texts (unless your dialog.tlk would be exact the same as the other one's, but that is usually not the case in modded games).
    That is why we need the "weidu-installer" to add the new text strings to the dialog.tlk and make the connection to the dialogues/names/descriptions upon installation. This has to be done in every game for every player individually upon installation of the mod.
    To repeat myself: In the IE-engine, it is not possible to e.g. create an item with custom descriptions and then just give the itm-file of the item so someone else - the descriptions would be lost. That is (one thing where) we need the weidu installer for.
  • AlonsoAlonso Member Posts: 806
    Thank you for all these explanations.
    Gusinda wrote: »
    If you read the mymod.tpa that goes with the manual
    What is mymod.tpa?

    @jastey: I have written what you've said in my own words to see if I understand:

    All the text used in an IE game is stored in a file called dialog.tlk. That includes creature names, dialogues, item descriptions, etc. All this text is stored inside dialog.tlk in the form of text strings. The other files used by the game, like character files, dialogue files or item files, don’t contain any text. Instead, they contain references to the text strings inside dialog.tlk.

    When you install a weidu mod, the weidu installer copies the text strings in that mod to the dialog.tlk file. Then, it creates references to those text strings in each file of the mod that uses those text strings.

    Modders store the text of their mods in dialog files. There are two types of dialog files: D files and DLG files. D files contain the dialogs in a text format that is easy to read for humans. DLG files are the result of compiling D files into a format that WeiDU can read. D files can include dialogs (one or more) or patches to DLG files.
  • kjeronkjeron Member Posts: 2,368
    Alonso wrote: »
    All the text used in an IE game is stored in a file called dialog.tlk. That includes creature names, dialogues, item descriptions, etc.
    One thing it does NOT include, is various text used exclusively by the UI: titles and labels for various buttons, screens, and most of the options menu.
  • GusindaGusinda Member Posts: 1,917
    @Alonso, sorry my mistake. I meant to say 'mymod.tp2'...

    It is a .tp2 that is commented and used as the tutorial example referenced in the manual. It can be found here.

    Gus
  • jasteyjastey Member Posts: 2,781
    edited May 2019
    Alonso wrote: »
    All the text used in an IE game is stored in a file called dialog.tlk. That includes creature names, dialogues, item descriptions, etc. All this text is stored inside dialog.tlk in the form of text strings. The other files used by the game, like character files, dialogue files or item files, don’t contain any text. Instead, they contain references to the text strings inside dialog.tlk.
    Correct, except for what @kjeron mentioned, as well as script names (formerly called death variables, i.e. the "scripting name" a creature is called by internally in scripts etc).
    Alonso wrote: »
    When you install a weidu mod, the weidu installer copies the text strings in that mod to the dialog.tlk file. Then, it creates references to those text strings in each file of the mod that uses those text strings.
    Correct, with one addition: weidu also scanns the dialogue.tlk file whether a string that matches the to be patched one already exists and uses that. It does not add doubled strings to the dialog.tlk.
    Alonso wrote: »
    Modders store the text of their mods in dialog files. There are two types of dialog files: D files and DLG files. D files contain the dialogs in a text format that is easy to read for humans. DLG files are the result of compiling D files into a format that WeiDU can read. D files can include dialogs (one or more) or patches to DLG files.
    Correction: dlg is what the engine uses. Weidu takes the d-file upon installation and compiles it into a dlg the engine can use. Weidu can also decompile the dlg into a d-file.
    The dlg is the "real NPC dialogue file" inside the game (and useful only in combination of this game's dialog.tlk). A d-file is just a sum of dialogue commands you want to add to the game (as I already pointed out, you can put several NPCs' dialogues into one d-file, the d-file is only the place where weidu looks for what it has to compile.)

  • AlonsoAlonso Member Posts: 806
    I'm reading the Step-By-Step Beginner’s Guide to WeiDU.
    Start by decompiling existing in-game DLGs that you understand and read through them.
    How do I decompile an existing in-game DLG? Why should I understand an in-game DLG? Why does a "Step-By-Step Beginner’s Guide" assume that I know and understand all of that?
  • GwendolyneGwendolyne Member Posts: 461
    edited May 2019
    with a command line:
    weidu --transitive GARREN.DLG --out "C:\JEUX\Black Isle\DIAMANT GoG\script compiler\decompiled"
    

    Replace GARREN.DLG with the dialog you want to decompile and "C:\JEUX\Black Isle\DIAMANT GoG\script compiler\decompiled" with the folder name where you want to save the .d file.
Sign In or Register to comment.