Page 1 of 1

How to add multiple maps into one folder (tutorial)

Posted: Sun Jan 25, 2009 12:16 am
by Commander_Fett
:jango: Well, here's a tut I wrote on how to put multiple maps in one addon folder, like the 607th or the convo pack. I tried to add as much detail as possible, so it would be easy to understand.

link

or, the posted version:

How to add multiple maps in one addon folder
By Commander_Fett

So, you want to know how to add more than one map in an addon, eh?
Well, here's the simple-ish steps on how to do so.

Step 1: Well, make your maps. Mine will be AOH and MAB in the examples.

Step 2: Make a new map. Give it only one mode, It doesn't really matter what it is, as it's going to be taken out later annyway. Mine will be 347.

Step 3: Copy the LUAs from your other to maps to your new one's common/scripts/347 folder, with the other LUAs.
Note: These are the LUAs that will setup the game, the old LUAs don't affect it anymore when you're done with this tutorial.

Step 4: Make (or copy) the LUAs' reqs from your other two maps. These reqs will be located in your data_AOH/common/mission folder, they will be the same name as the LUAs. Make (or copy them from your other 2 maps) in your data_347/common/mission folder.

Step 5:Now, open up your mission.req located in your data_347/common folder. It should look something like this:
Hidden/Spoiler:
[code]ucft
{
REQN
{
"config"
"ingame_movies"
}

REQN
{
"script"
"setup_teams"
"gametype_conquest"
"gametype_capture"
"Objective"
"MultiObjectiveContainer"
"ObjectiveCTF"
"ObjectiveAssault"
"ObjectiveSpaceAssault"
"ObjectiveConquest"
"ObjectiveTDM"
"ObjectiveOneFlagCTF"
"SoundEvent_ctf"
"ObjectiveGoto"
"LinkedShields"
"LinkedDestroyables"
"LinkedTurrets"
"Ambush"
"PlayMovieWithTransition"
}

REQN
{
"lvl"
"347g_con"
"347c_con"
}
}[/code]
Change it to read your maps' LUAs, like so:
Hidden/Spoiler:
[code]ucft
{
REQN
{
"config"
"ingame_movies"
}

REQN
{
"script"
"setup_teams"
"gametype_conquest"
"gametype_capture"
"Objective"
"MultiObjectiveContainer"
"ObjectiveCTF"
"ObjectiveAssault"
"ObjectiveSpaceAssault"
"ObjectiveConquest"
"ObjectiveTDM"
"ObjectiveOneFlagCTF"
"SoundEvent_ctf"
"ObjectiveGoto"
"LinkedShields"
"LinkedDestroyables"
"LinkedTurrets"
"Ambush"
"PlayMovieWithTransition"
}

REQN
{
"lvl"
"MABg_con"
"MABc_con"
"MABg_eli"
"AOHg_con"
"AOHc_con"
"AOHc_xl"
}
}[/code]
Step 6: Now to Edit the addme scripts. Go to your data_347/addme folder and open up the addme.LUA.
It will look something like this:
Hidden/Spoiler:
[code]--Search through the missionlist to find a map that matches mapName,
--then insert the new flags into said entry.
--Use this when you know the map already exists, but this content patch is just
--adding new gamemodes (otherwise you should just add whole new entries to the missionlist)
function AddNewGameModes(missionList, mapName, newFlags)
for i, mission in missionList do
if mission.mapluafile == mapName then
for flag, value in pairs(newFlags) do
mission[flag] = value
end
end
end
end




--insert totally new maps here:
local sp_n = 0
local mp_n = 0
sp_n = table.getn(sp_missionselect_listbox_contents)

sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "347%s_%s", era_g = 1, era_c = 1, mode_con_g = 1, mode_con_c = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

-- associate this mission name with the current downloadable content directory
-- (this tells the engine which maps are downloaded, so you need to include all new mission lua's here)
-- first arg: mapluafile from above
-- second arg: mission script name
-- third arg: level memory modifier. the arg to LuaScript.cpp: DEFAULT_MODEL_MEMORY_PLUS(x)

AddDownloadableContent("347","347g_con",4)
AddDownloadableContent("347","347c_con",4)

-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\347\\data\\_LVL_PC\\core.lvl")[/code]
Copy it for our 2 maps, like this:
Hidden/Spoiler:
[code]--Search through the missionlist to find a map that matches mapName,
--then insert the new flags into said entry.
--Use this when you know the map already exists, but this content patch is just
--adding new gamemodes (otherwise you should just add whole new entries to the missionlist)
function AddNewGameModes(missionList, mapName, newFlags)
for i, mission in missionList do
if mission.mapluafile == mapName then
for flag, value in pairs(newFlags) do
mission[flag] = value
end
end
end
end




--insert totally new maps here:
local sp_n = 0
local mp_n = 0
sp_n = table.getn(sp_missionselect_listbox_contents)

sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "347%s_%s", era_g = 1, era_c = 1, mode_con_g = 1, mode_con_c = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

--note to readers of this tut:just copy the 3 lines above, and BE SURE TO ALSO COPY sp_n = table.getn(sp_missionselect_listbox_contents) and paste it above that, otherwise it won't work right

sp_n = table.getn(sp_missionselect_listbox_contents)
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "347%s_%s", era_g = 1, era_c = 1, mode_con_g = 1, mode_con_c = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

-- associate this mission name with the current downloadable content directory
-- (this tells the engine which maps are downloaded, so you need to include all new mission lua's here)
-- first arg: mapluafile from above
-- second arg: mission script name
-- third arg: level memory modifier. the arg to LuaScript.cpp: DEFAULT_MODEL_MEMORY_PLUS(x)

AddDownloadableContent("347","347g_con",4)
AddDownloadableContent("347","347c_con",4)

-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\347\\data\\_LVL_PC\\core.lvl")[/code]
Now, just so it's easier to read, split up the map section like this:
Hidden/Spoiler:
[code]--Search through the missionlist to find a map that matches mapName,
--then insert the new flags into said entry.
--Use this when you know the map already exists, but this content patch is just
--adding new gamemodes (otherwise you should just add whole new entries to the missionlist)
function AddNewGameModes(missionList, mapName, newFlags)
for i, mission in missionList do
if mission.mapluafile == mapName then
for flag, value in pairs(newFlags) do
mission[flag] = value
end
end
end
end




--insert totally new maps here:
local sp_n = 0
local mp_n = 0
sp_n = table.getn(sp_missionselect_listbox_contents)

sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1,
mapluafile = "347%s_%s",
era_g = 1,
era_c = 1,
mode_con_g = 1,
mode_con_c = 1,
}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

--note to readers of this tut:just copy the 3 lines above, and BE SURE TO ALSO COPY sp_n = table.getn(sp_missionselect_listbox_contents) and paste it above that, otherwise it won't work right

sp_n = table.getn(sp_missionselect_listbox_contents)
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1,
mapluafile = "347%s_%s",
era_g = 1,
era_c = 1,
mode_con_g = 1,
mode_con_c = 1,
}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

-- associate this mission name with the current downloadable content directory
-- (this tells the engine which maps are downloaded, so you need to include all new mission lua's here)
-- first arg: mapluafile from above
-- second arg: mission script name
-- third arg: level memory modifier. the arg to LuaScript.cpp: DEFAULT_MODEL_MEMORY_PLUS(x)

AddDownloadableContent("347","347g_con",4)
AddDownloadableContent("347","347c_con",4)

-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\347\\data\\_LVL_PC\\core.lvl")[/code]
Now edit the mapluafile = "347%s_%s", part of the addme to read your map, like mapluafile = "AOH%s_%s", .
Then, add your modes and eras to your addme.LUA, like I have. Change it to match your LUA setup. So, in
my AOH map, I have extra large mode for clone wars, and conquest for galactic ciivil war and clone wars.
In MAB, I have galactic civil war and clone wars conquest, and galactic civil war hero assault.
My addme would look like this:
Hidden/Spoiler:
[code]--Search through the missionlist to find a map that matches mapName,
--then insert the new flags into said entry.
--Use this when you know the map already exists, but this content patch is just
--adding new gamemodes (otherwise you should just add whole new entries to the missionlist)
function AddNewGameModes(missionList, mapName, newFlags)
for i, mission in missionList do
if mission.mapluafile == mapName then
for flag, value in pairs(newFlags) do
mission[flag] = value
end
end
end
end




--insert totally new maps here:
local sp_n = 0
local mp_n = 0
sp_n = table.getn(sp_missionselect_listbox_contents)

sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1,
mapluafile = "AOH%s_%s",
era_c = 1,
era_g = 1,
mode_con_c = 1,
mode_con_g = 1,
mode_xl_c = 1,
change = {
mode_xl = { name="Uber Mode",},
}
}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

sp_n = table.getn(sp_missionselect_listbox_contents)
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1,
mapluafile = "MAB%s_%s",
era_c = 1,
era_g = 1,
mode_con_c = 1,
mode_con_g = 1,
mode_eli_g = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

-- associate this mission name with the current downloadable content directory
-- (this tells the engine which maps are downloaded, so you need to include all new mission lua's here)
-- first arg: mapluafile from above
-- second arg: mission script name
-- third arg: level memory modifier. the arg to LuaScript.cpp: DEFAULT_MODEL_MEMORY_PLUS(x)

AddDownloadableContent("347","347g_con",4)
AddDownloadableContent("347","347c_con",4)


-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\347\\data\\_LVL_PC\\core.lvl")[/code]
Now, almost done with editing the addme. at the part that says:
Hidden/Spoiler:
[code]AddDownloadableContent("347","347g_con",4)
AddDownloadableContent("347","347c_con",4)[/code]
make it read your maps, like so:
Hidden/Spoiler:
[code]AddDownloadableContent("AOH","AOHg_con",4)
AddDownloadableContent("AOH","AOHc_con",4)
AddDownloadableContent("AOH","AOHc_xl",4)
AddDownloadableContent("MAB","MABg_con",4)
AddDownloadableContent("MAB","MABc_con",4)
AddDownloadableContent("MAB","MABg_eli",4)[/code]
Step 7: okay, now that you have your LUAs, their respective reqs, have edited your mission.req and set up your addme.LUA, it's time to munge!

Step 8: Okay, now that you've munged your map (make sure to munge localizations for the maps and sides too, I'll explain this at the bottom)
It's time to head on over to the gamedata folder.
Go to the directory where you installed the game and open up the Gamedata folder.
(default is C:\Program Files\LucasArts\Star Wars Battlefront II)
Go to the addon folder, and open up your other 2 maps (MAB and AOH).
Now, go into data/_LVL_PC and copy over the map's folder (will say MAB or AOH) to the 347/data/_LVL_PC folder.
Once you've copied over the maps, copy over your custom sides .lvl files into your 347/data/_LVL_PC/SIDE folder (make the folder).
Now, copy any custom Loadscreens into a LOad folder (note: loadscreens must have different names, or else one will overwrite the others)

Now, you have a working mappack folder! Yay!

Instructions on setting up the localization for your maps:
in your data_347 folder, open up the editlocalize.bat.
Go to the section that says mapname, then right click on descripton.
Select "add key" (scopes open up, keys are what's being localized).
Name the key MAB (or whatever the map's 3 letter initial is) and type the name of the map in the box on the right.
Do it for all the languages in the dropdown box.
Repeat this process for the other maps in 347.
Next, go to "description", add the keys, and write the map's description.
Next, munge and make sure you select the "localize" box and after it's done, your maps have names. :bobba:

Re: How to add multiple maps into one folder

Posted: Sun Jan 25, 2009 12:29 am
by Sky_216
Thank you sir......very helpful :thumbs:


If things still get added to it, could this be added to the 'Everything You Need Thread' as its very beneficial to anyone making a mappack, especially one with custom sides.

Re: How to add multiple maps into one folder

Posted: Sun Jan 25, 2009 12:33 am
by Commander_Fett
You're welcome. :D

The main reason I did this because it would save a lot of space (not having to copy the sides from map to map)

Re: (tut) How to add multiple maps into one folder

Posted: Sun Jan 25, 2009 1:57 pm
by Ping
No offense, but wasn't there already a tutorial on how to do this?

Re: (tut) How to add multiple maps into one folder

Posted: Sun Jan 25, 2009 5:15 pm
by Commander_Fett
No. I checked the FAQ thread, and searched in the modding thread, but I found no tutorials on how to do this.

Re: (tut) How to add multiple maps into one folder

Posted: Sun Jan 25, 2009 5:24 pm
by Frisbeetarian

Re: (tut) How to add multiple maps into one folder

Posted: Sun Jan 25, 2009 5:38 pm
by Commander_Fett
oh. Didn't see those. Sorry.