Page 1 of 1
Load level files from a separate ADDON folder?
Posted: Sun Aug 10, 2008 3:28 pm
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?
Re: Load level files from a separate ADDON folder?
Posted: Sun Aug 10, 2008 3:34 pm
by agzilla123
Coincidentally........I wanted to do that eventually lol. Sorry but i cannot help as I am very new.

Re: Load level files from a separate ADDON folder?
Posted: Sun Aug 10, 2008 3:41 pm
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.
Re: Load level files from a separate ADDON folder?
Posted: Sun Aug 10, 2008 3:44 pm
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

) used before, but it raises up the file size alot...160MB ----> 543MB
Re: Load level files from a separate ADDON folder?
Posted: Sun Aug 10, 2008 4:00 pm
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.
Re: Load level files from a separate ADDON folder?
Posted: Sun Aug 10, 2008 5:09 pm
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.
Re: Load level files from a separate ADDON folder?
Posted: Sun Aug 10, 2008 5:15 pm
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.
Re: Load level files from a separate ADDON folder?
Posted: Sun Aug 10, 2008 6:56 pm
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?
Re: Load level files from a separate ADDON folder?
Posted: Sun Aug 10, 2008 10:54 pm
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.
Re: Load level files from a separate ADDON folder?
Posted: Mon Aug 11, 2008 6:48 am
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!
Re: Load level files from a separate ADDON folder?
Posted: Mon Aug 11, 2008 7:22 am
by MandeRek
Wow! That will help me a lot! Thanks a lot tean!
This doesn't have influence on localisation scopes?
Re: Load level files from a separate ADDON folder?
Posted: Mon Aug 11, 2008 8:45 am
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.
Re: Load level files from a separate ADDON folder?
Posted: Mon Aug 11, 2008 8:56 am
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!