Page 1 of 1

Trouble with multiple maps in one addon (Solved)

Posted: Wed Dec 31, 2008 4:54 pm
by Xavious
I followed Tean's tutorial on adding multiple maps to one addon folder exactly, yet when I load the game, only one of the maps shows up. (It's a space map, which may or may not be relevant) I noticed that in both the conversion pack and Mav's map pack (can't remember the name) that the folder in LVL_PC with the matching three letter name as the addon folder's name had a lvl file in it, while mine did not.

I'll post my related files, though I've checked them over several times myself.

addme.lua
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 = "RV1%s_%s", era_c = 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]

sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "SL1%s_%s", era_c = 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]

sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "YA1%s_%s", era_c = 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]

sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "KA1%s_%s", era_c = 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]

sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "MU1%s_%s", era_c = 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]

sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "XA1%s_%s", era_c = 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]

sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "JN1%s_%s", era_c = 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]

sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "SK1%s_%s", era_c = 1, mode_assault_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("SK1","SK1c_Diet Dr. Pepper",4)

AddDownloadableContent("JN1","JN1c_con",4)

AddDownloadableContent("XA1","XA1c_con",4)

AddDownloadableContent("MU1","MU1c_con",4)

AddDownloadableContent("KA1","KA1c_con",4)

AddDownloadableContent("YA1","YA1c_con",4)

AddDownloadableContent("SL1","SL1c_con",4)

AddDownloadableContent("RV1","RV1c_con",4)

-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\607\\data\\_LVL_PC\\core.lvl")[/code]
mission.req
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"
"RV1c_con"
"SL1c_con"
"YA1c_con"
"KA1c_con"
"MU1c_con"
"XA1c_con"
"JN1c_con"
"RV1g_con"
"SL1g_con"
"YA1g_con"
"KA1g_con"
"MU1g_con"
"XA1g_con"
"JN1g_con"
"SK1c_Diet Dr. Pepper"
}
}[/code]
In addition, all the map's mission req files are in ...\data_***\Common\mission, all the script folders are in ...\data_***\Common\scripts, and all the folders from each map's LVL_PC are in \addon\***\data\_LVL_PC.

Thanks in advance for any help.

Re: Trouble with multiple maps in one addon

Posted: Wed Dec 31, 2008 5:50 pm
by Maveritchell
I didn't look over your addme too hard, but part of the reason might be off the tack you're thinking - do you have my KotOR Galactic Conquest installed? You've used the same three-letter map code for your "Space Kamino" (I assume) that I used for the KotOR space map (SK1). This can mess up whatever else might appear.

Re: Trouble with multiple maps in one addon

Posted: Wed Dec 31, 2008 6:29 pm
by Xavious
Ok, well I re-munged all my maps and re-replaced the folders in LVL_PC, and that worked. I have no explanation for that or why it worked, but I'm just glad I fixed it.

EDIT: Crap, never mind. I had left the maps themselves in the addon folder, and that's the only reason it worked.

EDIT2: I put the map pack onto a clean Battlefront II with no additional mods installed, and I'm still getting just Space Kamino showing up on the map selection screen.

Re: Trouble with multiple maps in one addon

Posted: Wed Dec 31, 2008 6:47 pm
by RepSharpshooter
Ha I know your problem, space kamino is only showing up because it is the last one.

The addme lua is using sp_n to add maps to the table. Unfortunately, you are using the same value of sp_n everytime you call a different map, so all it is doing is overwriting over and over until kamino stays.

So to fix, put:

Code: Select all

sp_n = table.getn(sp_missionselect_listbox_contents)
Before each map is added.

Like this:
Hidden/Spoiler:
--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 = "RV1%s_%s", era_c = 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]

sp_n = table.getn(sp_missionselect_listbox_contents) --added these
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "SL1%s_%s", era_c = 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]

sp_n = table.getn(sp_missionselect_listbox_contents) --added these etc
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "YA1%s_%s", era_c = 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]

sp_n = table.getn(sp_missionselect_listbox_contents)
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "KA1%s_%s", era_c = 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]

sp_n = table.getn(sp_missionselect_listbox_contents)
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "MU1%s_%s", era_c = 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]

sp_n = table.getn(sp_missionselect_listbox_contents)
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "XA1%s_%s", era_c = 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]

sp_n = table.getn(sp_missionselect_listbox_contents)
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "JN1%s_%s", era_c = 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]

sp_n = table.getn(sp_missionselect_listbox_contents)
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "SK1%s_%s", era_c = 1, mode_assault_c = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]
Im 98% sure that's what the issue is, for I had the same problem with battle arena and hoth king of the hill.

Re: Trouble with multiple maps in one addon

Posted: Wed Dec 31, 2008 7:28 pm
by Tygr
Where is this tutorial?

Re: Trouble with multiple maps in one addon

Posted: Thu Jan 01, 2009 5:48 pm
by Xavious
Thanks Rep, that worked perfectly.

Re: Trouble with multiple maps in one addon (Solved)

Posted: Thu Jan 01, 2009 9:33 pm
by [RDH]Zerted
For less code, you could have also just did sp_n+1, then sp_n+2, then sp_n+3, etc...