Jump to content

Using weidu vs. NI: which and when?


ericp07

Recommended Posts

(NI loves to corrupt files, eventually making them unusable in some cases).
If you can reproduce this, report it with the steps to reproduce on the NI forum on PPG (as devSin requested). I know it happens because I've seen it in other mods (and have heard other modders report it). But I don't know how to reproduce it, because I don't use NI to edit such files, mainly for that very reason.

 

The only time you might want to patch your own .itm files with WeiDU during install is if, for example, a mod like Ashes of Embers is installed that alters the weapon system. That is fairly easy though (I think I've coded this for the weapons in Aurora and Thrown Hammers).

 

I do use that mod (and ~149 others). I don't know what, if any, aspects of my custom scimitar would be changed, and can't think of anything about the item that should be changed by any mod.

 

As for NI, I have version 1.32. It's been behaving well recently, but my suspicion is that, if I open and save my files with it too many times, eventually they'll become corrupt, as they have in the past (I've had to rebuild files from scratch several times now). I'll pay closer attention from now on when using it, and if anything needs reporting, I'll be able to run through my actions.

 

So, at this point, I'll forget about modifying my files with WeiDU further than what's already in my .tp2.

 

Thanks,

Eric

Link to comment

To be sure, there's known issues with adding abilities and effects to these resources (items and spells). It's fairly easy to corrupt an item by adding an effect, but this should, in general, be the only instance of common corruption.

 

Note that you can use WeiDU to construct your item's abilities (even though you're going to be copying it over), while using NI safely to modify existing attributes and effects (NI should never corrupt something that you merely change, unless you change offsets or counts or other silliness; corruption is always a result of getting something wrong when trying to add these particular structures).

Link to comment
To be sure, there's known issues with adding abilities and effects to these resources (items and spells). It's fairly easy to corrupt an item by adding an effect, but this should, in general, be the only instance of common corruption.

 

Note that you can use WeiDU to construct your item's abilities (even though you're going to be copying it over), while using NI safely to modify existing attributes and effects (NI should never corrupt something that you merely change, unless you change offsets or counts or other silliness; corruption is always a result of getting something wrong when trying to add these particular structures).

 

If memory serves, adding effects was what corrupted some of my files before; in one case, NI couldn't even open the file after I'd closed it. This was during times when I was confused between item abilities and effects. I also recall some of these files ending up with lines at the bottom of the edit screen that said "unusued bytes". I didn't understand how that happened, but suspected it was a bad thing. It remains to be seen if all my files will now install and function as they should in-game, as I'm working on getting my .tp2 straightened out, so I can install and test the mod.

 

Thanks,

Eric

Link to comment
I do use that mod (and ~149 others). I don't know what, if any, aspects of my custom scimitar would be changed, and can't think of anything about the item that should be changed by any mod.
Ashes of Embers, like I said, changes the weapon usability system. Basically instead of class- or kit-based usability flags, it uses stat requirements instead. If it's your character's own custom item that no one else can use, it might not be an issue.
To be sure, there's known issues with adding abilities and effects to these resources (items and spells). It's fairly easy to corrupt an item by adding an effect, but this should, in general, be the only instance of common corruption.
Adding attached effects is a fairly common task in BG2 resource editing. Can't this be fixed, or do you still not know exactly what's causing it?
Link to comment
I do use that mod (and ~149 others). I don't know what, if any, aspects of my custom scimitar would be changed, and can't think of anything about the item that should be changed by any mod.
Ashes of Embers, like I said, changes the weapon usability system. Basically instead of class- or kit-based usability flags, it uses stat requirements instead. If it's your character's own custom item that no one else can use, it might not be an issue.
To be sure, there's known issues with adding abilities and effects to these resources (items and spells). It's fairly easy to corrupt an item by adding an effect, but this should, in general, be the only instance of common corruption.
Adding attached effects is a fairly common task in BG2 resource editing. Can't this be fixed, or do you still not know exactly what's causing it?

 

The corruption issue does not apply to any file I currently have, so I'll put that aside unless/until it happens again.

 

Anyone can pick up the scimitar, and anyone not prohibited from using all scimitars may use it. I haven't placed any restrictions on the item (unusable by).

 

Thanks,

Eric

Link to comment
Adding attached effects is a fairly common task in BG2 resource editing. Can't this be fixed, or do you still not know exactly what's causing it?
It could be fixed, sure. I personally never really looked at it since I don't use NI for editing (anyone interested can start in AbstractStruct).

 

There was a major issue where new effects were being added to the head of the resource, which I fixed, and another place where there looked to be behavior I assume was unintended so I changed, but I never went further than that.

 

Unused bytes (holes) happens when offsets and counts don't cover a complete file (say if you had an ability that said it only had 3 effects, but there were four effects in the file, we'd note that there was that section of bytes that wasn't "claimed" by any of the meta-structures). This is the most common form of "corruption," since it's rather common for people to not update their offsets or counts correctly (also, for some of the structures we don't account for, like PC overlays in PST saves (in this case, since I hadn't yet deciphered the structure), we just leave them to be picked up automatically as holes in the list).

Link to comment
anyone not prohibited from using all scimitars may use it
And this is just the thing I've been saying - AoE changes this so even a mage could use the scimitar with the right strength requirement (or dex, or whatever it is). If you want your weapons to be compatible with AoE, you'll have to account for this, which takes a whole 5 lines of code or so (obtuse code to be sure, but as I said you can copy it from the mods I mentioned). Or you can require AoE be installed after your mod, which isn't a good idea (it's an older mod that I believe still overwrites some things, so should be installed early). Or you can not give a rat's arse about compatibility with other mods - a lot of modders don't.
Unused bytes (holes) happens when offsets and counts don't cover a complete file (say if you had an ability that said it only had 3 effects, but there were four effects in the file, we'd note that there was that section of bytes that wasn't "claimed" by any of the meta-structures).
I suppose NI or Java aren't smart enough to update the counts/offsets automatically on file save or something? Or maybe no one wants to mess with the code. I guess you could use ADD_ITEM_EFFECT or whatever with WeiDU at install time, but that's got to be a bit of a pain (though perhaps easier than adding them with NI or even DLTCEP).
Link to comment
anyone not prohibited from using all scimitars may use it
And this is just the thing I've been saying - AoE changes this so even a mage could use the scimitar with the right strength requirement (or dex, or whatever it is). If you want your weapons to be compatible with AoE, you'll have to account for this, which takes a whole 5 lines of code or so (obtuse code to be sure, but as I said you can copy it from the mods I mentioned). Or you can require AoE be installed after your mod, which isn't a good idea (it's an older mod that I believe still overwrites some things, so should be installed early). Or you can not give a rat's arse about compatibility with other mods - a lot of modders don't.

[snip]

 

I'd much rather play a game where any character can attempt to use any weapon, training or no, and incur penalties for unfamiliarity, than play one in which certain characters are prevented from equipping the weapon, even if they don't know how to use it properly. As for install order, I follow BWP instructions 100%. My mod is probably simple enough that the only requirement is that it be installed during the same segment in the install process as most other joinable NPC mods. I do care about compatibility, though; I don't want the mod to be unusable due to conflicts with any other mod.

 

Thanks,

Eric

Link to comment
I don't want the mod to be unusable due to conflicts with any other mod.
I don't know if it'd be "unusable" for that reason alone, though it might have its usability impaired somewhat.

 

I guess I actually have to spell out the code for you, eh? :)

DEFINE_PATCH_FUNCTION ~t-embers~ BEGIN
 READ_BYTE 0x1e usab1
 READ_BYTE 0x1f usab2
 READ_BYTE 0x20 usab3
 READ_BYTE 0x21 usab4
 READ_BYTE 0x29 ukit1
 READ_BYTE 0x2b ukit2
 READ_BYTE 0x2d ukit3
 READ_BYTE 0x2f ukit4
 WRITE_BYTE 0x1e (usab1 BAND 0b00111111) //Alignments
 WRITE_BYTE 0x1f (usab2 BAND 0b00000000)
 WRITE_BYTE 0x20 (usab3 BAND 0b10000000) //Elf
 WRITE_BYTE 0x21 (usab4 BAND 0b10011111) //Other races
 WRITE_BYTE 0x29 (ukit1 BAND 0b00000000)
 READ_BYTE 0x31 wp //Proficiency
 PATCH_IF wp < 0x66 BEGIN
WRITE_BYTE 0x2b (ukit2 BAND 0b00000010) //Beastmaster
 END ELSE BEGIN
WRITE_BYTE 0x2b (ukit2 BAND 0b00000000)
 END
 WRITE_BYTE 0x2d (ukit3 BAND 0b00000000)
 WRITE_BYTE 0x2f (ukit4 BAND 0b00000000)
END

COPY ~yourmod/item/youritem.itm~ ~override~
 SAY NAME1 #11052 //Scimitar
 SAY NAME2 ~Your Scimitar~
 SAY UNIDENTIFIED_DESC #22712 //Generic scimitar description
 SAY DESC ~Your identified description~
 PATCH_IF MOD_IS_INSTALLED ~setup-ashesofembers.tp2~ 0 BEGIN
LAUNCH_PATCH_FUNCTION ~t-embers~ END
WRITE_BYTE 0x26 9 //Minimum strength
WRITE_BYTE 0x2c 9 //Minimum dexterity
 END

Like I said, 5 extra lines in your item COPY block. Well I didn't include the 20+ lines for the function, but that is reusable in any weapon you copy if you want to allow AoE rules - just put it once near the beginning of your tp2. You just need to write the attribute requirements for the weapon type (which are buried in the AoE tp2).

Link to comment
I don't want the mod to be unusable due to conflicts with any other mod.
I don't know if it'd be "unusable" for that reason alone, though it might have its usability impaired somewhat.

 

I guess I actually have to spell out the code for you, eh? :D

DEFINE_PATCH_FUNCTION ~t-embers~ BEGIN
 READ_BYTE 0x1e usab1
 READ_BYTE 0x1f usab2
 READ_BYTE 0x20 usab3
 READ_BYTE 0x21 usab4
 READ_BYTE 0x29 ukit1
 READ_BYTE 0x2b ukit2
 READ_BYTE 0x2d ukit3
 READ_BYTE 0x2f ukit4
 WRITE_BYTE 0x1e (usab1 BAND 0b00111111) //Alignments
 WRITE_BYTE 0x1f (usab2 BAND 0b00000000)
 WRITE_BYTE 0x20 (usab3 BAND 0b10000000) //Elf
 WRITE_BYTE 0x21 (usab4 BAND 0b10011111) //Other races
 WRITE_BYTE 0x29 (ukit1 BAND 0b00000000)
 READ_BYTE 0x31 wp //Proficiency
 PATCH_IF wp < 0x66 BEGIN
WRITE_BYTE 0x2b (ukit2 BAND 0b00000010) //Beastmaster
 END ELSE BEGIN
WRITE_BYTE 0x2b (ukit2 BAND 0b00000000)
 END
 WRITE_BYTE 0x2d (ukit3 BAND 0b00000000)
 WRITE_BYTE 0x2f (ukit4 BAND 0b00000000)
END

COPY ~yourmod/item/youritem.itm~ ~override~
 SAY NAME1 #11052 //Scimitar
 SAY NAME2 ~Your Scimitar~
 SAY UNIDENTIFIED_DESC #22712 //Generic scimitar description
 SAY DESC ~Your identified description~
 PATCH_IF MOD_IS_INSTALLED ~setup-ashesofembers.tp2~ 0 BEGIN
LAUNCH_PATCH_FUNCTION ~t-embers~ END
WRITE_BYTE 0x26 9 //Minimum strength
WRITE_BYTE 0x2c 9 //Minimum dexterity
 END

Like I said, 5 extra lines in your item COPY block. Well I didn't include the 20+ lines for the function, but that is reusable in any weapon you copy if you want to allow AoE rules - just put it once near the beginning of your tp2. You just need to write the attribute requirements for the weapon type (which are buried in the AoE tp2).

 

Now you're frightening me! :) What is the most likely consequence of not including such code, and installing my mod into an AoE-included installation? It makes no difference to me who can or can't wield the scimitar, but it's meant to be Meleryn's (my mod NPC) primary weapon. What the player decides to do is his or her perogative, but ideally, Meleryn will wield her scimitar in her main hand at all times (I will not force that issue, though). Essential to her character concept is that she fight with a scimitar in one hand, and a battle axe in the other.

 

So...dare I further jeopardize my poor .tp2 by adding any or all of the above code?

 

Thanks,

Eric

Link to comment

Frankly, I think you worry way too much about this. Nobody's going to give any damn if your mod has a tiny incomp with AoE, and should by a twist of fate it happen nonetheless, then someone would simply give a chunk of code to include - like Miloch has just done.

Link to comment
Frankly, I think you worry way too much about this. Nobody's going to give any damn if your mod has a tiny incomp with AoE, and should by a twist of fate it happen nonetheless, then someone would simply give a chunk of code to include - like Miloch has just done.

 

Only in that I worry too much about everything :) Testing will help me determine if I should do anything at all. Meanwhile, I'll focus on my current .tp2 concerns.

 

Thanks,

Eric

(These are the things that happen when you spend too much time at home while ill)

Link to comment
Only in that I worry too much about everything
Yeah, well that's bad for finishing mods, and probably bad for your health.

 

(Or did I speak too soon? :))

(These are the things that happen when you spend too much time at home while ill)
You need to decide whether you want to give a dog's bollock about mod compatibility (even minor cases like this) or not. If the former (which you've already implied) then include the code. Trust me, 25 lines is nothing (take a look at Infinity Animations or Level 1 NPCs if you really want to get scared). And unless I typoed something (fairly common but fixable) its impact will be minimal to none.

 

I myself didn't bother or even think about this until someone (probably some German dude working on the BWP) pointed it out to me. Putting in an easy code snippet spares the same "worry" happening to you, and spares you from wondering what to do about it. But it's a minor concern anyhow - the major concern should be finishing your mod's actual content (which I reckon in your case involves mostly dialogue-writing).

 

If you're just wondering what the code does, that's different. It does nothing unless AoE is installed, in which case it uses AoE rules while installing the weapon. It clears the class/kit unusability flags (except mandated stuff like beastmasters can't use metal weapons) and sets attribute requirements instead.

Link to comment

OK, compatibility it is. I've placed the longer section of code (defining the patch function) first thing in my .tp2 (immediately after BEGIN ~Meleryn Gwaithoron for SoA/ToB~) and then inserted the item coding in each of the three scimitar versions' code blocks. Also moved all item COPY blocks so that the items install before the joinable npc's copying and naming section. I'll find out if the mod will install with this new arrangement, and report the resulting error message(s) here again.

 

Heh, yeah, the vast majority of content I still need to generate is the dialogue. I've got bits here and there, but the best I can do right now is fill in some placeholder text in places where I have no actual lines written, to test in-game behavior before writing more meaningful stuff. I'm fighting the thought of casting about for someone to help write dialogue, because something tells me it would be best if I write Meleryn's words myself, then maybe ask for help with the villains' villainy speech.

 

Thanks,

Eric

Link to comment
I suppose NI or Java aren't smart enough to update the counts/offsets automatically on file save or something?
That's not it at all. This is very much a user error (either bad WeiDU code or some outdated editor or whatever). I was simply explaining it slightly since he brought it up.

 

If you add (or remove) something, the counts and offsets are updated automatically. But in the case of abilities or effects, we sometimes can't figure out where to put it, and it all goes downhill from there.

Link to comment

Archived

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

×
×
  • Create New...