• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Changing DescriptionKey for a vanilla item to a different one through a xpath?

Morksel

Refugee
Hello, I am currently editing a mod for my server and I wanted to give a Sniper Perk Book vol. 6 a new description so it can reflect the edits that I made. But for some reason I cannot get it to change no matter what I do. Does anybody know if this can be done? If it can be done could you tell me how, or help me with it?

Bit more information:

- What I'm trying to do is change a description for a vanila Sniper Perk Book, not directly in a game localization.txt but through mod's items.xml using xpath. I know that xpath cannot interact with localization.txt file, so I've tried every possible way I could have found on here and elsewhere to change value of property DescriptionKey to one that will lead to a new description.

- last line I tried (so you know what I'm doing if my explanation is not good):
 

<set xpath="/items/item[@name='bookSniperAPAmmo']/property[@name='DescriptionKey' and @value='perkSniperAPAmmoLongDesc']/@value">bookSniperNEWAPAmmoLongDesc</set>
This line provided no change to an item's description, neither did: 
 

<set xpath="/items/item[@name='bookSniperAPAmmo']/property[@name='DescriptionKey']/@value">bookSniperNEWAPAmmoLongDesc</set>


I'm kinda at my wits end, so if anybody could help I would be very very grateful ☺️

 
That second line looks okay to me. And you do have a proper localization.txt file in your mod with bookSniperNEWAPAmmoLongDesc defined in it?

Really though, you could just have a modlet with just a localization.txt file that has perkSniperAPAmmoLongDesc defined in it, with your new description, as any mod with vanilla entries in localization will override the vanilla entry if there is an exact match.

 
That second line looks okay to me. And you do have a proper localization.txt file in your mod with bookSniperNEWAPAmmoLongDesc defined in it?


Yes yes, I do.

Really though, you could just have a modlet with just a localization.txt file that has perkSniperAPAmmoLongDesc defined in it, with your new description, as any mod with vanilla entries in localization will override the vanilla entry if there is an exact match.


Hmm, I didn't know that. I will try it and report back. Thank you!

EDIT: It worked! Thank you so so much! Now if only I knew this before it would have saved me hours of searching and reading. I guess it wasn't for waste as I learned more about how modding works.

 
Last edited by a moderator:
Well, just out of curiosity I tried that second line and it worked fine. So your issue was likely with your localization.txt file. People usually mess up the header so that might be the issue.


I'm really not sure why it didn't work, as I even have a line in progression.xml
 

<set xpath="/progression/perks/perk[@name='perkSniperAPAmmo']/@long_desc_key">perkSniperNEWAPAmmoLongDesc</set>


that works fine and does what I want - it changes the description of a Perk in a Skill Menu. Also, every other description that is in that localization.txt works fine. Making a new modlet did work, but I'll test around more and see if I can reproduce your result. I do have a question: What would be the prefered way of doing this? What you suggested or what I tried to do?

EDIT: Okay, I figured out why it wasn't working, I put the line in <append xpath="/items"> instead of outside... Talk about a beginner's mistake 😥

 
Last edited by a moderator:
I'm really not sure why it didn't work, as I even have a line in progression.xml
 

that works fine and does what I want - it changes the description of a Perk in a Skill Menu. Also, every other description that is in that localization.txt works fine. Making a new modlet did work, but I'll test around more and see if I can reproduce your result. I do have a question: What would be the prefered way of doing this? What you suggested or what I tried to do?

EDIT: Okay, I figured out why it wasn't working, I put the line in <append xpath="/items"> instead of outside... Talk about a beginner's mistake 😥
Haha. We've all been there before. 

 
Back
Top