Adding Pauldrons/Packs Tutorial V1.0

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
Nedarb7
Lieutenant General
Lieutenant General
Posts: 676
Joined: Sat Sep 22, 2012 3:41 pm

Adding Pauldrons/Packs Tutorial V1.0

Post by Nedarb7 »

A while ago I couldn't find a tutorial of how to add a pauldron to an ordinary trooper so I wrote this tutorial.
It doesn't have perfect results and also might be hard to understand.
I will write a version 1.1 that will be easier to understand but this works until then.
Also when I say 04 for the transparency (which ends up leaving a strange triangle on the pauldron)
write 05 instead which will work perfectly.

Adding Packs to ep3trooper Tut v1.0
Requirements: BF2modtools Gimp/Paint.net Battlefront2 Hex Editor BFviewer (recommended)
Hello, have you ever tried making a mod. Yes, no? Well if you did your guys probably ended up really cool. Even though they were cool you wanted them to have packs (that thing commanders wear on their necks in the clone wars) to make them look cooler but you never knew how. So this leads us to the tutorial to add this accessory onto our trooper.
PART#1: Getting started
Hidden/Spoiler:
Yes! The tutorial begins. So to start off we will want our trooper head on to BF2modtools/assets/rep/msh, and copy “rep_inf_ep3trooper, msh, msh.option, _low1.msh, _low1.msh.option, TGA, and TGA.option.” and paste them on to your desktop. Also copy “imp_inf_shocktrooper.msh” and “imp_inf_trooper_pack, TGA and TGA.option” and paste them onto your desktop. Now you might be wondering why you needed to copy the shocktrooper not the arctrooper (they both have packs) well I did this because I still haven’t figured out how to add the arctrooper’s pack. Now we are ready to start.
PART#2: Attaching the pack
Hidden/Spoiler:
Okay open our new “imp_inf_shocktrooper.msh” with your hex editor and search the words “gear” once you’ve done that you scroll up a bit to find the word “MODL” now hold shift from the M of MODL until you reach the next MODL or, if there is no more MODLs, to the end. Once you have it all highlighted red (you can release the shift button) press ctrl+C. Now make a new file and press ctrl+V this will paste it in. Scroll down to the bottom and get the “Adr. Dec” number (don’t forget it). After you finish that scroll back to the top and search the word “PRNT” after that word you will see in this case “DummyRoot” this tells us were we must place the pack. Finally open up our copy of “rep_inf_ep3trooper” with your hex editor and search the word “DummyRoot” until you it says “string not found”. Now you must select the M of the MODL above “DummyRoot” and press ctrl+V to paste it into our trooper. Don’t celebrate we still have lots to do. Now we must resize the HEDR and MSH2. Scroll back to the top and select the symbol after the R of HEDR and click tools/data inspector.
Now that this is open we see the “longint” number we must do this to encode it:
Longint + Pack’s Adr. Dec + 1
Now click tools/encode number and type in our new number. You also have to click “longint (4-bit)” and “Overwrite at current adress”. Now press ok.
It’s time for the MSH2 select the symbol after the 2 and click tools/data inspector.
Now that this is open we see the “longint” number we must do this to encode it:
Longint + Pack’s Adr. Dec + 2
Now click tools/encode number and type in our new number. You also have to click “longint (4-bit)” and “Overwrite at current adress”. Now press ok and save. And you’re done adding the pack!
PART#3: Adding texture to the pack
Hidden/Spoiler:
Now if you looked at your trooper with BFviewer you probably realized that it was an ep3 trooper with white shocktrooper gear on him that’s actually what you want. The reason for this is that the shocktrooper gear has no texture so we have to add it. Open up our ep3trooper.msh with your hex editor and search the word “GMATL” now select the M of GMATL and highlighted red (remember how? Hold the shift button and use the down arrow key) until you reach the first “MODL” then press ctrl+X. Now save. Open a new hex editor and press ctrl+V to paste it in. Select the last symbol and get its Adr. Dec number in this case 243. Now open up our copied “imp_inf_shocktrooper” with your hex editor and search the words “imp_inf_trooper_pack.tga” once you’ve got it select the M of the MATD above it and highlight it until the first MODL then press ctrl+C. Open up our removed MATL and select the last symbol. Now click edit/insert string/hex string and type in 00 then click ok. After your done that select our new string at the end and press ctrl+C now we’ve inserted the texture but we still must resize the MATL so go down and get the new Adr. Dec number. After that scroll back up and select the symbol after the L of MATL and click tools/encode number. Then to encode type in our new Adr. Dec – 7 and click “longint (4-bit)” and “Overwrite at current adress”. Now press ok. I know this a repetitive process but it is necessary. Once your done select the 5th symbol after the L of MATL on the left you should see the numbers “02” now click edit/overwrite string/hex string and change it to 03 because we added one MATD then click ok.
Ready? Highlight the whole thing copy it (ctrl+C) and paste it (ctrl+V) on the M of GMODL you should find this near the top. And again we must resize the HEDR and MSH2 (You should get how this whole thing works by now) select the symbol after the R of HEDR and click tools/data inspector.
Now that this is open we see the “longint” number we must do this to encode it:
(Longint) + (Our new MATL’s Adr. Dec + 1) – (Our old MATL’s Adr. Dec 243 + 1)
Now click tools/encode number and type in our new number. You also have to click “longint (4-bit)” and “Overwrite at current adress”. Now press ok.
Now for the MSH2 select the symbol after the 2 of MSH2 and click tools/data inspector.
Now that this is open we see the “longint” number we must do this to encode it:
(Longint) + (Our new MATL’s Adr. Dec + 2) – (Our old MATL’s Adr. Dec 243 + 2)
Now click tools/encode number and type in our new number. You also have to click “longint (4-bit)” and “Overwrite at current adress”. Now press ok.
Finally you save rep_inf_ep3trooper .msh!
PART#4 Finishing up (If you’re ok with the results you can skip to part#5)
Hidden/Spoiler:
Once again you checked BFviewer and there were some things you didn’t want such as: A socktrooper backpack and ammo packs. Also if you realized there was a part of the clone trooper’s armor that was coming through the pack.
Let’s fix this open up rep_inf_ep3trooper.msh with hex editor (again) and search for “imp_inf_trooper_pack.tga” above it you should see the word “HBATRB” starting from the first symbol after the last B of HBATRB we see 04 00 00 00 00 change the 5th digit by selecting it and clicking edit/overwrite string/hex string and change it to 05 then click ok and save (You can close after saving).
After messing with the .msh you might be thinking “What was that for?” well it actually enabled transparency but we still need to edit the .tga of course. So talking about the .tga file lets open up imp_inf_trooper_pack with Gimp/paint.net/Photoshop whatever you have and add an alpha channel. To add an alpha channel you must do this: click “edit/add alpha channel” that simple. Now that we have an alpha channel we will use the select tool and cut out around the pack. That’s all we need to do for the pack.
Now let’s fix the armor coming through the pack. Open up rep_inf_ep3trooper.tga and color around the clone trooper’s neck with a dark gray. When you do this you might want to constantly check our rep_inf_ep3trooper.msh with BFviewer so you don’t accidently overdo it.
PART#5 Placing the trooper back into the MSH file
Hidden/Spoiler:
It’s time to celebrate! You’ve finished “rep_inf_ep3trooper.msh. There’s only one thing standing in your way... The MSH folder! Do not put our trooper back into the MSH folder yet we don’t want to replace it.
This part is really simple first rename ALL our “rep_inf_ep3trooper” files to something like this “rep_inf_ourtrooper” that was just an example but keep the .tga files with the same amount of letters or we will have to mess with the MATL again.
Now open “rep_inf_ourtrooper.msh” with your hex editor and highlight the words “ep3trooper” of “rep_inf_ep3trooper.tga” after you highlight it select the “e” of our highlighted “ep3trooper” then click edit/overwrite string/text string and type in “ourtrooper” because we changed the name of the .tga from “rep_inf_ep3trooper.tga” to “rep_inf_ourtrooper .tga” then click ok and save.
We are finally ready to put him back into the MSH folder. Open up BF2modtools/assets/sides/rep/msh and place all the “rep_inf_ourtrooper” files including both the “imp_inf_trooper_pack” files into the MSH folder. Congratulations you finished just change the ODF of the trooper you want to have the pack!
Last edited by Nedarb7 on Sat Oct 06, 2012 3:32 pm, edited 1 time in total.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Adding Pauldrons/Packs Tutorial V1.0

Post by Marth8880 »

Would you mind re-exporting (lol) as a Rich Text Document? Thanks. :) I have Microsoft Office 2007, I just haven't gotten around to installing it.
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3285
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: Adding Pauldrons/Packs Tutorial V1.0

Post by AceMastermind »

It's cool if you feel the need to release another tutorial on hex editing MODL chunks, but I don't see a need to release it as a download when you could just paste it into your reply. Download links tend to break and using proprietary text formats like docx makes it difficult for some to see what it is, although you can upload it to Google Docs and view it there.

Similar tutorials linked from the FAQ: MshEdit by biohazard supposedly does this stuff without the need for hex editing.
SWBF_MSH_INFO by tirpider can open a msh and export out a MODL chunk without you having to touch a hex editor.




I think more often than not, folks get confused about the use of terms like 'longint' and 'encoding' in existing tutorials, this makes things sound more complex than it actually is. You can use any hex editor to insert MODL chunks, when you change a chunk header length you're just adding bytes to keep from corrupting the msh file. You have an existing msh with a certain number of bytes and you have a MODL chunk with a certain number of bytes, you insert the MODL chunk bytes then modify any chunk headers affected by the additional bytes, it's simple.


Msh chunk headers are always 8 bytes consisting of the name(4 bytes) and length(4 bytes) in the SWBF msh format, but length values are read right to left. The headers work like this, for example cor1_bldg_garden.msh:
48 45 44 52 28 3B 00 00 4D 53 48 32 18 3B 00 00 = HEDR(;..MSH2.;..

HEDR(;..

(;.. = 28 3B 00 00

read as:
3B 28 (not 28 3B)

3B28 in decimal is 15144, therefore 15144 bytes

If you start at the 'M' of the MSH2 header and goto 3B28 in the file it would take you to the end of the file which is the length HEDR covers.

Total file size is 3B30, in decimal it is 15152, therefore 15152 bytes

15152 - 15144 = 8
8 is the remainder that represents HEDR(;.. which occupies the first 8 bytes of the file.




The same is true for MSH2:
MSH2.;..

.;.. = 18 3B 00 00

read as:
3B 18 (not 18 3B)

3B18 in decimal is 15128, therefore 15128 bytes

If you start at the 'S' at SINF and goto 3B18, it will take you to the byte before the 'C' at CL1L.... at the end of the file, that is the length MSH2 covers.

total size minus MSH2 size equals 24 bytes which is the exact size of HEDR and MSH2 occupying the first 16 bytes of the file and CL1L occupying the last 8 bytes of the file.
15152 - 15128 = 24


Any hex editor in combination with Windows calculator set to Scientific can get this done easily.
User avatar
Nedarb7
Lieutenant General
Lieutenant General
Posts: 676
Joined: Sat Sep 22, 2012 3:41 pm

Re: Adding Pauldrons/Packs Tutorial V1.0

Post by Nedarb7 »

Yeah I wasn't thinking when I put for download now that I look back I see how pointless
it was to do so. I'll edit it so you can just read it instead of downloading.
Thanks for pointing that out.
Post Reply