Jump to content


Photo

Making a weidu mod with your custom item


  • Please log in to reply
21 replies to this topic

#1 Anton

Anton
  • Member
  • 4 posts

Posted 04 February 2013 - 11:06 AM

Real modders probably think only brain dead people would need a tut for this, but having just figured this out for myself, I want to help elevate my fellow dead-brains.

 

I will make this as short and unintimidating as possible.

 

Why you want to do this:

So you can put your custom items in any installation without stomping all over the game's dialog and text system.

Or, to share your item.

 

What you need:

1) Your custom .itm file. I still prefer Infinity Engine Editor Pro for making items and spells.  You'll probably need to download and register the comdlg32.ocx file to get IEEP to work on modern systems. Google it.

 

2) Text editor.  Notepad is fine for this. (but the recommended one for Weidu modding is ConTEXT with Weidu syntax highlighters.  google it.)

 

3) Weidu.exe file.  Download the latest version.

 

Your mod will consist of a total of 4 files, but you only need to write 2 of them.  We will make them one by one.  Replace all instances of "mymod" or "myitem" with the name of your mod or item.

 

1) mymod.tp2

This file will have 11 commands, divided into three parts.  You can copy and paste the code below and modify it for your own use.

 

//My Item Mod

//Part 1 (header section)
BACKUP ~mymod/backup~
AUTHOR ~myemail~
LANGUAGE ~English~ ~mymod/english~ ~mymod/english/english.tra~
BEGIN ~MyMod~

//Part 2 (add item to game)
COPY ~mymod/myitem.itm~ ~override/myitem.itm~
  SAY NAME1 @1
  SAY NAME2 @2
  SAY UNIDENTIFIED_DESC @3
  SAY DESC @4

//Part 3 (add item to an existing creature, in this case the shadow dragon, Thaxll'ssillyia)
COPY_EXISTING ~SHADRA01.cre~ ~override/SHADRA01.cre~
  ADD_CRE_ITEM ~myitem~ #0 #0 #0 ~NONE~ ~inv11~

 

If you have another item to add, simply duplicate part 2 and 3 for each item, but keep incrementing the numbers in the SAY commands (@5,@6,@7,@8 for second item, etc)


Now you may be wondering what those '@2' thingies are.  They are references to our next file:

 

2) english.tra

This file has the text for our item, listed using the reference numbers we used in the tp2 file above.

The four text fields we need are, in order:

unidentified name

identified name

unidentified description

identified description

 

text is contained in ~~ instead of the usual ""

 

here's an example:

////////////////////////////////////////////////
//Awesomesword
////////////////////////////////////////////////
@1=~Long Sword~
@2=~Awesomesword +3~

@3=~These swords are usually referred to as doubled-edged swords, war swords, or military swords.  In many cases, the long sword has a single-edged blade. There is no single version of the long sword; the design and length vary from culture to culture, and may vary within the same culture depending on the era.  Among the most common characteristics of all long swords is their length, which ranges from 35 inches to 47 inches.  In the latter case, the blade is known to take up 40 inches of the total length.  Most long swords have a double-edged blade and a sharp point at the tip.  Despite the tip, the long sword is designed for slashing, not thrusting.

STATISTICS:

Damage:  1D8
Damage type:  slashing
Weight: 4
Speed Factor: 5
Proficiency Type: Long Sword
Type:  1-handed
Requires: 6 Strength
Not Usable By:
 Druid
 Cleric
 Mage
~

@4=~Awesomesword

<some text describing your item>

STATISTICS:

Equipped Abilities:
 awesome

Combat Abilities:
 awesomeness: 10% chance to do some awesome shit.

THAC0: +3 bonus
Damage: 1D8, +1 Magical
Damage type: slashing
Weight: 2
Speed Factor: 2
Proficiency Type: Long Sword
Type: 1-handed
Requires: 11 Strength
Not usable by:
 Druid
 Mage
 Beast Master~

OK, guess what? Your "coding" is over!  All that's left is to put your mod into a nice package:

 

1) Copy weidu.exe and rename it 'setup-mymod.exe'. Put it in the same folder as your tp2 file.

2) Make a new folder called 'mymod' and put your .itm file in there.

3) Make a folder inside the mymod folder called 'English' and put your .tra file in there.

4) make a zip archive with your exe, .tp2, and mymod folder

 

And you're done!

Look at the weidu readme to learn how to do more stuff.


Edited by jastey, 27 June 2019 - 06:44 AM.
corrected code for ADD_CRE_ITEM


#2 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 04 February 2013 - 02:01 PM

Well, I wouldn't think only brain-dead people need a tutorial for this but I could've sworn I wrote one just like it. That was some time ago though, and is probably well-buried, so it doesn't hurt having multiple tutorials, and you are pretty much spot-on with what you need to do WeiDU-wise.


Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#3 -Guest-

-Guest-
  • Guest

Posted 13 June 2013 - 08:11 AM

I have followed these steps exactly and although it appears to run without error nothing actually happens--the item is not in the override folder. Have I somehow missed a step not listed here?

#4 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 13 June 2013 - 09:00 AM

I have followed these steps exactly and although it appears to run without error nothing actually happens--the item is not in the override folder. Have I somehow missed a step not listed here?

 

 

Well, do you have an .itm file in the "mymod" folder ? And to help with this, I suggest that you upload that and the other files in your mod too... in a .zip archive to this forum, or mediafire and give us the link.


Edited by The Imp, 13 June 2013 - 09:40 AM.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#5 -Pecca-

-Pecca-
  • Guest

Posted 11 August 2013 - 01:12 AM

Hello. Thanks for this tutorial. I have only a question about how do I create a tooltip string (like when a weapon is both melee and ranged and I want that to be shown in item abilities). Is it something like "SAY TOOLTIP"?



#6 -Saradas-

-Saradas-
  • Guest

Posted 05 September 2013 - 03:59 AM

This is very useful, thank you. I finished a mod including many new spells and scrolls and need some help. The descriptions about .itm files are very well explained, I don't understand how to correctly add .spl files though.

I want the spell file to read the description of the related scroll in the sections SAY NAME2 and SAY DESC.

 

Spell files only need those two fields of description, sharing the same .tlk strings with the scroll .itm file: name of spell, description of spell.

How can i do?

thanks



#7 Mike1072

Mike1072
  • Modder
  • 539 posts

Posted 05 September 2013 - 03:03 PM

Hello. Thanks for this tutorial. I have only a question about how do I create a tooltip string (like when a weapon is both melee and ranged and I want that to be shown in item abilities). Is it something like "SAY TOOLTIP"?
The tooltip information is not stored in the .itm file. You need to append to the file tooltip.2da.

Note: modders have written functions and macros that make this process easier (there are some issues that occur when other mods drastically alter the file), but for now I'll just explain how you would handle the basic scenario without hiding any of the details.

The format of each row in tooltip.2da is the item resource (name of item file minus the .itm extension) followed by a number of string references from dialog.tlk indicating which strings should be displayed when the appropriate item ability is hovered over (your item could have multiple melee, ranged, and/or magical abilities).

A standard throwing axe has a ranged ability and a melee ability. This is what its entry in tooltip.2da looks like:
AX1H04 15527 15529 -1
These tooltip strrefs correspond to the strings ~Thrown~ and ~Melee~. The -1 is just padding since the item only has 2 abilities.

The tricky part of appending to this file is that you need to get your tooltip strings into dialog.tlk so you can find out what numbers to use.

If you had a throwing axe item named MIAXTHR.ITM and you wanted to give it tooltips for its ranged and melee ability, you could do so like this:
OUTER_SET ability1strref = RESOLVE_STR_REF (~Super Throwing Mode~)
OUTER_SET ability2strref = RESOLVE_STR_REF (~Melee Madness~)
APPEND ~tooltip.2da~ ~MIAXTHR    %ability1strref%    %ability2strref%    -1~
The first two lines add your tooltip strings to dialog.tlk and store the strref in a variable. The third line appends to tooltip.2da, substituting in the values of the variables for the first and second column strrefs.

 
This is very useful, thank you. I finished a mod including many new spells and scrolls and need some help. The descriptions about .itm files are very well explained, I don't understand how to correctly add .spl files though.
I want the spell file to read the description of the related scroll in the sections SAY NAME2 and SAY DESC.

Spell files only need those two fields of description, sharing the same .tlk strings with the scroll .itm file: name of spell, description of spell.
How can i do?
thanks
Do it the exact same way. If the strings for the name of your spell and the name of your scroll are exactly the same, WeiDU will assign them the same string reference. If you are using a .tra file, you just need one string for the spell name and one for the spell description, then you reference both those tra references (@numbers) when you are copying over the spell and the scroll.

Here's an example from Spell Revisions. Note that the spell file needs the name and description in the unidentified fields while the scroll file needs it in the identified fields (like other magical items do).
COPY ~spell_rev/spwi3##/spwi304.spl~ ~override~ // Fireball
  SAY NAME1 @507 SAY UNIDENTIFIED_DESC @508
COPY ~spell_rev/spwi3##/scrl1g.itm~ ~override~
  SAY NAME2 @507 SAY IDENTIFIED_DESC @508
In case you're wondering, the unidentified name of the scroll was already set to ~Scroll~ in the .itm file. Because the string ~Scroll~ definitely already exists in everyone's game, it is safe to hardcode the dialog.tlk reference for it (7222) into the file.

Edited by Mike1072, 06 September 2013 - 12:58 AM.


#8 -Saradas-

-Saradas-
  • Guest

Posted 05 September 2013 - 10:03 PM

Thank you so much for the quick answer, Mike1072. Now everything is clear about this.

I can use DLTCEP fairly well but I'm still a complete noob with Weidu, so every help is very appreciated! :)

back to modding :D



#9 -Pecca-

-Pecca-
  • Guest

Posted 19 October 2013 - 12:15 AM

Thank you Mike1072. I used existing strings, but is handy to know.



#10 Alonso

Alonso
  • Member
  • 35 posts

Posted 09 May 2019 - 04:45 PM

Hi, I'm trying to use this tutorial to learn the very basics of IE modding. My question is: How do I create the custom itm file for this tutorial?



#11 jastey

jastey
  • Administrator
  • 3218 posts

Posted 09 May 2019 - 11:10 PM

Use Near Infinity (needs java).

 

Export an existing item that is similar to what you want to do.

 

Open your copy and make the changes to make it "yours". Don't bother about name and description, because that is what the mod will be for: to patch the correct name and description into the players' "dialog.tlk" where all the text lines are stored.



#12 Alonso

Alonso
  • Member
  • 35 posts

Posted 24 June 2019 - 03:46 PM

Thank you, I forgot about this when I started my first mod a few weeks ago. Now I have completed the tutorial, but it's not quite working. It installs and it copies the sword and the dragon to the override folder, but the dragon doesn't have the sword. Can you have a look?

Attached Files



#13 jastey

jastey
  • Administrator
  • 3218 posts

Posted 24 June 2019 - 09:20 PM

Did you visit the dragon for the first time after installing the mod? The item patching only works if it's a new game i.e. you didn't visit the area with the dragon in the game yet.



#14 Alonso

Alonso
  • Member
  • 35 posts

Posted 26 June 2019 - 03:54 PM

Yes, I had already visited the dragon in the saved game I was using to test. So I tried with a game in which I hadn't visited the dragon yet. However, I didn't manage to test with this game. Using the console to travel directly to the dragon's lair crashes the game. I tried travelling to the temple ruins and going to the dragon's lair from there, but that also crashes the game, I guess the game must expect you to have completed all the previous steps in the quest before.

 

Since testing with the shadow dragon proved so complicated, I tried modifying the mod and giving the sword to the otyugh in Irenicus' dungeon instead. There are three otyughs in the game, so I gave the sword to all of them because I don't know which one is Irenicus'. The result is the same, the otyugh doesn't have the sword. Checking in NI, though, the otyughs do have the sword. However, when I try to open the sword item in NI I get an error: "Error reading null", "null". I attach the modified mod.

 

Attached File  mymod.zip   956.03K   263 downloads


Edited by Alonso, 26 June 2019 - 03:56 PM.


#15 jastey

jastey
  • Administrator
  • 3218 posts

Posted 26 June 2019 - 08:59 PM

Then there is an error with the item, I am not a great help with that. The crashes probably result in that. Crashes result in e.g. animation errors of cres or items. (Crashes do not occur because there are quest steps missing.)

 

After assigning the sowrd to the otyughs, try cheating them in to check whether they have the sword.



#16 Alonso

Alonso
  • Member
  • 35 posts

Posted 27 June 2019 - 01:29 AM

Yeah, that's what I did to test: I loaded the first saved game I have, in which I still haven't moved from the first room in Irenicus dungeon, from there went to the room of the otyugh, and then I used the console to make it join my party. It didn't have the sword. NI, however, shows the sword in the otyugh's files, but with the error I mentioned.



#17 jastey

jastey
  • Administrator
  • 3218 posts

Posted 27 June 2019 - 01:32 AM

There is still the chance you didn't catch the one in Irenicus' dungeon, though. Try cheating in one of the cre files you patched.



#18 jastey

jastey
  • Administrator
  • 3218 posts

Posted 27 June 2019 - 01:34 AM

Oh, just noticed: if the otyugh is in the same area your save game is in, then patchig the cre will not change it. You need to load a save from before entering the area the patched cre is in. In this case, you need to start a new game.


Edited by jastey, 27 June 2019 - 01:34 AM.


#19 Alonso

Alonso
  • Member
  • 35 posts

Posted 27 June 2019 - 04:19 AM

Hadn't thought about that. Still, I started a new game and I had the same result, the otyugh doesn't have the sword.

 

There is still the chance you didn't catch the one in Irenicus' dungeon, though. Try cheating in one of the cre files you patched.

That's what I've done.

 

Can you try it and see if you have the same problem?



#20 jastey

jastey
  • Administrator
  • 3218 posts

Posted 27 June 2019 - 06:42 AM

Ah, looking at the cre-file, the item in its inventory is listed as "MYITEM.I.ITM" - which of course does not exist. There is an error in teh tutorial. You need to patch the items to the cre without the ".itm" ending:

 

//Part 3 (add item to an existing creature, in this case the shadow dragon, Thaxll'ssillyia)
COPY_EXISTING ~IOTYUGH.cre~ ~override/IOTYUGH.cre~
  ADD_CRE_ITEM ~myitem~ #0 #0 #0 ~NONE~ ~inv11~
COPY_EXISTING ~OTYUGH.cre~ ~override/OTYUGH.cre~
  ADD_CRE_ITEM ~myitem~ #0 #0 #0 ~NONE~ ~inv11~
COPY_EXISTING ~OTYUGH01.cre~ ~override/OTYUGH01.cre~
  ADD_CRE_ITEM ~myitem~ #0 #0 #0 ~NONE~ ~inv11~
 

I will edit the first post.

 

btw: to see which cre file the one you are looking for would be, there is two possibilities. First, you look at the BGII area list and see that Irenicus' first dungeon is the area AR0602.are. You open this area with Near Infinity, look at the actors listed, click on the "Otyugh" and see that it's "IOTYUGH.cre".

Or, in Near Infinity, you open the Search -> CRE/ITM/SOL/STO -> type in "Otyugh". For BGII:EE, you get 4 results. Open the cres in "Open in new window", then change to slider to "EDIT" and click on "FIND -> references to this file". Do the search, and it should list the occurrances of the cre file in the game.