Jump to content

compatibility question and advice for noob modder


subtledoctor

Recommended Posts

Hi all. Love this mod, it's really really great work. I have a question.

 

I like to tweak things on my own in NI after installing all of my mods. In particular, I go into every single magic item, and change the item name to eliminate the "+1s" and "+3s" etc. I find the pluses to be immersion-breaking. (Yes, immersion breaking, in an isometric top-down tactical combat RPG.) As I bought BG:EE and I want to play on my iPad now, faced with the task of doing yet another tedious re-install, I'd like to WeiDU-ize the process. Maybe even release it.

 

My very basic understanding of WeiDU, from reading a couple tutorials, is that to patch dialog.tlk strings related to an item, you have to copy a whole new .itm file over with a new 'SAY' command for that string. (Unless you just overwrite the string itself, which is bad.)

 

So it seems to me that if I want this to be compatible with IR, I would use some kind of IF block to check for the presence of IR, and then copy over copies of the affected IR items with the new SAY commands. Which means, logically, that I would be bundling IR assets with my mod. Which seems wrong to me, even if it only installs them when it already finds IR previously installed.

 

Am I being overly sensitive? Is there a more efficient way to get to this result?

Link to comment

COPY_EXISTING can be used to apply patches to a file already existing in the game. You don't need to bundle any item files to achieve what you want.

 

This can be written up very easily as a tweak to apply to all weapons.

 

COPY_EXISTING_REGEXP GLOB ~.+\.itm~ ~override~
 PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
READ_SHORT 0x1c type
PATCH_IF (type >= 0x0f && type <= 0x1e) BEGIN // item is weapon
  READ_STRREF 0x0c name // read identified name
  INNER_PATCH_SAVE name2 ~%name%~ BEGIN // modify name
	// remove enchantment designations like +1
	REPLACE_TEXTUALLY ~[ %TAB%]*\+[ %TAB%]*[0-9]+~ ~~
  END
  SAY_EVALUATED 0x0c ~%name2%~ // write modified name
END
 END
 BUT_ONLY

 

This does the expected:

Short Sword +1 -----> Short Sword

Staff of the Ram +4 -----> Staff of the Ram

 

But you may or may not want to do some cleanup on others (vanilla weapon names):

Battle Axe +3, Stonefire -----> Battle Axe, Stonefire

Battle Axe +3, Frostreaver -----> Battle Axe, Frostreaver

Club +3, Blackblood -----> Club, Blackblood

Bone Club +2, +3 vs. Undead -----> Bone Club, vs. Undead

Club +2, Gnasher -----> Club, Gnasher

Dagger +2, Longtooth -----> Dagger, Longtooth

Dagger +4, Life-Stealer -----> Dagger, Life-Stealer

Halberd +2, Duskblade -----> Halberd, Duskblade

Halberd +4: Wave -----> Halberd: Wave

War Hammer +1,+4 vs. Giantkin -----> War Hammer, vs. Giantkin

Sling +3 : 'Arla's Dragonbane' -----> Sling : 'Arla's Dragonbane'

Spear +3, Backbiter -----> Spear, Backbiter

Spear +3, Impaler -----> Spear, Impaler

Spear +1, Halcyon -----> Spear, Halcyon

Bastard Sword +1, +3 vs. Shapeshifters -----> Bastard Sword, vs. Shapeshifters

Scimitar +2, Rashad's Talon -----> Scimitar, Rashad's Talon

Link to comment

Ooooooooh... very interesting. Generic magic items would have to be handled - I'd have to go in and change the +1's to something like "High Quality Short Sword" (though that one would already be "Masterwork" if applied after BG2 Tweaks - or is it IR that makes that change?) and change the +2's and +3's to "Enchanted Short Sword." Then just handle the few stragglers like the bastard sword vs. shapeshifters or the war hammer vs. giantkin. (Most of the ones up there are actually kind of okay the way they are!)

 

That's a huge time-saver, thank you. And good to understand copy_existing. I still need to wrap my head around WeiDU's scripting style, and all the offsets.

Link to comment
Generic magic items would have to be handled - I'd have to go in and change the +1's to something like "High Quality Short Sword" (though that one would already be "Masterwork" if applied after BG2 Tweaks - or is it IR that makes that change?) and change the +2's and +3's to "Enchanted Short Sword."

Yeah, you could check to see if the name currently is "(Short Sword|Spear|Two-Handed Sword|etc) +1" or "+2" before modifying if you want it to name those differently. Keep in mind the normal description of +1 items will still say +1 and mention magic unless you modify that as well. IR and SCS both have tweaks that allow you to make certain generic +1 weapons non-magical. In IR's case, it makes them Masterwork, and in SCS's case, it makes them of Fine quality. In that case, you probably wouldn't need to change their names.

 

I still need to wrap my head around WeiDU's scripting style, and all the offsets.

When I write this sort of code, I always have an IESDP page open to the file type I'm modifying (ITM here) that I can use as a reference.

 

I think the biggest thing to "get" about WeiDU TP2 scripting if you're coming from a programming background is the difference between actions and patches. A lot of commands have 2 different versions to accommodate their use in each context. This partially explains why a lot of the commands HAVE_UNNECESSARILY_LONG_NAMES.

e.g.

COPY_EXISTING_REGEXP ~.+\.itm~ ~override~
PATCH_PRINT ~Hi!~

versus

COPY_EXISTING_REGEXP ~.+\.itm~ ~override~
PRINT ~Hi!~

Both of these code snippets will copy every .itm file to the override. However, the former will print "Hi!" a million times while doing so and the latter will print "Hi!" just once after it's done copying files.

Link to comment

Unfortunately I have more to learn, because I don't come from a programming background. The entirety of my programming experience is with Applescript - most recently this OS X WeiDU launcher

http://forum.baldursgate.com/discussion/17717/tool-easy-mod-installer-for-os-x

 

(Oh and I once setup a website using Apache and Blosxom.) Anyway for me the long names for commands are therefore a good thing!

Link to comment

Archived

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

×
×
  • Create New...