Linking strings and icons to inventory items

+
Linking strings and icons to inventory items

I'm looking to create some new items with unique icons and names. I know how to set up strings and icons and I know where these resources are stored, but I can't figure out how to link them to my created items. I'm not much of a programmer, but (after skimming a ton of scripts) I gather that these resources are called by the UI from various arrays and .xml files.

So, right now I've got my items set up in def_item_ files and they appear to work in certain instances as blank items. Any idea how I get the UI to recognize and assign them icons and descriptions?
 
As for book icons for example: from an intuitive understanding they should be referenced in the item entrries in def_item_books.xml.

So dandelion'sbookofpoetry_64x64.dds (the icon name)

should be found somewhere in
<item name="Dandelion's Book of Poetry"
...
</item>

But obviously is not. So you might search the name of the dds in all files to be found in \data folder (brute force method).

I also had the idea that it's just the item name expanded by "_64x64.dds"
But that's doesn't seem to be true, either.

So our lifetime goes by...:D
 
Last edited:
I appreciate your thoughts on the matter. I was beginning to think I was the only one having trouble with this.

As far as I can tell, the def_item_*.xml files define the parameters of an item (i.e. whether it's a consumable, armor, boots, etc.) and assigns it properties and stats. Like you said, one would think these files would also reference the string numbers and icon names. Alas, this info is stored someplace else.

From looking at how the inventory scripts operate, the script gets the <item name> parameter for a given item, then calls up the string and icon from an array. Where is this array? I have no clue. I've searched just about everywhere I can think to search, so maybe it's in a packed resource somewhere.

I haven't given up, but I'm delaying my search. In the mean time, I'm going to get my mod ready the only way I know how and it's probably going to get messy... :p
 
Holy sh*t! I figured it out! All it took was a bottle of red wine and some Vintersorg tunes, apparently. I doubt anyone's as excited about this as I am...

Anyway, it's a bit of a process. I'd gladly outline how to create your own items with unique names and icons without having to overwrite any original resources. That is, if anyone's interested.


*EDIT*

The proof, plus a little retexture I've been working on :)

 
Last edited:
Anyway, it's a bit of a process.
Why speaking "in riddles"? It's just
theHud.PreloadIcon( "img://globals/gui/icons/items/" + StrReplaceAll(itemName, " ", "") + "_64x64.dds" );

Means as I guessed, they use the item name for referencing the icon.

What would help: to workout how StrReplaceAll() works exactly. Iirc it changes strings in some way,
replacing blanks with underscores or something like that.
 
Last edited:
Why speaking "in riddles"? It's just
theHud.PreloadIcon( "img://globals/gui/icons/items/" + StrReplaceAll(itemName, " ", "") + "_64x64.dds" );

Means as I guessed, they use the item name for referencing the icon.

Well, when you put it that way, I'm not so excited anymore... I guess you already know how it works. :p

I wasn't trying to be vague. I was just saying that if someone wanted to create new items for his/her game, it requires a lot of flip-flopping between REDkit and GIbbed's RED Tools, plus a lot of manual editing. For someone like you, I'm sure it would be easy, since you seem to know a lot about how the scripts and files work.

What would help: to workout how StrReplaceAll() works exactly. Iirc it changes strings in some way,
replacing blanks with underscores or something like that. .

This is simple. It removes all blanks, underscores, capitalization, and other characters. You have to set it up in a .w2strings file first, though. Here's an example of referencing a new item via strings:

Code:
<?xml version="1.0" encoding="utf-8"?>
<strings version="201  encryption_key="1133990201"">

  <keys>

	<key id="My New Item">100000</key>
	
  </keys>
  <texts>
  
	<text id="100000">My New Item Text</text>
	
  </texts>
</strings>

So, the <key id> is what the script will reference for the icon path. In this case, it would look for */globals/gui/icons/items/mynewitem_64x64.dds.
 
[...]I was just saying that if someone wanted to create new items for his/her game, it requires a lot of flip-flopping between REDkit and GIbbed's RED Tools, plus a lot of manual editing.
ok, I wasn't aware of this.

since you seem to know a lot about how the scripts and files work.
Not more than any sub average coder would get from the scripts, I guess.
The REDkit is so powerful but it lacks in a decent desciption as soon as you want to create own meshes, armors (and items as we know now).
But the REDkit was primary intended to create own worlds from the existing assets, that's what I'm sure of.

Here's an example of referencing a new item via strings:
thx.

btw, atm most users here are waiting for a REDkit patch, I guess. That's the reason why I've stopped my investigations on things that might be possible with the next version.
(though something is whispering to me that such features like "new icons" won't be covered by it.)

Atm I'm working on flash (swf). If the upgraded REDkit won't cover this (what I'm sure of) that would be an interesting "modding area", too
 
Not more than any sub average coder would get from the scripts, I guess.

I'm a sub-average coder, as well. Scripts have never been my thing and I avoid them like the plague whenever I can. I'd much prefer to create non-scripted workarounds that use the existing game architecture. I can code when I really want to accomplish something and there's no other way, but it's a grueling endeavor.

But the REDkit was primary intended to create own worlds from the existing assets, that's what I'm sure of.

Absolutely. In fact, to get most of my resources to export, I had to trick the cooker into thinking my files were something else. I've also figured out a way to increase mod compatibility all around, without having to compile someone else's resources into your own. Manual file editing is required, though, and I'm not even sure how many people are modding right now, as you say.

btw, atm most users here are waiting for a REDkit patch, I guess. That's the reason why I've stopped my investigations on things that might be possible with the next version.
(though something is whispering to me that such features like "new icons" won't be covered by it.)

See, to me, this is the most fun time to mod -- you learn the most about a game when you have insufficient tools and just enough knowledge to realize that it's possible to make a certain modification if you can only figure out how to implement it. Maybe I'm weird that way, but I enjoy a challenge. Not to mention, when it becomes very easy for others to make the same mods, they probably will make the SAME mod, and I'll miss out on doing it myself. :)

Atm I'm working on flash (swf). If the upgraded REDkit won't cover this (what I'm sure of) that would be an interesting "modding area", too

Working on a new UI? You don't have to elaborate if you want to keep your idea under wraps for now, but I can say that it would be very cool to see a pared down, sleeker UI. Don't get me wrong, the existing UI is great, but anything can be improved, imo.

Oh, and I'd be happy to share any of my source files you might want to get a look at. I'd link them via PM, though, since things are in a profound state of un-completion.
 
IAbsolutely. In fact, to get most of my resources to export, I had to trick the cooker into thinking my files were something else.
Sounds interesting, Could you give an example?

Working on a new UI?
Nope, I'm more a tweaker than a modder. And it's required to understand the flash thingie first. When I'm done (in 2 or 3 months or so)
tweaking of the hud (and the inventory for example) should be possible (hopefully).

Oh, and I'd be happy to share any of my source files[,,,]
Thx - I'll keep that in mind. But I'm very busy with "the flash", animation tuts and other.
I'm just here to share thoughts from time to time...
 
Sounds interesting, Could you give an example?

Well, if you bake a blank map that contains no new resources, you'll noticed that the .dzip created by the cooker still has some files in it. Unpack that .dzaip with Gibbed's RED Tools and you'll be able see that there are a number of files of different types. If you have a resource that you need to bake, but the cooker in this version won't do it (like a .w2ent), you can just go into the asset browser, rename and copy your resource as one of the files that gets baked by default. This way, the cooker still thinks it's a base, generic file and will bake it just the same as it did before. Unpack the .dzip, rename your file back to what it was, and repack. I've found no flaws with this method.


Thx - I'll keep that in mind. But I'm very busy with "the flash", animation tuts and other.
I'm just here to share thoughts from time to time...

No worries. I didn't mean, "Would you look over my work, please?" :p But if there's anything I've done and you want to see how I did it, the source is yours.

The Flash stuff is the next area I plan to delve into -- just to see how it works. I'll leave the breaking to you. The UI appears to be much more involved, integrated, and powerful than, say, the UI in Skyrim. I'd like to get an idea of just what it's capable of.
 
If you have a resource that you need to bake, but the cooker in this version won't do it (like a .w2ent), you can just go into the asset browser, rename and copy your resource as one of the files that gets baked by default.
Speaking of a self created model (means combined of existing heads, armors etc.)?

All I know is that there is a difference between meshes in \data folder and the ones in pack0.dzip:
http://forums.cdprojektred.com/threads/603-Mesh-replacement-a-query?p=3570&viewfull=1#post3570

Using such an unpacked w2mesh file (and having it referenced in a npc template (w2ent) for example)) could be the cause of the "non baking".

But before digging deeper into this it would make sense to wait for the new REDkit version.
 
Speaking of a self created model (means combined of existing heads, armors etc.)?

Yeah. You'll notice that even if the cooker bakes them into your pack0.dzip, the .w2ent files are separate from the .w2mesh files. The game won't read them unless the meshes are baked directly into the .w2ents.

All I know is that there is a difference between meshes in \data folder and the ones in pack0.dzip:

I noticed this too. I think it's actually a discrepancy in the .w2ent import script for Blender. It triangulates the polygons when the originals are quads. That's my best guess, anyway.

Using such an unpacked w2mesh file (and having it referenced in a npc template (w2ent) for example)) could be the cause of the "non baking".

That's exactly what it is. I'm working with new item templates, but the premise remains the same for new NPCs, or any .w2ent that contains a mesh. Again, if the mesh isn't baked into the .w2ent template, the game won't process the mesh. It will still recognize the .w2ent, but all you'll see in-game is a null object. That's why my cooking "trick" is helpful -- it allows the meshes to be baked into the templates.

I'm sure this issue will be fixed when the next patch arrives. But for now, this is a working option and I intend to take advantage of it. After all, who knows when the patch will be released? Besides, I want to mod right now, lol. ;)
 
Did you try this on a house for example?

Do you mean an area layer? Like a .w2l file? The premise is the same, so I don't see why it wouldn't work. If you loaded an interior from one of the existing levels in the game, made some changes, then baked it back to override the original (making sure the file name and path are the same), you should be able to modify the default environments in the game.

You should still be able to use the existing Nav paths, unless you're making some major overhauls to the interior. Alternately, I've figured out a way (it's a very long process) to edit the original levels in REDkit. Basically, what you have to do is open a new world, create all the groups and layer names (using the original exported data as a reference), then, once you've saved your world, replace the blank layers you created with the ones extracted by Gibbed's RED Tools.

I've had like a 50% success rate with this method. The "paths" layer presents some problems, but if you use this method to import ALL the areas and layers before you import the "paths" layer, I don't see why it wouldn't work.

So far, I've only imported portions of existing levels. For instance, I grabbed the Elven baths from an unpacked resource just to see if I could do it.
 
Do you mean an area layer? Like a .w2l file?
yep. Used a w2l in the linked post.

Alternately, I've figured out a way (it's a very long process) to edit the original levels in REDkit. Basically, what you have to do is open a new world, create all the groups and layer names (using the original exported data as a reference), then, once you've saved your world, replace the blank layers you created with the ones extracted by Gibbed's RED Tools.
I tried such a method some months ago. Iirc there was a problem with the tile 00xx00x.w2l files. So I was tired wasting my time...

Anyway if the REDkit update won't come within 6..8 weeks I'll try to "import" a new house to the original game.

And thanks again for your descriptions. (I think there were some guys like Asmodean or nacepar who used similar methods but
the "how tos" were kept secret.)
 
I tried such a method some months ago. Iirc there was a problem with the tile 00xx00x.w2l files. So I was tired wasting my time...

Yeah, I'm sure CDPR didn't intend for us to be doing this type of editing with the current version of REDkit. As such, the program gets very finicky (likes to crash, etc.) when attempting to edit existing levels, but it can be done.

And thanks again for your descriptions. (I think there were some guys like Asmodean or nacepar who used similar methods but
the "how tos" were kept secret.)

No prob. Happy to help.

I've never believed in keeping these kinds of things secret. You won't get famous by openly sharing your methods (already found that out), but if more people know how to make mods, the more (and better) mods they should make, right? I abandoned the Nexus sites for related reasons.

I helped out with a few very popular mods and got absolutely no credit. I can live with not getting credit. I really don't care what my internet handle is attached to. However, I can't live with others actively keeping techniques I openly shared with them a secret to everyone else. Doesn't make sense to me. Well, it does, but I don't like it.

Anyway, sorry for the b*tch session. :rolleyes:
 
You won't get famous by openly sharing your methods (already found that out),
Well, it's a long way to get "famous". Concerning modding of RPGs I found at least two people being really famous, imho. This being NicoDE and Baltram.
But these two guys never seemed to have interest in being "famous".
And what is even more: they always shared all of their knowledges.

I helped out with a few very popular mods and got absolutely no credit.
So chose your friends wisely.:D

btw: I understand your way of thinking. I was thinking so, too, a long time. But nowadays my focus is on improving my knowledge. Not care about whether others are crediting me or not.
 
You're right. On the whole, most of the other modders I've worked with have been great. There were only a couple of exceptions and I shouldn't let those color my opinion of others. In certain circles, modding becomes a popularity contest of sorts. I'm happy to say I'm done with that these days :)

I'm not concerned with recognition anymore. Maybe at one time I might have been, but that was long ago. I just want to make the most enjoyable mods possible and, like you, learn as much as I can along the way.

I also have to thank you for sharing as much information as you have and for working to help figure some of these things out.
 
Top Bottom