Star Wars Battlefront II PC Spawn

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

thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Re: Star Wars Battlefront II PC Spawn

Post by thelegend »

JoshuaTedder
Private
Posts: 35
Joined: Wed Oct 28, 2015 5:37 pm
Projects :: Different random projects.
Games I'm Playing :: Battlefront II
xbox live or psn: No gamertag set

Re: Star Wars Battlefront II PC Spawn

Post by JoshuaTedder »

Thank you!

Edit: Does anybody know the different capabilities of this tool and the BFBuilder?
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: Star Wars Battlefront II PC Spawn

Post by Marth8880 »

BFBuilder can only be used (with full compatibility) for SWBF1, and the other only with SWBF2.
JoshuaTedder
Private
Posts: 35
Joined: Wed Oct 28, 2015 5:37 pm
Projects :: Different random projects.
Games I'm Playing :: Battlefront II
xbox live or psn: No gamertag set

Re: Star Wars Battlefront II PC Spawn

Post by JoshuaTedder »

Marth8880 wrote:BFBuilder can only be used (with full compatibility) for SWBF1, and the other only with SWBF2.
Thanks for the clarification! I was wondering because they seemed to do basically the same things when I researched them except one was more powerful than the other (from what I could tell).
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3285
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: Star Wars Battlefront II PC Spawn

Post by AceMastermind »

The command post ODFs in data_ABC\Common\odfs are already compiled into the game's ingame.lvl by default.
To change this property value will require a custom ingame.lvl or by moving the CP files to your world's asset folders.

If you're looking for SwitchClassRadius in a lvl file, the hash is:
19 B1 C9 4B
and the radius value in meters follows that:
19 B1 C9 4B 35 2E 30 00
the above 8 byte hex represents this:
SwitchClassRadius = "5.0"

I don't know what the maximum value you can have here is though.
JoshuaTedder
Private
Posts: 35
Joined: Wed Oct 28, 2015 5:37 pm
Projects :: Different random projects.
Games I'm Playing :: Battlefront II
xbox live or psn: No gamertag set

Re: Star Wars Battlefront II PC Spawn

Post by JoshuaTedder »

Thanks, it worked! I used your first method and searched for "19 B1 C9 4B" in the "ingame.lvl" file. I found three instances, "com_bldg_controlzone", "com_bldg_controlzone_CTF", and "com_bldg_untakeable_controlzone". I wasn't sure what each of these stood for, except the CTF one (but I was pretty sure the "com_bldg_controlzone" is for normal Conquest), so I replaced the value for the "SwitchClassRadius" property to 999 for all of them just in case. This method worked! Thanks m8. :) There was a drawback though. After some testing on a Mustafar Conquest map, I discovered that my character could only switch classes from a few feet away from the CP at most. This was because in every instance I tested, my character actually had to be looking directly at where the CP's blue light was located to switch classes. Is there any way to work around this limitation? Also, even when the CP's blue light was visible, I found that I could still only switch classes from a short distance. When I tried to make the range longer than 999, HxD editor gave a warning message saying something about changing the file size, which (I think) crashes the game (please tell me if it doesn't). Is there any way around this as well? Anyway, I want to create a mod specifically for Mustafar, so could you please perhaps elaborate on your second method of including the change into the assets of one world? Thanks in advance!
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3285
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: Star Wars Battlefront II PC Spawn

Post by AceMastermind »

JoshuaTedder wrote:...I replaced the value for the "SwitchClassRadius" property to 999 for all of them just in case. After some testing I discovered that my character could only switch classes from a few feet away from the CP at most. ... my character actually had to be looking directly at where the CP's blue light was located to switch classes. Is there any way to work around this limitation?
I don't know, I have no idea what hardcoded limitations are in place for that property.
JoshuaTedder wrote:Also, even when the CP's blue light was visible, I found that I could still only switch classes from a short distance. When I tried to make the range longer than 999, HxD editor gave a warning message saying something about changing the file size, which (I think) crashes the game (please tell me if it doesn't). Is there any way around this as well?
Again I don't know, you might have hit a limit of the property. The warning message means you added bytes instead of overwriting them.
When you add/remove bytes you have to adjust header sizes to count for it. If the value can be no more than 4 bytes then 99.9 would likely be the limit if the decimal has to be there.

JoshuaTedder wrote:Anyway, I want to create a mod specifically for Mustafar, so could you please perhaps elaborate on your second method of including the change into the assets of one world?
I was referring to creating a new map and not editing a shipped one, I suppose you could do this:
http://www.gametoast.com/viewtopic.php? ... 19#p257439
and replace the CPs with custom ones.
I've never had much interest in editing shipped maps, maybe someone with more experience there could provide more help, but it shouldn't be more than copying CP files to your ODF and MSH folders and changing property values then swapping out the originals in ZeroEditor.
JoshuaTedder
Private
Posts: 35
Joined: Wed Oct 28, 2015 5:37 pm
Projects :: Different random projects.
Games I'm Playing :: Battlefront II
xbox live or psn: No gamertag set

Re: Star Wars Battlefront II PC Spawn

Post by JoshuaTedder »

Okay, here is an image of the value and program that I am currently playing around with:

http://postimg.org/image/594w0zry5/full/

Could you please elaborate on changing the header sizes? I used the Insert - Bytes function that the HxD Hex Editor has, and it didn't matter if I put another value before or after the "999", the game either crashed or my character could not spawn in at all (no command posts were showing as existent, it was like they didn't exist). I even tried putting in 99.99, which is less than 999 but which also adds bytes to the file. This didn't work either. However, I only played around with it about five hours, so there certainly could be more methods/values that I could try. The "999" worked fine in-game, so I don't think a decimal is necessary. I changed the middle "9" into a decimal to test this, and the range was back to very small (very close to the base value of "5.0"). In the future I will test it and keep a record of what values actually crash the game and what values simply limit me from spawning, because if all the command posts have gigantic values, then all the command post control areas will be overlapping each other, even the ones for the opposing team. This would probably cause issues. Maybe if the range of the CPs were off the map it would cause issues as well, I don't know.

I will try the map editing/creating part when I have sufficient time away from school, which may be a while. :) For when I need it though, what MSH files are you referring to?

Thanks again for your helpfulness!

Edit: Is there any program or information source that could help me with the scale of BFII maps? For example, what does "999" actually mean within an in-game context?
Last edited by JoshuaTedder on Sun Feb 07, 2016 3:30 pm, edited 1 time in total.
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3285
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: Star Wars Battlefront II PC Spawn

Post by AceMastermind »

JoshuaTedder wrote:Could you please elaborate on changing the header sizes?
1. The first 4 bytes of the lvl file starts with UCFB and the next 4 bytes are the length of the whole file (minus 8 bytes).
Example:
75 63 66 62 18 62 E5 00

75 63 66 62 = UCFB - lvl file header
18 62 E5 00 = length of file data

All lengths are stored in little endian byte order, so you would read it in reverse like this:
00 E5 62 18
you can ignore any leading zeros and just read it like this:
E5 62 18
and convert that to decimal which is:
15032856 bytes
and if you added 4 bytes to the file it will be:
15032860 bytes
then you would convert that back to hex which is:
E5 62 1C
and finally format it back to little endian and overwrite the previous length:
1C 62 E5 00



2. You also have the ODF header that needs to be updated only if you add bytes to a property inside it.
Example:
65 6E 74 63 A8 03 00 00

65 6E 74 63 = entc - declares new entity class ODF
A8 03 00 00 = length of ODF data (minus 8 bytes)



3. Then you have individual property data that i'm not 100% sure about the more I look at it.
This is how SwitchClassRadius property is stored:
50 52 4F 50 08 00 00 00 19 B1 C9 4B 35 2E 30 00

50 52 4F 50 = PROP - declares property data
08 00 00 00 = length of property data (minus 8 bytes)
19 B1 C9 4B = SwitchClassRadius hash
35 2E 30 00 = 5.0. - the radius value in meters null-terminated

but then you'll see some properties with a length 09 that have 12 bytes of data...
It looks like there must always be a 00 preceeding PROP, if not, an extra 4 bytes of padding is put between the property value and next PROP.
So if you wanted to use the value 9999 it would probably look like this:
50 52 4F 50 09 00 00 00 19 B1 C9 4B 39 39 39 39 00 00 00 00
The property length also has to account for the 00 at the end of every property value, the other trailing zeros are ignored only by the property header.


So, that is at least 3 headers you need to adjust when adding bytes to property data.



... what MSH files are you referring to?
com_bldg_controlzone.msh
com_bldg_controlzone.msh.option
common_bldg_commandpost.tga
common_bldg_commandpost_bump.tga
common_bldg_commandpost_bump.tga.option
in:
data_ABC\Common\mshs\PC
and:
com_bldg_controlzone.odf
in:
data_ABC\Common\odfs

You would copy those files into their corresponding folders in your world's assets:
data_ABC\Worlds\ABC\odf
data_ABC\Worlds\ABC\msh

then rename the ODF.
JoshuaTedder
Private
Posts: 35
Joined: Wed Oct 28, 2015 5:37 pm
Projects :: Different random projects.
Games I'm Playing :: Battlefront II
xbox live or psn: No gamertag set

Re: Star Wars Battlefront II PC Spawn

Post by JoshuaTedder »

Thanks! I should be able to work on this some this weekend. :) When you say minus 8, is that in bytes and is that to exclude the header from the file size? About that padding thing, it's weird and I soon learned not to fiddle around with it. :D Also, what would I edit in the MSH, Option, and TGA files? I opened them up (in HxD Editor, which is totally wrong for these types of files I'm pretty sure) and couldn't make heads or tails of them. I would think that you need some sort of editor program to edit them but I don't know. Thanks in advance!
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3285
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: Star Wars Battlefront II PC Spawn

Post by AceMastermind »

JoshuaTedder wrote:When you say minus 8, is that in bytes and is that to exclude the header from the file size?
Correct
About that padding thing, it's weird and I soon learned not to fiddle around with it.
It's actually not that weird, you always have to end the value with a 00, if you can't then you must add 4 bytes, then adjust headers accordingly.
I guess the correct term to use here is null-terminated.
https://chortle.ccsu.edu/AssemblyTutori ... s20_2.html
Also, what would I edit in the MSH, Option, and TGA files? I opened them up (in HxD Editor, which is totally wrong for these types of files I'm pretty sure) and couldn't make heads or tails of them. I would think that you need some sort of editor program to edit them but I don't know.
You only need to edit the ODF here which is just a text file, a code editor like Notepad++ would be perfect for editing any text file in the tools.
Post Reply