Load level files from a separate ADDON folder?

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
ARC_Commander
High General
High General
Posts: 838
Joined: Tue Feb 06, 2007 7:18 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Load level files from a separate ADDON folder?

Post by ARC_Commander »

Would it be possible for an LUA to load level files from another map / mod's ADDON folder?

Let's say that someone made a map, and wants to load the BFX sides into their map. But the BFX sides are in the BFX folder in ADDON. Would there be a way to load the BFX sides?
User avatar
agzilla123
First Lance Corporal
First Lance Corporal
Posts: 135
Joined: Sun Aug 03, 2008 11:20 am

Re: Load level files from a separate ADDON folder?

Post by agzilla123 »

Coincidentally........I wanted to do that eventually lol. Sorry but i cannot help as I am very new. :cpu:
The_Emperor
Supreme Galactic Ruler
Posts: 2118
Joined: Sat Dec 10, 2005 6:30 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Waaaaay over there.

Re: Load level files from a separate ADDON folder?

Post by The_Emperor »

Copy the BFX side whateveritscalled.lvl into your maps SIDE folder and use the lua to load the units from that side as you would do with any other costum side. To do that you'd need to know the units odf names from BFX though.

But you shouldn't release the map without permission from the maker of BFX if you do that.

There may be a more fancy way or something, I dunno.
Aman/Pinguin
Jedi
Jedi
Posts: 1104
Joined: Tue Jan 30, 2007 6:04 am
Projects :: Inactive
Location: Germany

Re: Load level files from a separate ADDON folder?

Post by Aman/Pinguin »

Emp', that's the way I (Yes, I think my map is a part of the reason why he made this topic :P ) used before, but it raises up the file size alot...160MB ----> 543MB
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Load level files from a separate ADDON folder?

Post by Maveritchell »

Why are you loading your mod's sides from its own addon folder instead of the base SIDE folder? As long as it's named differently, it doesn't matter where it goes.
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Load level files from a separate ADDON folder?

Post by [RDH]Zerted »

Maveritchell wrote:Why are you loading your mod's sides from its own addon folder instead of the base SIDE folder?...
By base SIDE folder do you mean the game's side folder? If so, why would you risk spreading your files out into other directories instead of trying to keep everything in the map's folder or the addon folder? Putting files in other folders is just asking for trouble and problems down the road.

That said, you can read in files from anywhere on the computer. However, you only know that your map's folder exists. You shouldn't assume the folder structure of anything else. All you need to do is change the ReadDataFile() line to use the correct path to the file you want to read in.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Load level files from a separate ADDON folder?

Post by Maveritchell »

[RDH]Zerted wrote:
Maveritchell wrote:Why are you loading your mod's sides from its own addon folder instead of the base SIDE folder?...
By base SIDE folder do you mean the game's side folder? If so, why would you risk spreading your files out into other directories instead of trying to keep everything in the map's folder or the addon folder? Putting files in other folders is just asking for trouble and problems down the road.
I fail to see the risk. Worst-case is that someone ends up with an extra couple hundred MB in their sides folder. As long as nothing's overwritten, it's appropriate to do that in the case of a sides mod, I think. Although the decision to do that can of course be weighed against the likelihood of other people using those sides. If no one's going to use them, then I'd say of course keep it in the addon folder (as you said) for sake of ease. If letting other people use them is a primary concern, though, adding them to the game's SIDE folder is the easiest way to go about it.
ARC_Commander
High General
High General
Posts: 838
Joined: Tue Feb 06, 2007 7:18 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: Load level files from a separate ADDON folder?

Post by ARC_Commander »

Ah, I guess I will have to rename my level files, then. I had originally wanted to confine BFX to an ADDON folder, for sake of ease, but I guess that's what uninstaller programs are for.

Is there any way to edit the munge batch files so that they copy to the game's SIDE folder instead of the one in ADDON?
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: Load level files from a separate ADDON folder?

Post by Teancum »

Just do this:

1-Open \Star Wars Battlefront II\GameData\DATA\_LVL_PC\SIDE
2-Create a new folder called \BFX ( so it's now \Star Wars Battlefront II\GameData\DATA\_LVL_PC\SIDE\BFX )
3-Dump all of your sides in there
4-In your luas, use ReadDataFile("SIDE\\BFX\\rep.lvl",

Now the BFX sides are in a common folder, they don't conflict with anything else, and the changes to the LUA are easy.
wazmol
High General
High General
Posts: 892
Joined: Sat Sep 02, 2006 6:47 pm
Projects :: Thinking...
Games I'm Playing :: Black Ops
Location: London
Contact:

Re: Load level files from a separate ADDON folder?

Post by wazmol »

Teancum wrote:Just do this:

1-Open \Star Wars Battlefront II\GameData\DATA\_LVL_PC\SIDE
2-Create a new folder called \BFX ( so it's now \Star Wars Battlefront II\GameData\DATA\_LVL_PC\SIDE\BFX )
3-Dump all of your sides in there
4-In your luas, use ReadDataFile("SIDE\\BFX\\rep.lvl",

Now the BFX sides are in a common folder, they don't conflict with anything else, and the changes to the LUA are easy.
Thanks Tean' that will help a lot of people out. Great job!
MandeRek
Sith Master
Sith Master
Posts: 2766
Joined: Tue Oct 02, 2007 10:51 am
Projects :: Battlefront Zer0
Games I'm Playing :: SWTOR
xbox live or psn: No gamertag set
Location: Ghosting around GT
Contact:

Re: Load level files from a separate ADDON folder?

Post by MandeRek »

Wow! That will help me a lot! Thanks a lot tean!

This doesn't have influence on localisation scopes?
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: Load level files from a separate ADDON folder?

Post by Teancum »

It shouldn't. It looks for localization by ODF name. Where the file is should never matter, since it doesn't care if I file is in your addon folder or in \DATA\_LVL_PC\SIDE.


Doing it this way is really useful for a number of reasons:

1-If other people want to load your sides in their map, and they know how to do it, they can.
2-If you want to create an addon map pack or an additional map, it's really easy to call the same sides again
3-If you ever need to patch a side, you release one patch, no matter how many map packs you have.


NOTE: I only recommend doing this for larger-scale mods. If every Joe Schmoe did it for his one addon map it would piss folks off.
ARC_Commander
High General
High General
Posts: 838
Joined: Tue Feb 06, 2007 7:18 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: Load level files from a separate ADDON folder?

Post by ARC_Commander »

Gah, that came a little too late. However, I like this better than "repx.lvl" and etc, so I'll change my naming scheme again. Thanks!
Post Reply