Skip to content

Looking for some tips on creating an item mod that involves cromwell and cespenar

Heya folks, I am looking for some tips on how I would go about using WeiDu to add some additional SoD items into BG2:EE as well as some new upgraded items that would be created from them using new recipes added to cespenar.

I am still very much a novice at WeiDu, but I am learning quickly.

So far, I am comfortable with being able to modify items in NI, then import them into the games with new/updated descriptions using WeiDu.


Thanks in advance for any help or examples of TP2's that I could use as a starting point.

Comments

  • CryosaurCryosaur Member Posts: 15
    A great place to start would be the Item Upgrade mod, written by Weimer himself.
  • Daeros_TrollkillerDaeros_Trollkiller Member Posts: 327
    jastey wrote: »

    Thank you! I havent had time to digest this yet, but it looks to be exactly what I was looking for.

    And Cryosaur, thank you for that suggestion as well. I did look at it, but I'm still too green to pick apart a mod that advanced just yet

  • CryosaurCryosaur Member Posts: 15
    Okay, yeah. I had not actually looked at the code for Weimer's Item Upgrade mod but it is rather complex and polished.

    Check out CrevsDaak's Thalantyr Item Upgrade mod instead for a much simpler example. If you strip away the legacy game support and the extra bags it adds, you'll see that its TP2 only does a few things:
    1. copy new ITM files with names and descriptions
    2. compile a dialogue file, which adds to Thalantyr's conversation options
    Though rudimentary, this should give you a better foundation to understand how that G3 example should be laid out in various files, even if this mod does the new item "creation" inside of the dialog instead of via a script (.baf) like for Cromwell.
  • Daeros_TrollkillerDaeros_Trollkiller Member Posts: 327
    Thank you Cryosaur, I hadn't thought to look at that one, and from what you describe it sounds more akin to what I am trying to do with my mod.
  • Daeros_TrollkillerDaeros_Trollkiller Member Posts: 327
    I've tried dissecting the Thalantyr mod, and the issue I keep running into is similar with looking at the other item upgrade mods. The complexity (extra languages, different version compatbility, etc) is making is extremely difficult to understand what exactly does what.

    Some of the things I get confused most by are the @%number% references I see in these mods. I can tell in many cases that they refer to entries in other files for things like item descriptions, but I'm still having a hard time wrapping my head around what refers to what, and how it all works together.

    If I could get an example mod of just adding a single new item and recipe to cromwell/cespy that would give me a better understanding of how it all works and I could build off of it.
  • jasteyjastey Member Posts: 2,780
    edited August 2019
    I don't have time to create such a mod, but maybe talking about it will help a little.
    For a basic mod, you need the following:
    -the setup-yourmod.exe (renamed current weidu.exe)
    -a mod folder "yourmod"

    Indise the folder, you need the setup-yourmod.tp2. Basic of this would be:
    BACKUP ~yourmod/backup~
    AUTHOR ~forum topic where players can get help in case of install problems~   
    
    
    VERSION ~version number~
    
    
    README ~path to readme. If you don't have one yet, mark the line with //~
    
    BEGIN ~your mod's name~
    
    COMPILE ~mymod/dialogue/itemmod.d
    
    EXTEND_BOTTOM ~AR0334.BCS~ ~mymod/scripts/myitem.baf~
    

    Now you need to put the dialogue for Cromwell into a file "itemmod.d" and inside a subfolder "dialogue".
    The script addition into a file called "myitem.baf" and into a subfolder "scripts".
    From your other thread:
    itemmod.d would look like this:
    EXTEND_BOTTOM WSMITH01 13
    IF ~OR(3)
    PartyHasItem("sw1h60")
    PartyHasItem("bdsw1h02")
    PartyHasItem("scrl7t")~ THEN GOTO PartyHasAtLeastOneItem
    END
    
    APPEND WSMITH01
    IF ~~ THEN BEGIN PartyHasAtLeastOneItem SAY ~What's this then? Shards of a broken sword?~
    IF ~PartyHasItem("sw1h60")
    PartyHasItem("bdsw1h02")
    PartyHasItem("scrl7t")~ THEN GOTO PartyHasAllParts
    IF ~OR(3)
    !PartyHasItem("sw1h60")
    !PartyHasItem("bdsw1h02")
    !PartyHasItem("scrl7t")~ THEN GOTO PartyDoesNotHaveAllParts
    END
    
    IF ~~ THEN BEGIN PartyDoesNotHaveAllParts SAY ~These are the remnants of an ancient, powerful blade. If ye find more of it, I can forge a mightly blade for ye.~
    IF ~~ THEN GOTO MovingRightAlong
    END
    
    IF ~~ THEN BEGIN PartyHasAllParts SAY ~Aye, ye've collected the remains of an ancient blade . I can forge it into a mighty blade for ye.~
    IF ~~ THEN REPLY ~What's would that take?~ GOTO HowMuch
    IF ~~ THEN REPLY ~No, I'm not interested. Is there anything else you can use?~ GOTO MovingRightAlong
    END
    
    IF ~~ THEN BEGIN HowMuch SAY ~It'll cost ye 7,500 gold and without me apprentice, you'll need to stay on a day and help me run the forge.~
    IF ~PartyGoldGT(7499)~ THEN DO ~SetGlobal("CDItems","GLOBAL",1)
    SetGlobal("ForgeStuff","GLOBAL",1)
    TakePartyGold(7500)
    DestroyGold(7500)~ REPLY ~Yes, let's do it.~ GOTO 56
    IF ~~ THEN REPLY ~No, I'm not interested. Is there anything else you can use?~ GOTO MovingRightAlong
    END
    
    IF ~~ THEN BEGIN MovingRightAlong SAY ~Well, let's see what ye've got then.~
    COPY_TRANS WSMITH01 13
    END
    

    myitem.baf would look like this:
    IF
    Global("CDItems","GLOBAL",1)
    Global("ForgeStuff","GLOBAL",1)
    THEN
    RESPONSE #100
    SetGlobal("CDItems","GLOBAL",0)
    TakePartyItem("sw1h60")
    TakePartyItem("bdsw1h02")
    TakePartyItem("scrl7t")
    DestroyItem("sw1h60")
    DestroyItem("bdsw1h02")
    DestroyItem("scrl7t")
    GiveItemCreate("dtkswd01",PLAYER1,0,0,0) // completed item
    ActionOverride("wsmith01",StartDialogueNoSet([PC]))
    END
    

    EDIT: forgot the actual item... see below.

    That's for a basic mod all you need. Texts can all be inside the files, UNLESS you want to use non-latin letters or symbols. But English without symbols but with normal apostroph (') works fine for EE, too, without the need of text formatting using HANDLE_CHARSETS.
    Post edited by jastey on
  • jasteyjastey Member Posts: 2,780
    edited August 2019
    @Daeros_Trollkiller Also, please get yourself a modder prefix if you want to distribute your mod publicly in case you haven't already:
    https://www.gibberlings3.net/forums/topic/1649-community-filename-prefix-reservations/#comments
  • jasteyjastey Member Posts: 2,780
    Part II, ahem. Forgot the actual mod item above.

    Inside the tp2, you need to copy your mod's item, somewhere below the "BEGIN":
    COPY ~yourmod/itm/dtkswd01.itm~ ~override~
      SAY NAME1 ~your item name~
      SAY NAME2 ~your item name~
      SAY UNIDENTIFIED_DESC ~unidentified description~
      SAY IDENTIFIED_DESC ~identified description~
    

    And inside a subfolder called "itm", you put your mod item file dtkswd01.itm.
  • ALIENALIEN Member Posts: 1,271
    AUTHOR ~your email address where players can get help in case of install problems~
    
    should be
    AUTHOR ~Forum topic where players can get help in case of install problems~
    
    putting email there will expose it to spambots.
  • jasteyjastey Member Posts: 2,780
    Good point.
  • Daeros_TrollkillerDaeros_Trollkiller Member Posts: 327
    Thank you Jastey and Alien. I did go ahead and register my prefix when I started working on this mod. I will take some time to digest all this and try working with it.
  • jasteyjastey Member Posts: 2,780
    If something is not clear please ask. I'm not trying to sound like a modding nerd, I only lost sight of what is clear to a beginner and what isn't.
  • Daeros_TrollkillerDaeros_Trollkiller Member Posts: 327
    Not at all Jastey, I am very grateful for the help, I know it takes alot of patience to educate a novice, and I hope to get really good at this so I can contribute more :) I will be posting something shortly that I am running into.
  • Daeros_TrollkillerDaeros_Trollkiller Member Posts: 327
    I've got the mod working with the first item using the information you provided Jastey, I did run into one issue, but I was able to figure it out. the itemmod.d file I made was giving a me a syntax error - I had to add a second "END" at the end of it.

    I do have a couple of questions:

    I assume each item will need its own .d and .baf files? And if so, what is considered "best practice" in the TP2 file to reference each?

    Lastly, and I hate to even ask this because it seems silly: How does one go about putting em or en dashes for item descriptions? If I use the ascii code it appears correctly in the TP2 file, but in-game it turns into a ⯀. If I use two hyphens, it just remains two hyphens.
  • jasteyjastey Member Posts: 2,780
    edited August 2019
    You can combine the d and baf for two items. Baf is no problem, just add the second script block to the baf file. For the d file, you would need to consider both items in the dialogue. If you have a look at my Ajantis BGII mod into the ajantis_Cromwell.d, I considered two items there. Maybe it is easier to actually make two different d-files for two different items. Best you compile them and see how it plays out ingame.
    Your second question I am not sure I understand correctly. Do you want to use non-latin letters in your item name/description?
  • Daeros_TrollkillerDaeros_Trollkiller Member Posts: 327
    Thank you, I will check out that mod for reference.

    For the second item, I am referring to the longer dashes used in item descriptions. For example:

    Long Sword
    — 1d8 damage

    When I attempt to do this in the TP2 file for the item description, once I install the mod it shows in-game as the below:

    ⯀1d8 damage

    Does that make sense?
  • jasteyjastey Member Posts: 2,780
    edited August 2019
    Ah. This sounds a bit stupid but are those really long dashes? If I look at BGII:EE item descriptions with NI I'd say normal dashes would work, too. (I never used long dashes, to be precise...) EDIT: yes, it's long dashes, how embarassing.
    For long dashes, you'd need to work with tra-files and use HANDLE_CHARSETS so they get formatted to the needed utf-8 without BOM upon installation.
    Or your mod is only available for the EE, then you can just provide the tra files in utf-8 without BOM and don't need iconv.exe for the text transformation.
  • Daeros_TrollkillerDaeros_Trollkiller Member Posts: 327
    Thank you Jastey, I dont think I'm quite ready to try tackling TRA files just yet, though I do want to learn how to use them as at some point as I would like to be able to make mods capable of having translations other than english, even if I wouldn't be able to do said translations myself :)
  • Daeros_TrollkillerDaeros_Trollkiller Member Posts: 327
    Jastey, I've been working with your ajantis mod and it has been most helpful in helping me to see how adding multiple new recipes can work. In doing so, I also can see why using TRA files is very attractive as it makes for much "cleaner" DLG files and such. I'm still not quite ready to start working with them yet until I can get my mod working as desired with cromwell and cespy, but I definintely want to learn how to create a mod that allows different languages using TRA files that I can reference in my other files using things like @0, @1, @2, etc...

    Again, I want to thank you for all the help. This portion of creating the mods I want to make seemed insurmountable at first.
  • Daeros_TrollkillerDaeros_Trollkiller Member Posts: 327
    So, I have been working on my mod further, and I am able now to get cromwell recipes and cespy recipes working, and seeing the different methods in making them work, single .d and .baf files, multiple .d and .baf files, and I think I have a pretty good grasp of it, and figured out what method I want to use. I think I am ready to start trying to use TRA files to provide the descriptions for my items to keep things cleaner and more expandable in the future.

    I am going to see what I can put together by looking at other mods, but if you have any tips for how I would go about structuring my mod to include an english translation that could later be expanded to include others I would be most grateful.
  • jasteyjastey Member Posts: 2,780
    I like putting the language versions into subfolders which are called like the language (e.g. "english"), and those into a subfolder called "tra", or "language" which you prefer.
    Into this subfolder "tra/language" you also put the folder "iconv", which you can copy from any other mod that uses it and which contains the iconv.exe and some other files needed.
  • Daeros_TrollkillerDaeros_Trollkiller Member Posts: 327
    I have located the iconv.exe you referenced along with three .dlls Are the following all I need for the language/inconv folder?

    iconv.exe
    libcharset1.dll
    libconv2.dll
    libintl3.dll
  • Daeros_TrollkillerDaeros_Trollkiller Member Posts: 327
    I have been attempting to work with TRA files for providing descriptions and responses, but I am running into a snag that I don't seem to be able to get past. I am receiving invalid character Lexer errors such as the one below:
    [E:\Baldur's Gate II - Enhanced Edition\setup-crom.exe] WeiDU version 24600
    Using Language [English]
    
    [crom/language/english/english.tra] LEXER ERROR at line 37 column 1-14
    Near Text: !
            invalid character [!]
    
    [crom/language/english/english.tra]  ERROR at line 37 column 1-14
    Near Text: !
            Parsing.Parse_error
    ERROR: parsing [crom/language/english/english.tra]: Parsing.Parse_error
    ERROR: problem parsing TP file [CROM/CROM.TP2]: Parsing.Parse_error
    
    FATAL ERROR: Parsing.Parse_error
    
    Press ENTER to exit.
    

    I researched it and found that the issue may be due to the encoding, so I used notepad++ to make sure it was encoded in UTF-8 w/o BOM first, and then I tried again with it in ANSI, and got the same result.

    If you have the time, would you mind taking a look at my mod in it's current form to see what I am doing wrong?

    https://github.com/DaerosTrollkiller/InfinityEngineMods/raw/master/Cromwell%20mod%20test.zip
  • jasteyjastey Member Posts: 2,780
    I have located the iconv.exe you referenced along with three .dlls Are the following all I need for the language/inconv folder?

    iconv.exe
    libcharset1.dll
    libconv2.dll
    libintl3.dll

    @Wisp said that including the zip file that is also contained in some of the mods should be in there because of the open source license iconv.exe comes with. I am sloppy with this in my own mods, I have to admit.

    Before looking at your mod: make sure all lines in the tra are like this:
    @x = ~text~

    The ~~ tildas around the texts are important. My guess is that one is missing somewhere, probably at line 37 or above.
  • Daeros_TrollkillerDaeros_Trollkiller Member Posts: 327
    You were absolutely right. I cleaned up my TRA and checked for tildes and one was missing. I was going nuts trying to figure out why it wanted me to strip all my punctuation from it.
  • jasteyjastey Member Posts: 2,780
    My first install error was a missing tilda, as well. Took me three hours to figure it out. But how proud I was then!
Sign In or Register to comment.