Jump to content

Seeking Effective Ways to Mass Mod Items or Create Duplicates


Ashiel

Recommended Posts

Hey there. I've been playing Baldur's Gate for a long time and experimenting with different mods. I'm pretty new to modding the game myself but I've been reading as much about modding methods as possible, but with a few things I'm still a bit lost. I was hoping you guys might be able to point me in the right direction (if not explain exactly how to) with a little project I'm trying to work on.

 

Project Overview

I'm working on a mod primarily for BG Tutu (but also BG II) that will theoretically rebalance many of the standard items in the game and add new items into the game as well. I'm intentionally trying to start pretty small on this project and may extend to more complex things (like NPCs, spells, etc) at a later time. Right now, I'm just working on creating the correct items and then getting them into the game. Here are some of the things I'm trying to do, and some roadblocks that are holding me up.

 

Weapon Modifications

1) All bastard swords will be given a new damage range (and THAC0 penalty).

2) All two-handed swords will be given a new damage range.

3) All other swords should remain unchanged.

 

Weapon Additions

1) Introducing two-handed axes with a damage range identical to two-handed swords (2 handed, axe proficiency, halberd animations and icons).

2) Introducing war-axes with a damage range identical to bastard swords (and THAC0 penalty).

3) Introducing a number of new magic items throughout the game (mostly introducing items that are under represented in BG Tutu, such as halberds, bastard swords, axes, clubs, etc).

 

Desireable Methods of Delivery

1) I would like to be able to replace all existing items of a particular type with the new versions (so by modding bastard swords all bastard swords in the game would be affected on creatures and in shops).

2) I would like to add items to creature inventories (ideally as used equipment).

3) I would like to distribute some items throughout the game in various containers.

 

Troubles Implementing Mods

I've been reading through the Weidu Tutorial heavily, and it seems that most of what I want to do should be done through the COPY_EXISTING_REGEXP command, but I've been having some issues with this method. Firstly, I can't figure out how to make this method distinguish between longswords, bastard swords, and greatswords. Secondly, this method of course wouldn't grant each item a new description based on statistics (so while all bastard swords might deal 1d10 instead of 2d4 they would still be listed as 2d4 in the item description, which is bad). Because of this, I figured I would need to alter each item individually and accept that it wouldn't retro-fit the mod on top of other mods.

 

Would I need to create a copy for each instance of weapon I wanted to mod (such as all bastard swords, all longswords, all greatswords, etc) and then make the changes to those files in DLTC and then save them under the same file name to be added to the game that way? I imagine this would solve the issue of retroactively adjusting through the game (allowing all bastard sword wielding hobgoblins to automatically use the new items since they would share the same reference name). However, thinking about it, I realize this would only change the statistics of the item, and unless I wanted to change the strings in the Dialog.tlk (which I don't want to do) then each item would need a new dialog string reflecting their new statistics (I imagine this would be preferred to keep the originals intact after uninstalling). However, the question then becomes what is the best way to do this?.

 

This guide (http://forums.rpgdun...hp?topic=1847.0) suggests adding each dialog through WeiDU in the following manner.

COPY ~itemtut/axedeath.itm~ ~override~
 SAY NAME1 ~Axe~
 SAY UNIDENTIFIED_DESC ~This is a basic axe.~
 SAY NAME2 ~Battleaxe of Death +4~
 SAY DESC ~This axe was wielded by the dwarven hero Korgan as he journeyed along in search of making a profit.  The axe was lost when one of Korgan’s party members knocked him unconscious and ran off with the axe and all the rest of the treasure.  How the axe ended up in your possession is unknown, but you are truly wielding a legend.
STATISTICS
+4 Bonus to THAC0
-3 Charisma
+3 Strength
Inflicts 4 Fire Damage per hit
Damage:  1d8+4
Not Useable by:
 Mage
 Thief
 Cleric
 Druid~

 

Would I need to do it like this for each individual item?

 

Thank you very much for any help in advance. I'm quite new to this, and finally broke down and decided to ask when I couldn't figure it out myself or find a similar guide.

Link to comment

Theoretically, pretty much everything you want here can be done in WEIDU. But it does take a certain amount of practice. As an illustration, the (untested) code below edits all bastard swords to do 1d10 damage rather than 2d4, and updates the description appropriately (at least for languages where the abbreviation for "2 lots of 1d4" is "2d4").

 

COPY_EXISTING_REGEXP ~.*\.itm~ ~override~
  PATCH_IF (BYTE_AT 0x31)=89 BEGIN // proficiency=bastard sword
		// patch description to replace "2d4" with "1d10"
		PATCH_FOR_EACH offset IN 0x50 0x54 BEGIN
					READ_STRREF offset desc
					INNER_PATCH_SAVE desc ~%desc%~ BEGIN
							REPLACE_TEXTUALLY CASE_INSENSITIVE ~2d4~ ~1d10~
					END
					SAY_EVALUATED offset ~%desc%~
		END
           // replace actual damage
           GET_OFFSET_ARRAY ab_array ITM_V10_HEADERS
           PHP_EACH ab_array AS int=>ab_off BEGIN
                    PATCH_IF (BYTE_AT ab_off)=1 BEGIN // a melee ability
                             WRITE_SHORT 0x16+ab_off 10 // dicesize=10
                             WRITE_SHORT 0x18+ab_off 1 // dicenum=1
                    END
           END
  END
BUT_ONLY

Link to comment

Thank you very much DavidW! I really appreciate your quick and detailed response!

 

I'd like to give this a try (at the moment I've just went through the hard way and created a copy of each sword to be modded and was going to try inserting them individually instead of mass-modding), but this looks to be a superior method by far (and would be way more compatible with other mods)!

 

Would you happen to know a byte refference or how to find the appropriate bytes to detect and modify? I'm pretty new to Near Infinity (and can't yet make heads or tails of the item breakdowns in it) and I couldn't find the correct byte for weapon proficiencies (DLTC Editor Pro suggested that bastard sword proficiency was 0x59 instead of the 0x31), and it would be really helpful to know what bytes can or should be modified. ^-^"

 

Also, looking at your code box, I can see where (and how) you have it modify the text from 2d4 to 1d10, which is awesome. I assume that this modifies it without changing the original string in dialog.tlk?

 

And, if it is not too much trouble, could give me a rundown as to what your code here is doing by line, so I can make sure I understand it to its fullest?

Also, thank you again for your help!

 

PS: On a side note, I wanted to say thank you so much for Sword Coast Strategems I & II! They add so much to the game that I simply must have them on any and every install. ^-^

Link to comment

I always said these will be easiest to say with code, new_thumbs.gif DavidW.

I assume that this modifies it without changing the original string in dialog.tlk?
Just like every Weidu mod... yeah.

 

I'm pretty new to Near Infinity
Then make sure you have the most up to date one to use... link. (Nearinfinity-w1.1.0.jar, yes, it's naming is confusing)

And for more reference, here's the BG2's etc .itm file's byte distribution.

Link to comment

Oh wow, epic! Thank you, guys! I'll definitely open up my BG2 Tweaks and rummage around for some experimenting CamDawg; and thank you Jarno Mikkola for that awesome file format referrence. I didn't know such a thing was hosted on G3 (I'ma save a backup of the page in my BG modding folders). Also, I'ma check the version of NI versus the one you linked to make sure it's up to date. Again, thank you very much. ^-^

Link to comment

Would you happen to know a byte refference or how to find the appropriate bytes to detect and modify?

Use Near Infinity.

 

And, if it is not too much trouble, could give me a rundown as to what your code here is doing by line, so I can make sure I understand it to its fullest?

Also, thank you again for your help!

In fast outline, the outer IF loop checks if the weapon is a bastard sword. The next block reads in the two description strings, does a text substitution on them, and writes them back again. The GET_OFFSET_ARRAY bit reads in an associative array whose elements are the offsets of the various ability headers. The PHP_EACH bit cycles through those ability headers, and the inner part of that bit changes the dice from 2d4 to 1d10.

 

But to be honest, the only way to learn this stuff properly is to spend a big chunk of time looking at existing mods, in parallel with the WEIDU documentation, to get the hang of it, and then spend more time practicing writing code. Cam is right that BG2Tweaks is probably a good place to start. You could look at bits of SCSII as well, though the code varies from so-old-as-to-be-horribly-inefficient, through possibly-useful, through massively-automated-and-wrapped-in-functions.

Link to comment

You can find a lot of similar statistic and description updating in Item Revisions' global Weapon Changes component. I'd recommend looking at the v2 code available here, specifically the files components/weapon_changes.tpa and the accompanying lib/description_updates.tpa. It behaves like the example DavidW posted, just on a bigger scale and using slightly older code. The code is commented, but it will be easier to understand if you compare it against the description of the component in the readme.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...