Editing LUA's on downloaded maps

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
TJam11
Private Recruit
Posts: 15
Joined: Mon Nov 30, 2015 12:41 pm
Projects :: No Mod project currently.
Games I'm Playing :: SWBF2
xbox live or psn: No gamertag set

Editing LUA's on downloaded maps

Post by TJam11 »

Hi All,

Does anyone know if it's possible to edit the Conquest LUA's on the maps you've downloaded?

There is some cool maps out there, but I'd like to make some small gameplay customisations to them, like changing the hero that spawns etc.

Thanks.
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: Editing LUA's on downloaded maps

Post by AnthonyBF2 »

Yes it is possible but limited. If you really want it I will write a mini tutorial later, I am busy right now.
For now tell me what mod or mods you want to edit so I can get them and look at them myself.
TJam11
Private Recruit
Posts: 15
Joined: Mon Nov 30, 2015 12:41 pm
Projects :: No Mod project currently.
Games I'm Playing :: SWBF2
xbox live or psn: No gamertag set

Re: Editing LUA's on downloaded maps

Post by TJam11 »

AnthonyBF2 wrote:Yes it is possible but limited. If you really want it I will write a mini tutorial later, I am busy right now.
For now tell me what mod or mods you want to edit so I can get them and look at them myself.
Thanks Anthony, that's very kind of you.

I downloaded a map pack from Jaspo's post in mods & maps (Map pack 2). There are some cool maps there. Ideally, I want to do three (hopefully) simple things with any given map:

1. Change Jedi hero to whomever I want
2. Remove "points to unlock" on jet troopers etc. (Stock sides are fine, no too bothered about mod sides).
3. Change weapon loadout (Give the jet trooper a rifle etc.)

And that's it. I would be a happy gamer.

For those last two, is there any way you can make one change to the unit that will then take effect across the board, regardless of what map you play? So you just need to change one thing and then he will always have a rifle on every map? Or is it map specific?

Thanks for your help.
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: Editing LUA's on downloaded maps

Post by AnthonyBF2 »

Some things can be done with the 1.3 patch. Look in the released maps and mods subforum and you'll find the 1.3 r129 patch at the top of the board. This is the final version, and this is the very first mod recommended to install because it is a support platform for lots of old mods and most current/recent mods. Another thing the 1.3 patch comes with is an ingame thing called Fake Console in the pause menu. That menu is a long list of commands that can alter gameplay. Somewhere in the list of commands you will find a thing called "Remove Point Limits" and you can get free specials. You'll have to activate that command every new map because Fake Console commands don't travel map to map. Fake Console is also a global thing, and by that I mean it works on all stock stuff and mod stuff.

Again, I need to know the specific mod/map you want to edit so I can look at it myself and design some edits.
Switching heroes and weapons would require edits to the files in that mod/map or stock files but I need to know what exact stuff you want to change.

Also please note that some people who make mods don't want their work changed or redistributed with changes that go against their permission. Again, I need to know what you want to edit so I can check the creator of it.
TJam11
Private Recruit
Posts: 15
Joined: Mon Nov 30, 2015 12:41 pm
Projects :: No Mod project currently.
Games I'm Playing :: SWBF2
xbox live or psn: No gamertag set

Re: Editing LUA's on downloaded maps

Post by TJam11 »

AnthonyBF2 wrote:Some things can be done with the 1.3 patch. Look in the released maps and mods subforum and you'll find the 1.3 r129 patch at the top of the board. This is the final version, and this is the very first mod recommended to install because it is a support platform for lots of old mods and most current/recent mods. Another thing the 1.3 patch comes with is an ingame thing called Fake Console in the pause menu. That menu is a long list of commands that can alter gameplay. Somewhere in the list of commands you will find a thing called "Remove Point Limits" and you can get free specials. You'll have to activate that command every new map because Fake Console commands don't travel map to map. Fake Console is also a global thing, and by that I mean it works on all stock stuff and mod stuff.

Again, I need to know the specific mod/map you want to edit so I can look at it myself and design some edits.
Switching heroes and weapons would require edits to the files in that mod/map or stock files but I need to know what exact stuff you want to change.

Also please note that some people who make mods don't want their work changed or redistributed with changes that go against their permission. Again, I need to know what you want to edit so I can check the creator of it.
Yeah, that's understandable.

I would never change something to redistribute it (as you can see, I'm too much of a noob to know how), I just mod things for my own pleasure.

Okay, let's try: Bespin - Industry City by YodaTheHutt

Lets change Boba Fett hero for the Empire to Darth Vader.

And could we equip the dark trooper with a rifle instead of his pistol.

That's it. If the fundamentals are essentially the same for all maps, then I can learn from this example and apply it to others.

I try and do as much reading as I can but this was definitely a topic I thought I needed to ask about, so thanks for your help.

And hey, at least it means there are still people talking about this game! EA's new version just doesn't have the fun factor like this game has.
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: Editing LUA's on downloaded maps

Post by AnthonyBF2 »

I can already tell you it is not possible to replace Boba with Vader because the technical name for Vader is larger than Boba's and in hex editing an existing file, you can only replace something that is equal in length or shorter or else you will overwrite other data and break the file.

Now for weapons, this is done on the side files which means it would automatically work for all maps and should be possible. Keep in mind I haven't modded like this in a long time so I am sorry if it fails or doesn't make much sense. I am writing the following instructions on memory:

1) Go to your main game folder and go into data, _lvl_pc, side, and take imp.lvl and right-click on it and press copy, then press ctrl-v on your keyboard to paste a copy of the file. The copy is a backup in case the game breaks at some point or you want to delete the mod. Then take the regular imp.lvl and open it into a hex editor application. The recommended hex app is called HxD, it is 100% free and very simple to use.

2) Once you have imp.lvl open in HxD, press ctrl+g and in the offset entry window type in 1928A4C and it should take you to the first instance of the Dark Trooper's primary weapon. On the right side of the hex editor, you'll see a text string that looks like imp_weap_inf_arccaster. Now, write rifle over the part that looks like arcca but you still have a piece of leftover string that looks like ster so to get rid of that, highlight those 4 bytes of data ( ster ) and right-click on it and press "Fill Selection" then press ok and it will fill that leftover string with nothing.

3) Repeat the above step for all other instances of weapon load outs for the Dark Trooper, for the Dark Trooper, there is only one more and it is located at offset 1E17094.

4) Save changes to the file and play the game. Dark Trooper should now have blaster rifle.

Note that multiplayer will be broken while you have the mod so you'll need to undo the mod for multiplayer. I won't go into explaining how the host/client system works but in short, the host always owns the weapon loadout and your game will crash since it mismatches.
Also note this is intended only for the default imp.lvl, this won't be applicable to other files even if they have Dark Trooper stuff because the offset locations would be different.

If you want to edit more and more default content you'll eventually have to learn how to use the mod tools and build new files, in the end is simpler. Hex editing is quick but only if you want to make a few changes a few times.
TJam11
Private Recruit
Posts: 15
Joined: Mon Nov 30, 2015 12:41 pm
Projects :: No Mod project currently.
Games I'm Playing :: SWBF2
xbox live or psn: No gamertag set

Re: Editing LUA's on downloaded maps

Post by TJam11 »

Wow, you seriously wrote that on memory?!? Mega impressive! Although you obviously used to mod far too much if you can remember line numbers like 1E17094 xD haha.

Brill, well that has given me an understanding of what's possible and what isn't possible.

I thought hex editing might come into play. At least for the stock maps I might be able to change things around. Am I right in assuming that if you reversed the process above, so gave an infantry soldier an arc caster instead of a rifle, it wouldn't work because arc caster is longer than rifle?

Would it not also be possible to edit a side using the ODF's in mod tools, munge it into an lvl file and then swap the files around in the main SWBF2 directory?

I've been trying to change the weapon loadouts for soldiers in my own modded map, but it isn't working for some reason :/

Many thanks for your help Anthony :D



EDIT
Okay I figured it out. At least the weapon changing bit anyway.

I used my method above.

I just changed the odf's in the mod tools, munged it into an lvl and replaced the side file in the directory.

Works a charm!

I understand it won't work for modded maps as they have their own side files.

But at least I know how to do it for stock maps. And I already know how to change heroes on their LUA's.

If I want more maps then I guess the solution is simple.... Build my own. xD haha
Post Reply