Page 3 of 4
Posted: Fri Nov 18, 2005 8:24 pm
by guru
that avatar is way to big Hendaz, use photoshop to make it smaller or remove it. Thanks.
Posted: Tue Nov 29, 2005 3:32 pm
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.
Posted: Wed Nov 30, 2005 12:54 am
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?
Posted: Wed Nov 30, 2005 1:37 pm
by Leviathan
Yes, it'd be an interesting project... Thus, we could study
DFYX's theory more "deeply"...

Posted: Wed Nov 30, 2005 6:35 pm
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
Posted: Sat Dec 03, 2005 1:54 pm
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
Posted: Sat Dec 03, 2005 3:48 pm
by Leviathan
That's a great discovery,
DF', which might become really useful for further
SWBF II mods... Thanks for helping the
GameToast community !...

(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 !...
Posted: Sat Dec 03, 2005 5:24 pm
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.
Posted: Sat Dec 03, 2005 6:07 pm
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
Posted: Sat Dec 03, 2005 7:10 pm
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.
Posted: Sat Dec 03, 2005 7:25 pm
by edapolin
Well, and if it were 5 bytes? How can i know the hex code of each number of bytes?
Posted: Sat Dec 03, 2005 7:39 pm
by edapolin
Don't bother to answer my last post, I understood now

Posted: Sat Dec 03, 2005 11:21 pm
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?
Posted: Sun Dec 04, 2005 7:46 am
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.
Posted: Sun Dec 04, 2005 8:55 am
by JAFFA
Posted: Sun Dec 04, 2005 8:59 am
by DFYX
Could you please remove the screens from here and post links instead?
Posted: Sun Dec 04, 2005 9:04 am
by JAFFA
Posted: Sun Dec 04, 2005 11:49 am
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 ?

Posted: Sun Dec 04, 2005 12:58 pm
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.
Posted: Sun Dec 04, 2005 2:18 pm
by Leviathan
Thanks for having cleared things up,
DF'... It's more understandable, now...
