How to Edit PK2 files

Here you can post guides and tutorials you have written for Silkroad Online. If submitting a guide from another forum, please post credit to the author.
User avatar
Demarthl
Advanced Member
Posts: 2296
Joined: Mon Jan 02, 2006 8:33 pm

How to Edit PK2 files

Post by Demarthl »

thanks to Pluss44 for writing this up in a pm to me, and credits to whoever he says in the following

Plus44 wrote:This is a tutorial to help you get modifying client side graphics. So you can make 1st degree clothes appear as 9th degree.

First and foremost, I'd like to say thanks to Drew_Benton who helped me learn this, and to my friend fish8 for helping me test that it works.

EDIT:
Important
The substitutions are selective and do not work with everything. Your best bet is replacing things from within the same folder.

Disclaimer: Hex editing could cause your client to crash, so always keep a backup of anything you edit.

Note: Always restore anything you edit to its original before an SRO update.

This is L16 bows appearing as 9th degree:
Image

This is my L16 character pimped out with 9 degree garments and a 9th degree bow:
Image
Image

You will need:

1. http://www.handshake.de/user/chmaas/del ... /xvi32.zip
2. http://fs06n2.sendspace.com/dl/819f397b ... actPk2.exe


Tiny background information
.PK2 files are archive and may be opened by an extractor like Clearscreen's tool.
The \res directory in the Data.pk2 archive contains models.
The \prim directory contains textures.

Weapon models are here: prim\mesh\item\china\weapon
Weapon textures are here: \prim\mtrl\item\china\weapon

Clothing models are here: prim\mesh\item\china\man_item (woman_item)
Clothing textures are here: \prim\mtrl\item\china\man_item (woman_item)

Media.pk2 contains references to the clothing and weapon models and textures and this is precisely what we have to edit

The first thing you will need to do is backup Media.pk2 in the Silkroad directory. Changes you make to this file are irreversible.

After you have noted the file names of the items you wish to modify, load up XVI32 and open Media.pk2.

Click on Search --> Replace:

Select the radio button "Text as string" and check the box that reads "as Unicode".

Key in the filename of the item you wish to replace in the first textfield and the filename of the replacement in the second textfield. Select the same options.

For example, to convert a 3rd Degree bow to a 9th Degree, do this:


Click "Replace All" and repeat for \item\china\weapon\bow_03.ddj.

This will replace all references to 3rd Degree bows with references to 9th Degrees.

After that, click File --> Save and you're done.

Clothes
The format for clothing textures and models are clothes_aa_xx.xxx where aa is the degree.

To replace 3rd Degree clothes with 9th Degree, type: \clothes_03 in the first textfield and \clothes_09 in the second.

Questions
Can I turn my weapon into an SoS/SoM/SoSUN?
- No you can't. SoS/SoM/SoSUN and any +3 +4 +5 are just shiny effects. If you have a 1st Deg SoS, you could turn it into a 9th Deg SoS as the effect is inherited.

Contributed by fish8:
- The pet/horse files are in the Data.pk2 /res/cos directory.
- You can turn grey wolves into white ones with the same technique
- Or even turn wolves into horses.
- Pre-Level40 wolves are suffixed with 01 and evolved wolves are 02.

To wet your appetite here's a 9th Degree SoM blade courtesy of fish8:
Image

Cool substitutions that work

Contributed by Rhetoric:
first box = mob\taklamakan\edimmu.bsr
second box = mob\roc\tahomet_devil.bsr


Please note. editing PK2 files is dangerous, it can cause problems with your client, and possibly intervention by GM's

I, nor Pluss44, or anyone mentioned hereafter are responsible for the things you to do your client and/or account.

edit at your own risk, and please, don't be a dumbass, back the files up!

sticky please :3
Last edited by Demarthl on Wed Feb 21, 2007 9:18 am, edited 1 time in total.
<<banned from SRF for disrespect of the mod team and rules violations. -SG>>

User avatar
XxYODAxX
Frequent Member
Posts: 1265
Joined: Thu Sep 07, 2006 8:14 pm
Quick Reply: Yes
Location: Iraq

Post by XxYODAxX »

I'm not gonna try coz i hate waiting for install and upddate if it goes wrong :D
We remember those who have paid the ultimate sacrifice for their country, for their friends and for their families. They shall live on forever in our memories.

User avatar
Demarthl
Advanced Member
Posts: 2296
Joined: Mon Jan 02, 2006 8:33 pm

Post by Demarthl »

[Plus44] wrote:can make a thread about it if u wanna, but im'a go to sleep too late and I gotta be up for work in 2 hours


IRC channel earlier.
<<banned from SRF for disrespect of the mod team and rules violations. -SG>>

User avatar
Deacon
Senior Member
Posts: 4376
Joined: Tue May 09, 2006 9:26 am
Quick Reply: Yes
Location: De Dutch

Post by Deacon »

Great tutorial for people who still didn't saw enough of the 9th degree, ill just take enough with the scrreenshots and wait till it actually comes here

But still, nice tut. Demarthl + Plus44

ps. Can u unban me @ irc xD :roll:
I cannot sing the blues...

User avatar
MiKe 51-50
Frequent Member
Posts: 1284
Joined: Sun Dec 10, 2006 8:19 pm
Quick Reply: Yes
Location: Xian

Post by MiKe 51-50 »

for the 9th degree weapons...says string not found.
Image
Image

keny_paintball
Valued Member
Posts: 479
Joined: Mon Feb 12, 2007 2:24 am

Post by keny_paintball »

For peapole who speak french can you translate it cause im ..... xD
<<banned from SRF for bot admission. -SG>>

User avatar
Demarthl
Advanced Member
Posts: 2296
Joined: Mon Jan 02, 2006 8:33 pm

Post by Demarthl »

I'm as good at french as I am at socialising.

I don't go out. ;P
<<banned from SRF for disrespect of the mod team and rules violations. -SG>>

User avatar
Cruor
Loyal Member
Posts: 1999
Joined: Wed Apr 12, 2006 1:22 am
Quick Reply: Yes
Location: Off topic

Post by Cruor »

Few inaccuracies...

The mesh (model) files are in
prim\mesh\item\china\weapon
and
prim\mesh\item\china\man_item (woman_item)

The listed locations of the mesh files are actually the locations of the mesh resource files which link the meshes, textures, and skeletons required for the item together. They also contain flags on what parts of the body to render (which is what makes a "nude" patch purely through PK2 editing possible)

You CAN turn any weapon into a SoS/SoM/SoSun, the seal text is the only thing that won't appear correctly.

Also, you can change the glow of any weapon that is already plussed to different colors as seen in my video here:
http://www.youtube.com/watch?v=UKs_HG5FeKk

I don't think there is a way to make non-plussed things glow. I have tried a few methods but none of them were successful.

User avatar
Demarthl
Advanced Member
Posts: 2296
Joined: Mon Jan 02, 2006 8:33 pm

Post by Demarthl »

if you could write up how to do the Seal glows and the plus glows I'll add it, I'm surep lenty of people will be grateful for that
<<banned from SRF for disrespect of the mod team and rules violations. -SG>>

User avatar
Cruor
Loyal Member
Posts: 1999
Joined: Wed Apr 12, 2006 1:22 am
Quick Reply: Yes
Location: Off topic

Post by Cruor »

Changing plus glows:
The plus glows are defined in a file called "itemtypenumber.txt"
It is in the resinfo directory of Media.pk2

1. Open up Media.pk2 in your hex editor and do a search in hexadecimal mode for "31 20 09 33".

2. There are sixteen lines of information in this file. The information is for +3 through +9, four times. Start out by opening resinfo\itemoption.txt and having a look at it. It uses the same syntax for item names as itemdata.txt. Look for your item in the first column. The number following it immediately is the number you want. Once you find it, move back over to your hex editor.

3. Search for "3X 20 09 3Y" in hexadecimal mode where X is the number you found earlier and Y is the plus number of the glow you have (3, 5, 7, or 9).
Example:
For ITEM_CH_SWORD_01_A (+4) you would search for "33 20 09 33"

4. Now that you have the right line, look for "option_textureXX.ddj". This is the texture overlayed over the weapon. Valid options for the number (XX) are 13, 14, and 20 with higher ones being brighter.

5. Look a bit futher and you should see two sets of comma separated three floating point numbers. These are the actual colors. The first set is one color, the second set is the second color. They are in RGB format and can go from 0.000 to 1.000. For example, a full on red glow would be "1.000,0.000,0.000" and if you wanted it to change to green you would set the second set to "0.000,1.000,0.000".

6. I haven't tested but I'm pretty sure you could get +1 and +2 to glow by editing the glow number that you searched for (Y).


Adding Seal Glows:
Seal glows are defined in "itemrare.txt" which is also in the resinfo folder of Media.pk2

1. Open up Media.pk2 in your hex editor and do a search for "raretype" in ANSI mode.

2. Next do a second search for your item in the usual format, in ANSI mode.

3. Now here is where you have to decide what seal you want it to be. If you want it to be SoSun you need to look for the "third tier" entry of your weapon. So if you originally searched for "ITEM_CH_SWORD_07_B_RARE" you need to scroll down till you see "ITEM_CH_SWORD_07_C_RARE". At this point, check your file size.

4. With that in view, go into insert mode and remove the rare so it looks like "ITEM_CH_SWORD_07_C".

5. Next go into over mode change the C to a B since you have a second tier sword.

6. Now with your cursor still where you changed the C to a B, do a hexadecimal search for "0D". Look in the left column to where it found it's result. You should see an "0A" immediately after it. Now in between those two, you need to insert ten zeroes (00 00 00 00 00) Make sure that your file size is the same as it was before.

7. Now find your weapon's entry in itemdata.txt with a Unicode search.

8. Once you find the correct entry, do another Unicode search for "18000".

9. You will see that following the 18000 there are two zeroes. Change the second one to a two.

10. Save and test.

11. If you already have a seal item and want to change its glow you simply need to swap it's tier letter with the desired one. (make sure you swap them so that both still have an entry)

---

There's some rough guides on it. If I have time I might make a nice picture tutorial on it later.

User avatar
Crumpets
Forum Legend
Posts: 7800
Joined: Mon Aug 14, 2006 4:58 pm
Quick Reply: Yes
Location:         

Post by Crumpets »

I have to add, I didn't make this tut. merely posted it here for info. Credit goes to the 0x33 team keke.
<< banned for being a constant problem. -cin >>

User avatar
Crumpets
Forum Legend
Posts: 7800
Joined: Mon Aug 14, 2006 4:58 pm
Quick Reply: Yes
Location:         

Post by Crumpets »

Cruor wrote:Few inaccuracies...

The mesh (model) files are in
prim\mesh\item\china\weapon
and
prim\mesh\item\china\man_item (woman_item)

The listed locations of the mesh files are actually the locations of the mesh resource files which link the meshes, textures, and skeletons required for the item together. They also contain flags on what parts of the body to render (which is what makes a "nude" patch purely through PK2 editing possible)

You CAN turn any weapon into a SoS/SoM/SoSun, the seal text is the only thing that won't appear correctly.

Also, you can change the glow of any weapon that is already plussed to different colors as seen in my video here:
http://www.youtube.com/watch?v=UKs_HG5FeKk

I don't think there is a way to make non-plussed things glow. I have tried a few methods but none of them were successful.



keke There are NO inaccuracies, if you follow this tut you will get w/e you want.
<< banned for being a constant problem. -cin >>

User avatar
fant1k
Casual Member
Posts: 55
Joined: Sun Feb 11, 2007 4:00 pm
Quick Reply: Yes
Location: Aege

Post by fant1k »

there is a slight possibility that altering client might get you banned but its safe until new GG or alternative soft is implemented.
Image

Joymax Corporation
Telephone : +82-2-420-8654 e-mail contact@joymax.com
Homepage : http://www.joymax.com

User avatar
nitesoulja
Common Member
Posts: 125
Joined: Fri Feb 16, 2007 6:28 pm
Quick Reply: Yes
Location: Athens

Post by nitesoulja »

just make sure u dont mod the client...or get mass banned by jmax <_<

User avatar
iGod
Veteran Member
Posts: 3728
Joined: Wed Oct 11, 2006 11:22 pm
Quick Reply: Yes
Location: Off Topic

Post by iGod »

Cruor wrote:You CAN turn any weapon into a SoS/SoM/SoSun, the seal text is the only thing that won't appear correctly.


The seal description varies on the tier of the item

1st tier ~ seal of star
2nd tier ~ seal of moon
3rd tier ~ seal of sun

But the glow is what matters anyway :P

User avatar
underK
Regular Member
Posts: 234
Joined: Wed Jul 12, 2006 12:55 pm
Quick Reply: Yes
Location: Xian

Post by underK »

hmm ive never do anything on pk2 files, and im not sure about how it works :oops:

for example, to change clothes 8 degree to 9 degree ones u need to do that?
Image

and save it?
for what u need the pk2 file extractor? i only opened the XVI32...
im not good at this things :oops:

User avatar
Crumpets
Forum Legend
Posts: 7800
Joined: Mon Aug 14, 2006 4:58 pm
Quick Reply: Yes
Location:         

Post by Crumpets »

That's 8th -> 9th garms. Do it should say changed 300+ thing's. exit out and it'll prompt to save. Do so. Then re-load sro and 8th degree garms should show as 9th.
<< banned for being a constant problem. -cin >>

User avatar
NuclearSilo
Forum God
Posts: 8834
Joined: Mon Aug 21, 2006 12:00 pm
Quick Reply: Yes
Location: Age of Wushu

Post by NuclearSilo »

Cruor wrote:Changing plus glows:
The plus glows are defined in a file called "itemtypenumber.txt"
It is in the resinfo directory of Media.pk2

1. Open up Media.pk2 in your hex editor and do a search in hexadecimal mode for "31 20 09 33".

2. There are sixteen lines of information in this file. The information is for +3 through +9, four times. Start out by opening resinfo\itemoption.txt and having a look at it. It uses the same syntax for item names as itemdata.txt. Look for your item in the first column. The number following it immediately is the number you want. Once you find it, move back over to your hex editor.

3. Search for "3X 20 09 3Y" in hexadecimal mode where X is the number you found earlier and Y is the plus number of the glow you have (3, 5, 7, or 9).
Example:
For ITEM_CH_SWORD_01_A (+4) you would search for "33 20 09 33"

4. Now that you have the right line, look for "option_textureXX.ddj". This is the texture overlayed over the weapon. Valid options for the number (XX) are 13, 14, and 20 with higher ones being brighter.

5. Look a bit futher and you should see two sets of comma separated three floating point numbers. These are the actual colors. The first set is one color, the second set is the second color. They are in RGB format and can go from 0.000 to 1.000. For example, a full on red glow would be "1.000,0.000,0.000" and if you wanted it to change to green you would set the second set to "0.000,1.000,0.000".

6. I haven't tested but I'm pretty sure you could get +1 and +2 to glow by editing the glow number that you searched for (Y).


Adding Seal Glows:
Seal glows are defined in "itemrare.txt" which is also in the resinfo folder of Media.pk2

1. Open up Media.pk2 in your hex editor and do a search for "raretype" in ANSI mode.

2. Next do a second search for your item in the usual format, in ANSI mode.

3. Now here is where you have to decide what seal you want it to be. If you want it to be SoSun you need to look for the "third tier" entry of your weapon. So if you originally searched for "ITEM_CH_SWORD_07_B_RARE" you need to scroll down till you see "ITEM_CH_SWORD_07_C_RARE". At this point, check your file size.

4. With that in view, go into insert mode and remove the rare so it looks like "ITEM_CH_SWORD_07_C".

5. Next go into over mode change the C to a B since you have a second tier sword.

6. Now with your cursor still where you changed the C to a B, do a hexadecimal search for "0D". Look in the left column to where it found it's result. You should see an "0A" immediately after it. Now in between those two, you need to insert ten zeroes (00 00 00 00 00) Make sure that your file size is the same as it was before.

7. Now find your weapon's entry in itemdata.txt with a Unicode search.

8. Once you find the correct entry, do another Unicode search for "18000".

9. You will see that following the 18000 there are two zeroes. Change the second one to a two.

10. Save and test.

11. If you already have a seal item and want to change its glow you simply need to swap it's tier letter with the desired one. (make sure you swap them so that both still have an entry)

---

There's some rough guides on it. If I have time I might make a nice picture tutorial on it later.

Thx for the info :)

According to the code written in itemtypenumber.txt, there are 4 types of glow. Therefore the maximum + u can reach is +10 with blue glow. But i wonder why in this thread, they can reach +14 :?

@Cruor: can u explain more about adding seal glow? How can u insert something without modifying the file size? I have a sword 60+3, how can i add the glow of sosun?
Playing Age of Wushu, dota IMBA

User avatar
Cruor
Loyal Member
Posts: 1999
Joined: Wed Apr 12, 2006 1:22 am
Quick Reply: Yes
Location: Off topic

Post by Cruor »

Plus44 wrote:keke There are NO inaccuracies, if you follow this tut you will get w/e you want.

Think what you want to, but I think I would know about the model files because I myself altered one in order to make it invisible for the PK2 "nude" patch. Yes you get what you want by following the tutorial, I'm just pointing out that you were calling the mesh resource files the wrong thing. I can give you the blank mesh if you want.. You can drop it in the place of any mesh and add null characters after it to cover the rest of the mesh and that mesh will no longer be visible.

NuclearSilo wrote:According to the code written in itemtypenumber.txt, there are 4 types of glow. Therefore the maximum + u can reach is +10 with blue glow. But i wonder why in this thread, they can reach +14 :?

You misunderstood me. In itemtypenumber.txt, there is information for the +3 through +9 glows four times. If you look in itemoption.txt you will see that each item has a number, one through four. This means that it uses that specific set of glow information in itemtypenumber.txt. This also means that if Joymax wanted to, they could make different weapons glow different colors at different plus levels. Regardless, when you have a plus of over 9, it still uses the +9 glow for your specific weapon. I hope that explains it a bit better.

NuclearSilo wrote:can u explain more about adding seal glow? How can u insert something without modifying the file size? I have a sword 60+3, how can i add the glow of sosun?

My tutorial is the best I can explain it for now, but I suppose I could elaborate. When you add in those ten zeroes, you are adding in nullified bytes between the carriage return and the line feed. This will make the file the same size as it was neatly and cleanly. Since they are nullified, the game thinks nothing of them and passes right over them. The reason why the file size must remain the same is very simple. Think of the PK2 file as a street. The houses are the individual files and their addresses are their offsets. If you throw an extra house in between two others, or knock one out and move the others closer (changing file size), their addresses will become mixed up, unless you tell everyone about the new address (modifying the file index). When you try to mail a house, you might mail the wrong address (when the game engine checks for something listed in the file index, it will find the wrong address).

When you change that last zero to a two, you are adding a flag to your weapon that tells the game engine to search itemrare.txt for the glow information for that weapon. Without that flag, the file won't be searched.

User avatar
broken_down
Common Member
Posts: 122
Joined: Sun Jan 07, 2007 3:34 am
Quick Reply: Yes
Location: Venus
Contact:

Post by broken_down »

For chaging weapons... I use xvi32.

I replace SN_ITEM_CH_SWORD_08_A
with SN_ITEM_CH_SWORD_09_A

and then sword_08.ddj
with sword_09.ddj

Save the file, and put it in the folder. Go to start SRO (hit start) and then after the GG box, I get ?????? error, any help?

User avatar
Cruor
Loyal Member
Posts: 1999
Joined: Wed Apr 12, 2006 1:22 am
Quick Reply: Yes
Location: Off topic

Post by Cruor »

broken_down wrote:Save the file, and put it in the folder. Go to start SRO (hit start) and then after the GG box, I get ?????? error, any help?

The only thing that comes to mind right now for me is that you might have accidentally changed the textdataname.txt file as well. That would have produced duplicate entries for a name for "SN_ITEM_CH_SWORD_09_A" so when the game sees your weapon referencing the description "SN_ITEM_CH_SWORD_09_A", it doesn't know which one to choose and crashes. That is why I prefer to edit the bytes by hand, because I know I'm not changing anything I don't want to change in the file.

User avatar
broken_down
Common Member
Posts: 122
Joined: Sun Jan 07, 2007 3:34 am
Quick Reply: Yes
Location: Venus
Contact:

Post by broken_down »

How would I make it NOT do that? When I use PK2 EXtractor, it gives me an error missing an .ocx file and I haven't gotten it to work. A quick search leads me to a site that the file is distributed with MSVB and I am in the process of DLing that now...any other tips?

P,s, You don't need to explain it like I'm a noob (you dind't, just letting you know) I know a lot about computers adn programming :) This is just frustrating me.

User avatar
Cruor
Loyal Member
Posts: 1999
Joined: Wed Apr 12, 2006 1:22 am
Quick Reply: Yes
Location: Off topic

Post by Cruor »

broken_down wrote:How would I make it NOT do that? When I use PK2 EXtractor, it gives me an error missing an .ocx file and I haven't gotten it to work. A quick search leads me to a site that the file is distributed with MSVB and I am in the process of DLing that now...any other tips?

The only way I could really recommend is to not use the replace dialog and instead make the changes by hand. You would want to do a Unicode search for the item's name then look for it's entry in itemdata.txt. Once there, you can change the two "SN_X" references, the "XX.bsr" reference, and the "XX.dds" reference.

User avatar
broken_down
Common Member
Posts: 122
Joined: Sun Jan 07, 2007 3:34 am
Quick Reply: Yes
Location: Venus
Contact:

Post by broken_down »

itemdata.txt....in one of the pk2's? I can't access them ouside of a hex editor. pk2 extract won't work and I can't use rar to open..

User avatar
Cruor
Loyal Member
Posts: 1999
Joined: Wed Apr 12, 2006 1:22 am
Quick Reply: Yes
Location: Off topic

Post by Cruor »

broken_down wrote:itemdata.txt....in one of the pk2's? I can't access them ouside of a hex editor. pk2 extract won't work and I can't use rar to open..

Yeah, that's the name encrypted in the index. What I mean is, search for your string in Unicode mode in Media.pk2. You should first come up with an instance or two of it next to names. Further down in the file however you will find it next to two "SN_X" entries, a "XX.bsr" entry, and a "XX.ddj" entry.

User avatar
broken_down
Common Member
Posts: 122
Joined: Sun Jan 07, 2007 3:34 am
Quick Reply: Yes
Location: Venus
Contact:

Post by broken_down »

the xx being the fitem name, correct? Now do I just manually overwrite each one (replace) or what?

User avatar
Cruor
Loyal Member
Posts: 1999
Joined: Wed Apr 12, 2006 1:22 am
Quick Reply: Yes
Location: Off topic

Post by Cruor »

broken_down wrote:the xx being the fitem name, correct? Now do I just manually overwrite each one (replace) or what?

Correct. I would do my replacing just over the degree/tier, and in OVR mode to preserve file size.

Krais
Active Member
Posts: 836
Joined: Mon Sep 25, 2006 6:06 pm

Post by Krais »

Thieeeeffsssss

Anyways yeah i sent that tut to plus. I got it from 0x33. i guess i can be added to the lists of people to help others with any problems? im on the forums alot also :)
<<banned from SRF for bot admission and rules violations. -SG>>

User avatar
Cruor
Loyal Member
Posts: 1999
Joined: Wed Apr 12, 2006 1:22 am
Quick Reply: Yes
Location: Off topic

Post by Cruor »

Krais wrote:Thieeeeffsssss

I don't see people using some of my more obscure mods so I think they are original. :wink:

Made this mod a while ago. Hadn't had time to show anyone it though.
http://youtube.com/watch?v=c_2A4pWB2Ag

The hits are a bit off because I swapped it with Heaven, but when I tried swapping it with Billow it was spot on. Did some captures of other spear moves with the blade but Fraps screwed them up so I scrapped it.

User avatar
maverick2104
Casual Member
Posts: 95
Joined: Thu Aug 24, 2006 12:14 am
Quick Reply: Yes
Location: Poseidon

Post by maverick2104 »

Please help, this is my problem, i cant find anything of those string

Search and Replace, is this ok?
Image


Then, replace all, and this is my result

Image

Please help
Ty
Image

Post Reply

Return to “Guides and Tutorials”