Jump to content

My attempt to fix Darkvision hit a snag...


EphemeralBeing

Recommended Posts

EDIT: I've got this mostly working. I'm leaving my process here in case other people go looking for this kind of information, but if you wanted to help me out there's still a few questions I've got. They're at the new bottom of the post.

 

I want to start getting a community patch together (similar to what people do for the Elder Scrolls games), beginning with the seemingly eternal bug that makes the item property "Darkvision" entirely useless. To be honest this is the first time I've ever really worked on code (not that this involves much coding, but similar rules apply) outside of school or small hobby projects, and I'd appreciate advice or comment if I do something stupid. I wrote down the process as I was working so that if I'm going about things in completely the wrong way someone can (hopefully) say something. And, maybe it will help answer my questions.

 

As I see it, there are a two ways we can go about fixing the problem.

 

1. Attempt to fix the item property "Darkvision."

 

2. Attempt to add "Darkvision" to the list of feats that the item property "Bonus Feat" is capable of granting, and then replace all five (or whatever) instances of Darkvision that occur in the item list with the bonus feat version. Proper credit for this idea should be awarded to this guy. I never would have thought of it otherwise.

 

Personally, I'm in favour of the second option. I have no idea how to even going about the first thing, but .2da files seem to be REALLY easy to edit, and you can piece together what everything is without too much difficulty.

 

I found why certain feats aren't available as bonus feats using the item property. The feat needs to be listed in two places. One is "feats.2da", and the other "iprp_feats.2da". The former lists every feat in the game, the latter... I'm not sure what common element all those feats share EXCEPT that they are all available as bonus feats. Given that I think the name is a compressed form of "item property feats," that would make sense. I'm reasonably sure it's literally a list for the bonus feat condition.

 

At this point I extracted a copy of iprp_feats.2da from the zipped folders in Data, moved it into Override, and got myself a .2da editor off of the Vault, and filled in the correct data for the Darkvision feat per the information in "feats.2da". After that I booted up the toolset, set "AllowEditingGlobalBlueprints" to True, located the "blueprint" of the Moonstone Mask (an item I found about four hours ago, whose buggy non-Darkvision prompted this post), deleted the Darkvision property, added "Bonus Feat: Darkvision," and then realized I had no idea what to do next. The Bonus Feat was there, that seems to have worked fine. But nothing else is going the way I want it do.

 

I can't seem to save any changes that I make to the Mask. It's very weird. I tried all the options in the Item Properties menu (override, etc.), searching modules for instances of the object (which... depending on the setting either gave zero or WAY too many results), making copies of the object, and even opening up the campaign module that has Moire in it to see if I could directly edit the one in her inventory. Nothing worked. And, unfortunately, when I started just sort of poking at things, I guess I did something wrong because now there is a copy of the Moonstone Mask blueprint. It is registered as a global blueprint, has the same tag as the original mask, but has a different ResRef. Oh, and I can't delete it. I hit delete, say yes when it asks if I'm sure, and then nothing happens. So, that's strange.

 

At this point, I've run through most of the stuff I can find on Google, and I'm just out of ideas. It's time to ask for help.

 

1. How do I delete the copy of the Mask? If the answer is "reinstall the game," fine. I have the GoG version, so it takes all of twenty minutes. I just didn't want to do it unless I had to. EDIT: Solved this by deleting the .UTI files manually. I don't know why the toolset couldn't clear them, but this problem is now solved. If anyone comes across this looking for help, you can just do a search for the ResRef in your NWN2 folders and wipe them.

 

2. How do I actually save properties to items? Is that even possible? Do I have to make a new one, or something? I've tried saving the .UTI to my Override folder, but it doesn't have my Darkvision feat on it. It still has the one that does nothing. EDIT: I GOT IT WORKING. All credit to these people, who are WAY smarter than I am. Forget the stupid override plugins at the top, I'm still not sure what that's for. Just go to "blueprints" on the right side of the screen, select the item you want to edit, copy its ResRef, do your edits, and then hit "Save to file." Output to your override directory, paste the ResRef as the name of the file (it will get an extension of .UTI), then restart the toolset. Go BACK to the item you wanted to edit, and there should be two of them there. They should be identical other than the change(s) you made. For whatever reason, the version in Override will always be above the default item. If it all looks right, I'd open up a client and spawn the item. If it grants you Darkvision when you equip it, all is well.

 

3. What the crap is this? Whenever I start scanning for instances of the object, this stupid message pops up during the expansions. If I do each search individually, no message. Every module at once, and that error pops up something like 200 times. I'm not exaggerating. I have to spam-click to clear them. It's very annoying, especially when the searches provide no usable results. I assume it's some sort of... I think overflow is the term? But I don't know for certain.

 

If someone who has some experience with the toolset could help me out, I would appreciate it. I really want to get this (and hopefully a lot of the OTHER bugs) fixed. And, obviously, I'm trying to do it in a form that other people could actually USE.

 

 

EDIT: This problem is now largely resolved. Couple problems I'd still like some feedback on, though, if people are inclined to help.

 

1. I need a list of all equips that have the bugged Darkvision property on them. I know the Mask, the Encircling Sash, Cloak of the Bat, and Kistrel's cloak, but there are probably others I haven't seen. If you can give me the names of the other items, I can go ahead and fix those, too. It's actually a pretty quick process, and the way I'm doing this putting the folder into your Override directory shouldn't affect anything except these specific items. I think.

 

2. If you unequip an item that grants Darkvision while it's active, the effect persists until you enter a new area or change characters. It's very minor to my mind, but it is TECHNICALLY a "bug." I guess fixing that is my next goal, though I'm not sure where to start. I'd love some feedback here.

 

3. When I went to modify Kistrel's Cloak, it ended up as a global item rather than a module specific item. I don't personally see a problem with it, as it's unlikely to appear as random loot (if that's even possible), but I'd still like to know how to fix it. I'm not seeing anything under item properties except that it's in the "rewards" category, which is good but not exactly what I'm looking for.

Edited by EphemeralBeing
Link to comment
Share on other sites

One is "feats.2da", and the other "iprp_feats.2da". The former lists every feat in the game, the latter... I'm not sure what common element all those feats share EXCEPT that they are all available as bonus feats. Given that I think the name is a compressed form of "item property feats," that would make sense. I'm reasonably sure it's literally a list for the bonus feat condition.

 

Yes, specifically it's for the properties that appear as options for adding to items, when you edit a blueprint.

 

For saving UTIs, the best way that I know of is to create a module in directory mode, do a full save including your item, and then copying the UTI out of the module folder into wherever you want it, like the override folder.

 

I don't know about the error box, but I don't use that "scan for instances" option. It looks like it's complaining about a tileset 2DA, though. Anything related to that in your override or something? This happens every time even after restarting the toolset, I assume?

Link to comment
Share on other sites

For saving UTIs, the best way that I know of is to create a module in directory mode, do a full save including your item, and then copying the UTI out of the module folder into wherever you want it, like the override folder.

 

Okay, my way is slightly faster than that. It probably has limited applications, but it works perfectly for what I wanted to do. I may not know WHY, exactly, but "working" is good enough for now.

 

I don't know about the error box, but I don't use that "scan for instances" option. It looks like it's complaining about a tileset 2DA, though. Anything related to that in your override or something? This happens every time even after restarting the toolset, I assume?

 

My Override folder is basically empty. I have a Lore fix for the Archives, a thing to update Deekin's dialog and shop in Act 2, Lance's HP bars, my Darkvision fixes, the HD loading screens you packaged (nice work, by the way), and xUI. Nothing to do with tile sets, as far as I'm aware. I'm just not going to touch that button, I think. I'm not even sure what it does. But to answer your other question, yes. It occurs any time I do the scan.

Edited by EphemeralBeing
Link to comment
Share on other sites

Okay, I thought you were still having trouble with the changes not appearing on the blueprints you saved.

 

I don't know the other Darkvision items, personally, since I don't tend to use that ability unless I don't have a torch, a light-emitting item, or the ability to cast the light spell.

 

You should be able to right-click on that global cloak and choose something like "move to module resource" or words to that effect. In any case, it won't end up in random loot unless you or some other modder specifically add it to one of the loot generation methods, because it's not there in the vanilla loot drops. It solely exists as a quest reward for being nice to Kistrel.

 

To remove an active Darkvision, there may be other ways, but you could edit the global module unequip event script and check for the item property of the unequipped item, and remove that specific effect if it's there, or you could create tag-based unequip scripts just for those items.

Link to comment
Share on other sites

 

I don't know the other Darkvision items, personally, since I don't tend to use that ability unless I don't have a torch, a light-emitting item, or the ability to cast the light spell.

Oh, really? I always considered the lack of Darkvision the only flaw with the human race. I've picked a race with stat penalties to things I want in order to get Darkvision. It's so nice.

 

You should be able to right-click on that global cloak and choose something like "move to module resource" or words to that effect. In any case, it won't end up in random loot unless you or some other modder specifically add it to one of the loot generation methods, because it's not there in the vanilla loot drops. It solely exists as a quest reward for being nice to Kistrel.

 

Okay, I'll look for that. I didn't see it before, but it might be there. I would need the right module (in this case 2100 - Crosswood Keep Act 2) open to do that, right?

 

 

To remove an active Darkvision, there may be other ways, but you could edit the global module unequip event script and check for the item property of the unequipped item, and remove that specific effect if it's there, or you could create tag-based unequip scripts just for those items.

 

Can you expand a bit on what you mean by "tag-based unequip scripts?" Is that something I would assign to the items themselves? Where else would I put it? I'm up for writing the code, but the biggest hurdle I'm facing is the sheer volume of files, 3/4 of which have names which you have to puzzle out and 90% of which lack documentation.

Link to comment
Share on other sites

Yes, for my personal taste it's still too dim and it seems to wash out the colours somewhat.

 

I'll explain tag-based scripts first, since it sounds like you don't know of them. The standard module event scripts have lines of code that attempt to execute any special individual scripts for items, if the scripts exist ("items" being defined as game objects that appear in inventories, and in some cases can be worn or wielded). These scripts are for you to create. Events include On Acquire, On Unacquire, On Equip, On Unequip, On Activate, and some others. So you write a script containing whatever you want to happen in the event of that item being unequipped, and all you have to do is use the special naming convention for tag-based scripting, and the module event script will find it and execute it. For an item whose tag is "kistrelcloak", for example, the On Unequip script should be called i_kistrelcloak_ue. Since it only fires that script when the event fires for that item, you can just put what you want to happen in it.

 

As for the module scripts, what I said was the procedure to save a script into a module, but that isn't what you want to do if you're making a fix for others to use. Fixes should include and change as little as necessary for the fix to work. You don't want to have to include the module in your fix, and in almost all cases you won't have to. Instead your fixes should work from the override, or the campaign folder, and an item blueprint is one of those times. You may need to use a script to recreate the item from its blueprint if it has already been placed into an inventory or on the ground, but Kistrel's Cloak is probably generated when she awards it to you, and would use whatever blueprint has top priority (such as what's in the campaign or override folders). The campaign folder has higher priority that the module, and the override folder has higher priority than the campaign folder.

Link to comment
Share on other sites

I'll explain tag-based scripts first, since it sounds like you don't know of them. The standard module event scripts have lines of code that attempt to execute any special individual scripts for items, if the scripts exist ("items" being defined as game objects that appear in inventories, and in some cases can be worn or wielded). These scripts are for you to create. Events include On Acquire, On Unacquire, On Equip, On Unequip, On Activate, and some others. So you write a script containing whatever you want to happen in the event of that item being unequipped, and all you have to do is use the special naming convention for tag-based scripting, and the module event script will find it and execute it. For an item whose tag is "kistrelcloak", for example, the On Unequip script should be called i_kistrelcloak_ue. Since it only fires that script when the event fires for that item, you can just put what you want to happen in it.

 

Oh... Okay, I've seen that before, I just didn't know the term. Some were included in one of these packages of "fixes" that I downloaded, and actually written to fix Darkvision. The scripts themselves were broken, though, and I didn't even really understand them. Now that you've explained it, I see what he was doing. Rather than going about adding Darkvision to the list of feats you can award through the item property, he wrote an "on equip" script that granted it, and an "on unequip" script that removed Darkvision if your race/class didn't grant it. It's a route I didn't consider taking. Funny enough, I'm pretty sure it would actually have the exact same flaw that my fix does.

 

I now understand enough to fix them, but I don't think that it will actually correct the problem I was having. The feat is properly removed from your character sheet when you unequip (for example, because it's the equip I'm currently using) the Moonstone Mask. It's just the Darkvision hue that remains. And, my version doesn't strip Darkvision from characters whose races/classes grant it to them (something that this version of the "fix" had to do manually exempt races/classes from, meaning any custom races would lose Darkvision on unequip). I may be biased, but I think this is a fairly good first run at the problem.

 

I still want to fix the hue, though. Darkvision is technically in a different category than the other "combat mode" feats, despite being in the same location on your GUI, which means that I can't just use the same script that toggles Power Attack or Flurry of Blows on/off every round. I'm looking at feats.2da again, but from the documentation I can't see an easy way to make it refresh/check every round other than making modifications to the feat itself. Which... well, like you said the goal is to change as little as possible. I'm going to keep mulling on the problem, see if I can come up with a solution.

Link to comment
Share on other sites

I now understand enough to fix them, but I don't think that it will actually correct the problem I was having. The feat is properly removed from your character sheet when you unequip (for example, because it's the equip I'm currently using) the Moonstone Mask. It's just the Darkvision hue that remains. And, my version doesn't strip Darkvision from characters whose races/classes grant it to them (something that this version of the "fix" had to do manually exempt races/classes from, meaning any custom races would lose Darkvision on unequip). I may be biased, but I think this is a fairly good first run at the problem.

 

You say the "hue" is still there, and the feat is removed, but does that mean it's still lighting up the darkness, or the light has returned to normal, but there's still a blueness to it? Perhaps you can get rid of the effect on the player with the RemoveSpecificEffect function, using one of the constants here. Possibly darkvision is what's listed as "Ultravision" in the constant list.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...