Play Mos Eisley Assault with different levels

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

User avatar
guru
Jawa Admin
Jawa Admin
Posts: 2390
Joined: Thu Oct 14, 2004 8:45 pm
Projects :: swbf 1 vanilla
Games I'm Playing :: any mobile rpg

Post by guru »

that avatar is way to big Hendaz, use photoshop to make it smaller or remove it. Thanks.
DFYX

Post by DFYX »

If you want to replace all_hero_luke_jedi then the item has to be less than or equal in size to the space provided.
Wrong. There IS a way to use longer strings, but it's not as easy as the normal method. I just played around a little and noticed that .lvl files consist of blocks like xml files. The blocks have the following format

Code: Select all

4 bytes type - 4 bytes length - content - some 00 bytes
There are a few types I found by now:

Code: Select all

ufcb: 4 times 00 at the end (This is the 'root' block that surrounds everything)
lvl_: 4 00 bytes
scr_: 4 00 bytes
NAME: ? 00 bytes (Found with 0 and 2 bytes)
DATA: 3 00 bytes
SCOP: 4 00 bytes
The length includes the 4 bytes it uses but neither the type nor the 00 bytes. So the length is the length of the content + 4. Notice that all lengths are 4 byte integers and stored in the order, windows uses them. So if you see CC 21 13 00 (Which is btw. the length of mission.lvl's ucfb block) the real value is 0x001321CC.

OK, fine... so all you have to do is to increase the length bytes of all blocks of the 'branch* your string is in, including the string subblock (which seems to be a little different from the other blocks since it has only a one byte type 0x04 and the 00 byte at the end is included in the length). I haven't successfully done that yet, but it SHOULD work. I guess, I just haven't found all blocks.

P.S.: Please don't blame me if anything is wrong or if there is already a document like mine. That's only what I found out in half an hour.
CloneCommanderAlpha512

Post by CloneCommanderAlpha512 »

I know this can be done with a hex editor but for us inexperienced users, could a downloadable mod for this possibly be put up on the site?
Leviathan
Missing Jedi Admin
Posts: 3277
Joined: Fri Nov 12, 2004 2:54 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by Leviathan »

Yes, it'd be an interesting project... Thus, we could study DFYX's theory more "deeply"... :?
kajong

Post by kajong »

I made an observation about the files... when i corrupted the file, it changed sizes. I was editing the MISSION file and it changed from 1,225 KB to 1,240 KB. I think this hads something to do with hexing the file
DFYX

Post by DFYX »

Ladies and gentlemen! DFYX proudly presents cloakedanakin on Corouscant!

I finally found out which block sizes to increase. For the rep hero on Corouscant (Conquest) they are:

Code: Select all

 OFFSET  TYPE
0x000004 ufcb
0x0187D8 lvl_
0x0187E8 scr_
0x018810 BODY
0x0192C5 The name string
Screenshot 1
Screenshot 2
mission.lvl
Leviathan
Missing Jedi Admin
Posts: 3277
Joined: Fri Nov 12, 2004 2:54 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by Leviathan »

That's a great discovery, DF', which might become really useful for further SWBF II mods... Thanks for helping the GameToast community !... :wink: (And for having released your source file.)

By the way, would it be possible to release a (small) tutorial, where you'd explain us how you did that mod, please ? Thanks in advance !...
DFYX

Post by DFYX »

Well, I did nothing special. Changed rep_hero_macewindu with rep_hero_cloakedanakin and increased the 5 integers I mentioned by 4 (since the new string consists of 4 bytes more than the old one).

The integers are really easy to find. The first one is at the beginning of the file just after "ufcb". To find the 2nd to 4th integer just search for the last lvl_ before the unit you want to edit. They're very close to each other, just after the block types. The last one consists of the 4 bytes just before the string. Just remember that in windows files, the lowest byte (the one with the 1-bit to 128-bit of the integer) is usually the first and the highest byte is the last. So that's NOT the order you would write them down.
edapolin

Post by edapolin »

This is too difficult to undestand.... I do this with a Hex Editor or with Lua or something else?? :? On the first "integer", just after "ufcb", I can only se this: CC 21 13 00 6D 63 66 67 D4 19 00 00 4E 41 4D 45 04 00 .... Can you do a tutorial, step by step :?:

Thanks
DFYX

Post by DFYX »

You should do this with a hex editor. Don't know how Lua works, maybe you could use it, too.

An integer is a number that consists of 4 bytes. Sry that I didn't explain, but I'm a programmer and so it's quite normal to call a 4-byte number an integer. To increase the first integer by 4, replace CC 21 13 00 (= 0x001321CC in normal notation = 1253836 as decimal number) with D0 21 13 00.
edapolin

Post by edapolin »

Well, and if it were 5 bytes? How can i know the hex code of each number of bytes?
edapolin

Post by edapolin »

Don't bother to answer my last post, I understood now :wink:
kajong

Post by kajong »

since im not a programer (only know basic parts of BASIC) and im not an experienced modder so explain this in the simplest way possible. (i lost you somewhere around the first thing you said) I'll read through it a few more times but im still confused :?

Also how do you know how to convert those integers into decimal numbers?
DFYX

Post by DFYX »

OK, I see... I should start with the basics... the problem is that I'm German so it's quite hard for me to explain things like that in English in a way a newbie understands.

Converting hex numbers to decimal numbers is easy. Just open the windows calculator and change it's display mode in the view menu. Then there will be some more buttons. On the top left you can switch the mode between hex, dec, oct and bin. Switch the mode to hex, type in your hex number (Don't forget to invert the byte order) and switch to dec. Now you'll see the number as a decimal number.
JAFFA

Post by JAFFA »

Oh My GOD. I just tried changing tat\tat2.lvl.....tat2_tdm to:

spa\spa3.lvl......spa3_ctf (Space Kashyyyk)

I dont know if anyone has tried this, but it had some FREAKY EFFECTS!

This may take a while to load (there are 10 screenies) but it appears that there are NO starfighters, NO turret seats, and most surprising, NO ROOMS IN THE HEROES SHIP! (ie. no engine, shield, or life support room, but the main room with the turret seats still exists.)

Have a look:

Image

Image

Image

Image

Image


Image

Image

Image

Image

Image
DFYX

Post by DFYX »

Could you please remove the screens from here and post links instead?
Leviathan
Missing Jedi Admin
Posts: 3277
Joined: Fri Nov 12, 2004 2:54 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by Leviathan »

So, DF', you must add the number of additional characters required to replace an existing unit (For sample, 2 additional letters, to replace "imp_hero_bobafett" by "imp_hero_darthvader") to the "integer" value ? Or can you enhance this value with the number you want ? :|
DFYX

Post by DFYX »

Jaffa, I didn't ask because I can't see them but because it's not good to post large pics directly in a thread.

Leviathan, the integer must contain the exact length of the block it belongs to. So if you increase the string length by 2, you have to increase all the integers by 2. Of course you can add more bytes to the string and null them out, but then you have to increase the integers by the number of bytes you added INCLUDING the 00s.
Leviathan
Missing Jedi Admin
Posts: 3277
Joined: Fri Nov 12, 2004 2:54 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by Leviathan »

Thanks for having cleared things up, DF'... It's more understandable, now... :wink:
Post Reply